第一種方法:
這種方法只到了輸入值的界面,還需要按F8運行,可以查看CALL TRANSACTION 之 USING幫助文檔
"用內表傳參數到SELECT-OPTION參數中
DATA: BDCDATA_WA TYPE BDCDATA, "定義一個系統結構
BDCDATA_TAB TYPE TABLE OF BDCDATA."定義系統內表
DATA OPT TYPE CTU_PARAMS."操作變量內表
CLEAR BDCDATA_WA.
BDCDATA_WA-PROGRAM = 'ZPO_001'."要跳轉的程序名
BDCDATA_WA-DYNPRO = '1000'."屏幕號
BDCDATA_WA-DYNBEGIN = 'X'."動態
APPEND BDCDATA_WA TO BDCDATA_TAB."寫入內表
CLEAR BDCDATA_WA.
BDCDATA_WA-FNAM = 'ZMATNR-LOW'."要跳轉的值輸入框的變量
BDCDATA_WA-FVAL = GS_DISPLAY-IDNRK."輸入框變量的值
APPEND BDCDATA_WA TO BDCDATA_TAB.
CLEAR BDCDATA_WA.
BDCDATA_WA-FNAM = 'ZWERKS-LOW'.
BDCDATA_WA-FVAL = GS_DISPLAY-WERKS.
APPEND BDCDATA_WA TO BDCDATA_TAB.
OPT-DISMODE = 'E'.
OPT-DEFSIZE = ''.
CALL TRANSACTION 'ZPO1' USING BDCDATA_TAB OPTIONS FROM OPT . "這個只到了輸入值得界面,還需要按F8運行
第二種方法:
這種方法是直接進入到結果界面,但是調用是程序名稱,可以查看SUBMIT 之 selscreen_parameters 幫助文檔
"定義select-option傳參的變量
DATA: TEXT TYPE c LENGTH 10,
ls_rspar TYPE rsparams,
lt_rspar TYPE TABLE OF rsparams,
lt_line LIKE RANGE OF text,
ls_line LIKE LINE OF lt_line.
"給LT_RSPAR寫入值,rsparams是系統標準表
CLEAR:LS_RSPAR,LT_RSPAR,LT_LINE,LS_LINE.
LS_RSPAR-SELNAME = 'MATNR'."關聯字段
LS_RSPAR-kind = 'S' ."S 系統標準 P = PARATERMS
ls_rspar-sign = 'I' ."操作符號 I = INCLUDE E=EXCLUDE
ls_rspar-option = 'EQ' ."操作符
LS_RSPAR-LOW = GS_DISPLAY-MATNR.
APPEND LS_RSPAR TO LT_RSPAR.
LS_LINE-SIGN = 'I'.
LS_LINE-OPTION = 'EQ'.
LS_LINE-LOW = GS_DISPLAY-WERKS.
APPEND LS_LINE TO LT_LINE.
SUBMIT RM07DOCS USING SELECTION-SCREEN '1000' WITH SELECTION-TABLE LT_RSPAR
WITH WERKS IN LT_LINE AND RETURN.
這個selname必須是屏幕中的FIELD-NAME中的字段參數,如圖: