创建屏幕0100(元素清单中含定制控制CONTAINER和OK_CODE)
创建GUI状态100(功能键含BACK和EXIT用于返回和退出 )
代码
*&---------------------------------------------------------------------* *& Report ZQBTEST_10 *& *&---------------------------------------------------------------------* *& *& *&---------------------------------------------------------------------* REPORT zqbtest_10. DATA: gfw_prestype_lines TYPE i VALUE 27."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 '27'. SELECTION-SCREEN END OF BLOCK bk1. IF p_c = 'X'. MOVE p_v TO gfw_prestype_lines. CALL SCREEN '100'. ELSE. PERFORM frm_graph_2d. ENDIF. *&---------------------------------------------------------------------* *& Form frm_GFW_PRES_SHOW *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* FORM frm_gfw_pres_show. SET PF-STATUS '100'. REFRESH values. REFRESH column_texts. values-rowtxt = 'Chinese'. values-val1 = 3. values-val2 = 5. values-val3 = 7. values-val4 = 1. APPEND values. values-rowtxt = 'American'. values-val1 = 2. values-val2 = 7. values-val3 = 12.values-val4 = 2. APPEND values. values-rowtxt = 'Germany'. values-val1 = 1. values-val2 = 7. values-val3 = 4.values-val4 = 3. APPEND values. values-rowtxt = 'England'. values-val1 = 1. values-val2 = 6. values-val3 = 3. values-val4 = 4. 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 = 1 left = 1 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 = 10 * IMPORTING * RETVAL = * CONTENT_TYPE = * CONTENT_LENGTH = TABLES values = values column_texts = column_texts * ROW_LABELS = * COLUMN_LABELS = * CONTENT = EXCEPTIONS error_occurred = 1 OTHERS = 2 . IF sy-subrc <> 0. * 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(25), 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 = '2015'. tab_data-value = '1000'. APPEND tab_data. CLEAR tab_data. tab_data-text = '2016'. tab_data-value = '2000'. APPEND tab_data. CLEAR tab_data. tab_data-text = '2017'. tab_data-value = '3000'. 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 = '50' * WINSZY = '50' * 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 = 1 * OTHERS = 2 . IF sy-subrc <> 0. * 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 0. 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
效果展示
效果一
效果二