CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = g_repid
i_callback_user_command = 'USER_CALLBACK'
I_STRUCTURE_NAME = 'T_OUTPUT'
I_GRID_TITLE = 'Document List'
is_layout = gs_layout
is_variant = g_variant
I_DEFAULT = 'X'
I_SAVE = 'A'
it_fieldcat = gt_fieldcat[]
it_sort = gt_sort[]
it_events = gt_events[]
TABLES
T_OUTTAB = IT_OUTPUT
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2.
ENDFORM. "DISPLAY_DATA
FORM USER_CALLBACK USING rf_ucomm TYPE sy-ucomm
rs_selfield TYPE slis_selfield.
CASE rf_ucomm.
WHEN '&IC1'.
READ TABLE IT_OUTPUT INDEX rs_selfield-tabindex ASSIGNING <FS_OUTPUT>.
IF SY-SUBRC = 0.
SET PARAMETER ID: 'BLN' FIELD <FS_OUTPUT>-BELNR. "PARAMETER ID通过F1->technical information->Parameter id可以获得
SET PARAMETER ID: 'BUK' FIELD <FS_OUTPUT>-BUKRS.
SET PARAMETER ID: 'GJR' FIELD <FS_OUTPUT>-GJAHR.
CALL TRANSACTION 'FB03' AND SKIP FIRST SCREEN ."SKIP FIRST SCREEN 忽略selection screen
ENDIF.
ENDCASE.
ENDFORM. "USER_CALLBACK
EXPORTING
I_CALLBACK_PROGRAM = g_repid
i_callback_user_command = 'USER_CALLBACK'
I_STRUCTURE_NAME = 'T_OUTPUT'
I_GRID_TITLE = 'Document List'
is_layout = gs_layout
is_variant = g_variant
I_DEFAULT = 'X'
I_SAVE = 'A'
it_fieldcat = gt_fieldcat[]
it_sort = gt_sort[]
it_events = gt_events[]
TABLES
T_OUTTAB = IT_OUTPUT
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2.
ENDFORM. "DISPLAY_DATA
FORM USER_CALLBACK USING rf_ucomm TYPE sy-ucomm
rs_selfield TYPE slis_selfield.
CASE rf_ucomm.
WHEN '&IC1'.
READ TABLE IT_OUTPUT INDEX rs_selfield-tabindex ASSIGNING <FS_OUTPUT>.
IF SY-SUBRC = 0.
SET PARAMETER ID: 'BLN' FIELD <FS_OUTPUT>-BELNR. "PARAMETER ID通过F1->technical information->Parameter id可以获得
SET PARAMETER ID: 'BUK' FIELD <FS_OUTPUT>-BUKRS.
SET PARAMETER ID: 'GJR' FIELD <FS_OUTPUT>-GJAHR.
CALL TRANSACTION 'FB03' AND SKIP FIRST SCREEN ."SKIP FIRST SCREEN 忽略selection screen
ENDIF.
ENDCASE.
ENDFORM. "USER_CALLBACK