创建屏幕0100(元素清单中含定制控制CONTAINER和OK_CODE)
创建GUI状态100(功能键含BACK和EXIT用于返回和退出 )
代码
*&---------------------------------------------------------------------* *& Report ZQBTEST_10 *& *&---------------------------------------------------------------------* *& *& *&---------------------------------------------------------------------* REPORT zqbtest_10. DATA: gfw_prestype_lines TYPE i VALUE ."17 / 1 / 27 DATA: ok_code TYPE sy-ucomm, first_call TYPE i, values TYPE TABLE OF gprval WITH HEADER LINE, column_texts TYPE TABLE OF gprtxt WITH HEADER LINE. SELECTION-SCREEN BEGIN OF BLOCK bk1. PARAMETERS: p_c TYPE c AS CHECKBOX DEFAULT 'X', p_v TYPE i DEFAULT '. SELECTION-SCREEN END OF BLOCK bk1. IF p_c = 'X'. MOVE p_v TO gfw_prestype_lines. CALL SCREEN '. ELSE. PERFORM frm_graph_2d. ENDIF. *&---------------------------------------------------------------------* *& Form frm_GFW_PRES_SHOW *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* FORM frm_gfw_pres_show. SET PF-STATUS '. REFRESH values. REFRESH column_texts. values-rowtxt = . values-val2 = . values-val3 = . values-val4 = . APPEND values. values-rowtxt = . values-val2 = . values-val3 = .values-val4 = . APPEND values. values-rowtxt = . values-val2 = . values-val3 = .values-val4 = . APPEND values. values-rowtxt = . values-val2 = . values-val3 = . values-val4 = . APPEND values. column_texts-coltxt = 'name'. APPEND column_texts. column_texts-coltxt = 'ages'. APPEND column_texts. column_texts-coltxt = 'city'. APPEND column_texts. column_texts-coltxt = 'four'. APPEND column_texts. CALL FUNCTION 'GFW_PRES_SHOW' EXPORTING container = 'CONTAINER' top = left = height = '' width = '' presentation_type = gfw_prestype_lines header = 'title of graphic' orientation = gfw_orient_rows * PARENT = x_axis_title = 'title for x axis' y_axis_title = 'title for y axis' format = * IMPORTING * RETVAL = * CONTENT_TYPE = * CONTENT_LENGTH = TABLES values = values column_texts = column_texts * ROW_LABELS = * COLUMN_LABELS = * CONTENT = EXCEPTIONS error_occurred = OTHERS = . IF sy-subrc <> . * Implement suitable error handling here ENDIF. ENDFORM. "frm_GFW_PRES_SHOW *&---------------------------------------------------------------------* *& Form frm_GRAPH_2D *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* FORM frm_graph_2d. TYPES : BEGIN OF typ_data, text(), value TYPE p, END OF typ_data. DATA: tab_data TYPE STANDARD TABLE OF typ_data WITH HEADER LINE. REFRESH tab_data. CLEAR tab_data. tab_data-text = '. tab_data-value = '. APPEND tab_data. CLEAR tab_data. tab_data-text = '. tab_data-value = '. APPEND tab_data. CLEAR tab_data. tab_data-text = '. tab_data-value = '. APPEND tab_data. CALL FUNCTION 'GRAPH_2D' EXPORTING * AUTO_CMD_1 = ' ' * AUTO_CMD_2 = ' ' * TYPE = ' ' display_type = 'PI'"// VB, PI, TP, HB * INBUF = ' ' * INFORM = ' ' * MAIL_ALLOW = ' ' * PWDID = ' ' * SET_FOCUS = 'x' * SMFONT = ' ' * SO_CONTENTS = ' ' * SO_RECEIVER = ' ' * SO_SEND = ' ' * SO_TITLE = ' ' * STAT = ' ' * SUPER = ' ' * TIMER = ' ' titl = '2D图练习' * VALT = ' ' * WDID = ' ' * WINID = ' ' * WINPOS = ' ' * WINSZX = ' * WINSZY = ' * X_OPT = ' ' * NOTIFY = ' ' * IMPORTING * B_KEY = * B_TYP = * CUA_ID = * MOD_COL = * MOD_ROW = * MOD_VAL = * M_TYP = * RBUFF = * RWNID = TABLES data = tab_data * EXCEPTIONS * GUI_REFUSE_GRAPHIC = * OTHERS = . IF sy-subrc <> . * Implement suitable error handling here ENDIF. ENDFORM. "frm_GRAPH_2D *&---------------------------------------------------------------------* *& Module USER_COMMAND_0100 INPUT *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* MODULE user_command_0100 INPUT. CASE ok_code. WHEN 'EXIT' OR 'BACK'. LEAVE TO SCREEN . ENDCASE. ENDMODULE. " USER_COMMAND_0100 INPUT *&---------------------------------------------------------------------* *& Module STATUS_0100 OUTPUT *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* MODULE status_0100 OUTPUT. * SET PF-STATUS 'xxxxxxxx'. * SET TITLEBAR 'xxx'. PERFORM frm_gfw_pres_show. ENDMODULE. " STATUS_0100 OUTPUT
效果展示
效果一
效果二