偷懒神器~
TABLES:mara.
DATA:lr_alv_data TYPE REF TO data.
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-000.
SELECT-OPTIONS s_matnr for mara-matnr."物料
SELECTION-SCREEN END OF BLOCK b1.
FIELD-SYMBOLS : <lt_alv_data> TYPE ANY TABLE .
FIELD-SYMBOLS : <lt_data> TYPE any. "LIKE LINE OF it_tab .
cl_salv_bs_runtime_info=>set( EXPORTING display = abap_false
metadata = abap_false
data = abap_true ).
CLEAR lr_alv_data.
UNASSIGN <lt_alv_data>.
SUBMIT ZSDR0003
WITH S_MATNR IN s_matnr
“ WITH mat IN s_matnr "标准报表用参数ID
AND RETURN.
TRY.
cl_salv_bs_runtime_info=>get_data_ref( IMPORTING r_data = lr_alv_data ).
ASSIGN lr_alv_data->* TO <lt_alv_data>.
CATCH cx_salv_bs_sc_runtime_info.
MESSAGE 'Unable to retrieve ALV data! Please try other conditions.' TYPE 'E'.
ENDTRY.
cl_salv_bs_runtime_info=>clear_all( ).
"
IF <lt_alv_data> IS ASSIGNED.
UNASSIGN <lt_data>.
LOOP AT <lt_alv_data> ASSIGNING <lt_data>."即所需要内表数据
ENDLOOP.
ENDIF.