*&---------------------------------------------------------------------* *& Report ZHJ_TEST01 *& *&---------------------------------------------------------------------* *& *& *&---------------------------------------------------------------------* REPORT zhj_test01. tables: cepct,t001,adrc,glpca,ztfi_pc_area,sscrfields,faglflext. data: g_bukrs_name(100) type c, g_budat_name(100) type c, g_query(1) type c. data:g_dynnr like sy-dynnr value '100'. SELECTION-SCREEN BEGIN OF SCREEN 100 AS SUBSCREEN. SELECTION-SCREEN: BEGIN OF BLOCK blk WITH FRAME TITLE text-001. PARAMETERS: p_bukrs LIKE glpca-rbukrs DEFAULT '2101', p_gjahr LIKE glpca-ryear DEFAULT sy-datum(4). SELECT-OPTIONS: s_monat FOR glpca-poper NO-EXTENSION. SELECTION-SCREEN: END OF BLOCK blk. SELECTION-SCREEN END OF SCREEN 100. *SELECTION-SCREEN BEGIN OF SCREEN 200 AS SUBSCREEN. *SELECTION-SCREEN: BEGIN OF BLOCK b2 WITH FRAME TITLE text-001. *PARAMETERS: p_bukrsc LIKE glpca-rbukrs DEFAULT '2101'. *SELECTION-SCREEN: END OF BLOCK b2. *SELECTION-SCREEN END OF SCREEN 200. SELECTION-SCREEN: FUNCTION KEY 1, FUNCTION KEY 2. SELECTION-SCREEN: BEGIN OF TABBED BLOCK sub FOR 15 LINES, END OF BLOCK sub. *AT SELECTION-SCREEN. * PERFORM sub_select_screen. *&---------------------------------------------------------------------* *& VALUE REQUEST : *&---------------------------------------------------------------------* *&---------------------------------------------------------------------* *& INITIALIZATION : *&---------------------------------------------------------------------* INITIALIZATION. sscrfields-functxt_01 = text-002. sscrfields-functxt_02 = text-003. sub-prog = sy-repid. sub-dynnr = g_dynnr. PERFORM sub_initialization. *&---------------------------------------------------------------------* *& START-OF-SELECTION: *&---------------------------------------------------------------------* START-OF-SELECTION. IF g_query EQ 'A'. * PERFORM sub_get_data. * PERFORM sub_data_process. ELSEIF g_query EQ 'B'. * PERFORM sub_maintenace_view. ENDIF. *&---------------------------------------------------------------------* *& Form SUB_SELECT_SCREEN *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* * --> p1 text * <-- p2 text *----------------------------------------------------------------------* form SUB_SELECT_SCREEN . case sy-dynnr. when 100. case sscrfields-ucomm. when 'FC02'. sub-dynnr = 200. when others. * perform sub_sreen_data_check. * perform sub_check_bukrs using p_bukrs. * perform sub_check_authority using p_bukrs. * perform sub_check_config. g_query = 'A'."A endcase. when 200. case sscrfields-ucomm. when 'FC01'. sub-dynnr = 100. when others. * perform sub_screen_check_bukrs. * perform sub_check_bukrs using p_bukrsc. * perform sub_check_authority using p_bukrsc. g_query = 'B'."B endcase. endcase. endform. " SUB_SELECT_SCREEN *&---------------------------------------------------------------------* *& Form SUB_INITIALIZATION *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* * --> p1 text * <-- p2 text *----------------------------------------------------------------------* form SUB_INITIALIZATION . * clear:g_bukrs_name,g_budat_name,gt_area,gt_prctr,gt_data,gt_result, * gt_excel_output,gt_merge. * refresh:gt_area,gt_prctr,gt_data,gt_result,gt_excel_output,gt_fieldcat, * gt_merge. endform. " SUB_INITIALIZATION
上面是用那个方法实现的.
下面是用OO实现的
*&---------------------------------------------------------------------* *& Report ZHJ_TEST02 *& *&---------------------------------------------------------------------* *& *& *&---------------------------------------------------------------------* REPORT ZHJ_TEST02. *&---------------------------------------------------------------------* *& VALUE REQUEST : *&---------------------------------------------------------------------* *&---------------------------------------------------------------------* *& INITIALIZATION : *&---------------------------------------------------------------------* *tables: cepct,t001,adrc,glpca,ztfi_pc_area,sscrfields,faglflext. *REPORT demo_sel_screen_function_key. TABLES sscrfields. SELECTION-SCREEN BEGIN OF SCREEN 1100. PARAMETERS: p_carrid TYPE s_carr_id, p_cityfr TYPE s_from_cit. SELECTION-SCREEN: FUNCTION KEY 1, FUNCTION KEY 2. SELECTION-SCREEN END OF SCREEN 1100. AT SELECTION-SCREEN. CASE sscrfields-ucomm. WHEN'FC01'. p_carrid = 'LH'. p_cityfr = 'Frankfurt'. WHEN 'FC02'. p_carrid = 'UA'. p_cityfr = 'Chicago'. ENDCASE. CLASS start DEFINITION. PUBLIC SECTION. CLASS-METHODS main. ENDCLASS. CLASS start IMPLEMENTATION. METHOD main. sscrfields-functxt_01 = 'LH'. sscrfields-functxt_02 = 'UA'. CALL SELECTION-SCREEN 1100 ."STARTING AT 10 10. ENDMETHOD. ENDCLASS. START-OF-SELECTION. start=>main( ).