PROCESS BEFORE OUTPUT.
MODULE status_0100.
*
PROCESS AFTER INPUT.
MODULE user_command_0100.
MODULE exit_command_0100 AT EXIT-COMMAND.
源码:
**Project Name : SAP Implementation Project
**Program Name : ZTOOL
**Description : 运维工具箱
**Date/Autohr :
** M O D I F I C A T I O N L O G
** ChangeDate Programmer Request Description
** ========== ========== ========== =================================
- 001
REPORT ztool MESSAGE-ID zmm
NO STANDARD PAGE HEADING
LINE-SIZE 120
LINE-COUNT 90.
*** Global Data Declear
INCLUDE ztoolc01.
INCLUDE ztooltop.
INCLUDE ztoolo01.
INCLUDE ztooli01.
INCLUDE ztoolf01.
======================================================================
- Selection Screen Events
======================================================================
*** Maintain Selection Screen Output
AT SELECTION-SCREEN OUTPUT. - PERFORM set_screen.
*** F4 Value Help
*AT SELECTION-SCREEN ON VALUE-REQUEST FOR <p_upfn>.
*** Check Input Data
AT SELECTION-SCREEN.
======================================================================
- report events
======================================================================
*** initial data
INITIALIZATION.
*** Prepare Report Data
START-OF-SELECTION.
CALL SCREEN g_screen.
*** Output Report
END-OF-SELECTION.
======================================================================
- list events
======================================================================
*** page header
TOP-OF-PAGE.
*** Page Header After First List
TOP-OF-PAGE DURING LINE-SELECTION.
*** Page Footer
END-OF-PAGE.
*** When Double Click
AT LINE-SELECTION.
*** When Click Some Icon (function code)
*at user-command.
&---------------------------------------------------------------------
*& 包含 ZPS005C01
&---------------------------------------------------------------------
&---------------------------------------------------------------------
*& 包含 ZPS005TOP
&---------------------------------------------------------------------
TYPE-POOLS: slis,icon.
DATA g_screen TYPE i VALUE 100.
DATA ok_code TYPE sy-ucomm.
TYPES:
BEGIN OF ia_graphic_table,
line(255) TYPE x,
END OF ia_graphic_table,
it_graphic_table TYPE STANDARD TABLE OF ia_graphic_table,
icl_docking TYPE REF TO cl_gui_docking_container, "docking
icl_pciture TYPE REF TO cl_gui_picture.
DATA:
gcl_docking_right TYPE REF TO cl_gui_docking_container, "右部docking
gcl_pciture TYPE REF TO cl_gui_picture.
DATA: gv_error TYPE c.
&---------------------------------------------------------------------
*& 包含 ZPS005O01
&---------------------------------------------------------------------
&---------------------------------------------------------------------
*& Module STATUS_0100 OUTPUT
&---------------------------------------------------------------------
-
text
----------------------------------------------------------------------
MODULE status_0100 OUTPUT.
SET PF-STATUS ‘ZTOOL’.
SET TITLEBAR ‘ZTOOL’.
- PERFORM create_docking .
ENDMODULE.
&---------------------------------------------------------------------
*& 包含 ZPS005I01
&---------------------------------------------------------------------
&---------------------------------------------------------------------
*& Module USER_COMMAND_0100 INPUT
&---------------------------------------------------------------------
-
text
----------------------------------------------------------------------
MODULE user_command_0100 INPUT.
SELECT SINGLE
tcode
FROM tstc
INTO @DATA(lv_tcode)
WHERE tcode = @ok_code.
IF lv_tcode IS NOT INITIAL.
CALL TRANSACTION ok_code. "调用其它事务
ELSE.
MESSAGE ‘事务码’ && ok_code && ‘不存在’ TYPE ‘E’.
ENDIF.
CLEAR ok_code.
ENDMODULE.
MODULE exit_command_0100 INPUT.
CASE ok_code.
WHEN ‘BACK’.
SET SCREEN 0.
LEAVE SCREEN. " to SCREEN 0.
WHEN ‘BREAK’ OR ‘EXIT’ .
LEAVE PROGRAM.
ENDCASE.
CLEAR ok_code.
ENDMODULE.
&---------------------------------------------------------------------
*& 包含 ZPS005F01
&---------------------------------------------------------------------
&---------------------------------------------------------------------
*& Form CREATE_SCRREN
&---------------------------------------------------------------------
-
text
----------------------------------------------------------------------
-
–> p1 text
-
<-- p2 text
----------------------------------------------------------------------
FORM create_docking .
IF gcl_docking_right IS INITIAL. -
创建右部的Docking容器
PERFORM add_docking
CHANGING gcl_docking_right. "右部的Docking容器 -
创建picture对象
PERFORM create_picture
USING gcl_docking_right "右部的Docking容器
CHANGING gcl_pciture. "Picture 对象 -
显示图片
PERFORM display_picture
USING gcl_pciture.
ENDIF.
ENDFORM.
&---------------------------------------------------------------------
*& Form ADD_DOCKING
&---------------------------------------------------------------------
-
创建底部和右部的Docking容器
----------------------------------------------------------------------
- <-- PCCL_DOCKING_RIGHT 右部的Docking容器
----------------------------------------------------------------------
FORM add_docking
CHANGING pccl_docking_right TYPE icl_docking.
CREATE OBJECT pccl_docking_right
EXPORTING
repid = sy-repid
dynnr = ‘100’
side = cl_gui_docking_container=>dock_at_right
extension = 840.
ENDFORM.
&---------------------------------------------------------------------
*& Form CREATE_PICTURE
&---------------------------------------------------------------------
-
创建picture对象
----------------------------------------------------------------------
-
<--PCCL_PCITURE PCITURE对象
----------------------------------------------------------------------
FORM create_picture
USING pucl_docking_right TYPE icl_docking
CHANGING pccl_pciture TYPE icl_pciture.
CREATE OBJECT pccl_pciture
EXPORTING
parent = pucl_docking_right.
ENDFORM.
&---------------------------------------------------------------------
*& Form DISPLAY_PICTURE
&---------------------------------------------------------------------
-
显示图片
----------------------------------------------------------------------
-
-->PUCL_PCITURE PCITURE对象
----------------------------------------------------------------------
FORM display_picture
USING pucl_pciture TYPE icl_pciture.
DATA: l_graphic_xstr TYPE xstring,
l_graphic_size TYPE i,
l_graphic_conv TYPE i,
l_graphic_offs TYPE i,
la_graphic_table TYPE ia_graphic_table,
lt_graphic_table TYPE it_graphic_table,
l_url(255) TYPE c.
-
取得图片
CALL METHOD cl_ssf_xsf_utilities=>get_bds_graphic_as_bmp
EXPORTING
p_object = ‘GRAPHICS’
p_name = ‘ZDZDPTLCT’
p_id = ‘BMAP’
p_btype = ‘BCOL’
RECEIVING
p_bmp = l_graphic_xstr
EXCEPTIONS
not_found = 1
internal_error = 2
OTHERS = 3.
IF sy-subrc <> 0.ENDIF.
l_graphic_size = xstrlen( l_graphic_xstr ).
l_graphic_conv = l_graphic_size.
l_graphic_offs = 0.WHILE l_graphic_conv > 255.
CLEAR la_graphic_table.
la_graphic_table-line = l_graphic_xstr+l_graphic_offs(255).
APPEND la_graphic_table TO lt_graphic_table.
l_graphic_offs = l_graphic_offs + 255.
l_graphic_conv = l_graphic_conv - 255.
ENDWHILE.CLEAR la_graphic_table.
la_graphic_table-line = l_graphic_xstr+l_graphic_offs(l_graphic_conv).
APPEND la_graphic_table TO lt_graphic_table.CALL FUNCTION ‘DP_CREATE_URL’
EXPORTING
type = ‘IMAGE’
subtype = ‘X-UNKNOWN’
size = l_graphic_size
lifetime = ‘T’
TABLES
data = lt_graphic_table
CHANGING
url = l_url
EXCEPTIONS
dp_invalid_parameter = 1
dp_error_put_table = 2
dp_error_general = 3
OTHERS = 4.IF sy-subrc <> 0.
ENDIF.
CALL METHOD pucl_pciture->load_picture_from_url
EXPORTING
url = l_url
EXCEPTIONS
error = 1
OTHERS = 2.IF sy-subrc <> 0.
ENDIF.
CALL METHOD pucl_pciture->set_display_mode
EXPORTING
display_mode = pucl_pciture->display_mode_fit_center
EXCEPTIONS
error = 1
OTHERS = 2.
IF sy-subrc <> 0.ENDIF.
ENDFORM.
&---------------------------------------------------------------------
*& Form CHECK_AUTHORITY
&--------------------------------------------------------------------- -
text
----------------------------------------------------------------------
-
-->P_0011 text
----------------------------------------------------------------------
FORM check_authority USING p_tcode.
CLEAR gv_error.
AUTHORITY-CHECK OBJECT ‘S_TCODE’
ID ‘TCD’ FIELD p_tcode.
IF sy-subrc <> 0.
gv_error = ‘X’.
MESSAGE s011(zmm) WITH ‘您没有:’ && p_tcode && ‘的权限’
DISPLAY LIKE ‘E’.
LEAVE LIST-PROCESSING.
ENDIF.
ENDFORM.