某个需求中间调用了标准的程序。
带选择屏幕。
写了个测试程序,玩儿的。
首先写了一个取数report:
然后写了个调用的report
测试结果:
spfli 表数据:
我两个report的,选择屏幕 字段顺序不一样,这个没关系,即使只有部分,也没问题。
RADIOBUTTON、CHECKBOX、SELECT-OPTIONS、PARAMETERS 都行。
代码如下;
取数程序代码:
REPORT zlm_get_spfli.
TABLES spfli.
PARAMETERS :p_carrid TYPE spfli-carrid.
PARAMETERS pc_max AS CHECKBOX DEFAULT ''.
PARAMETERS rd_test1 RADIOBUTTON GROUP g1 DEFAULT 'X'.
PARAMETERS rd_test2 RADIOBUTTON GROUP g1.
SELECT-OPTIONS:s_connid FOR spfli-connid.
DATA: lt_spfli TYPE TABLE OF spfli.
START-OF-SELECTION.
IF pc_max IS NOT INITIAL.
SELECT * FROM spfli INTO TABLE lt_spfli UP TO 2 ROWS
where carrid = p_carrid
and connid in s_connid.
ELSE.
SELECT * FROM spfli INTO TABLE lt_spfli
WHERE carrid = p_carrid
AND connid IN s_connid.
ENDIF.
IF rd_test1 IS INITIAL.
WRITE : 'rd_test1'.
ELSE.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_structure_name = 'SPFLI'
TABLES
t_outtab = lt_spfli
EXCEPTIONS
program_error = 1
OTHERS = 2.
IF sy-subrc <> 0.
* Implement suitable error handling here
ENDIF.
ENDIF.
调用程序
REPORT ztest_submit.
TABLES spfli.
PARAMETERS :p_carrid TYPE spfli-carrid.
SELECT-OPTIONS:s_connid FOR spfli-connid.
PARAMETERS pc_max AS CHECKBOX DEFAULT ''.
PARAMETERS rd_test1 RADIOBUTTON GROUP g1 DEFAULT 'X'.
PARAMETERS rd_test2 RADIOBUTTON GROUP g1.
DATA t_rsparams TYPE TABLE OF rsparams.
CALL FUNCTION 'RS_REFRESH_FROM_SELECTOPTIONS'
EXPORTING
curr_report = sy-repid
*IMPORTING
* SP =
TABLES
selection_table = t_rsparams
EXCEPTIONS
not_found = 1
no_report = 2
OTHERS = 3.
SUBMIT zlm_get_spfli WITH SELECTION-TABLE t_rsparams
AND RETURN.