*&---------------------------------------------------------------------*
*& Report ZHJ_TEST01
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------* REPORT zhj_test01.
tables: cepct,t001,adrc,glpca,ztfi_pc_area,sscrfields,faglflext. data: g_bukrs_name() type c,
g_budat_name() type c,
g_query() type c.
data:g_dynnr like sy-dynnr value ''. SELECTION-SCREEN BEGIN OF SCREEN AS SUBSCREEN.
SELECTION-SCREEN: BEGIN OF BLOCK blk WITH FRAME TITLE text-.
PARAMETERS: p_bukrs LIKE glpca-rbukrs DEFAULT '',
p_gjahr LIKE glpca-ryear DEFAULT sy-datum().
SELECT-OPTIONS: s_monat FOR glpca-poper NO-EXTENSION.
SELECTION-SCREEN: END OF BLOCK blk.
SELECTION-SCREEN END OF SCREEN . *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 ,
FUNCTION KEY .
SELECTION-SCREEN: BEGIN OF TABBED BLOCK sub FOR LINES,
END OF BLOCK sub. *AT SELECTION-SCREEN.
* PERFORM sub_select_screen. *&---------------------------------------------------------------------*
*& VALUE REQUEST :
*&---------------------------------------------------------------------* *&---------------------------------------------------------------------*
*& INITIALIZATION :
*&---------------------------------------------------------------------*
INITIALIZATION.
sscrfields-functxt_01 = text-.
sscrfields-functxt_02 = text-.
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 .
case sscrfields-ucomm.
when 'FC02'.
sub-dynnr = .
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 .
case sscrfields-ucomm.
when 'FC01'.
sub-dynnr = .
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 .
PARAMETERS: p_carrid TYPE s_carr_id,
p_cityfr TYPE s_from_cit.
SELECTION-SCREEN: FUNCTION KEY ,
FUNCTION KEY .
SELECTION-SCREEN END OF SCREEN . 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 ."STARTING AT 10 10. ENDMETHOD.
ENDCLASS. START-OF-SELECTION.
start=>main( ).