検索オプション関連
このトピックでは、検索オプション関連のプログラミングを取り上げて説明します。
SELECTION-OPTIONSの入力制限
* Include type pool SSCR TYPE-POOLS sscr. TABLES: BKPF. * Selection-screen select-options : s_bukrs for bkpf-bukrs, "会社コード s_belnr for bkpf-belnr. "伝票番号 * Variables for populating restriction data DATA: gd_restrict TYPE sscr_restrict. "structure containing 2 tables DATA: gd_optlist TYPE sscr_opt_list, "header line for table 1 gd_ass TYPE sscr_ass. "header line for table 2 ************************************************************************ *INITIALIZATION. INITIALIZATION. * Restrict s_bukrs to only except EQ. gd_optlist-name = 'KEY1'. "Can be anything gd_optlist-options-eq = 'X'. APPEND gd_optlist TO gd_restrict-opt_list_tab. clear: gd_optlist. gd_ass-kind = 'S'. gd_ass-name = 'S_BUKRS'. gd_ass-sg_main = 'I'. gd_ass-sg_addy = SPACE. gd_ass-op_main = 'KEY1'. "Must be same as above APPEND gd_ass TO gd_restrict-ass_tab. clear: gd_ass. * Restrict s_belnr to only except EQ,CP,GE, LT,BT. gd_optlist-name = 'KEY2'. "Can be anything gd_optlist-options-eq = 'X'. gd_optlist-options-cp = 'X'. gd_optlist-options-ge = 'X'. gd_optlist-options-lt = 'X'. gd_optlist-options-bt = 'X'. APPEND gd_optlist TO gd_restrict-opt_list_tab. clear: gd_optlist. gd_ass-kind = 'S'. gd_ass-name = 'S_BELNR'. gd_ass-sg_main = 'I'. gd_ass-sg_addy = SPACE. gd_ass-op_main = 'KEY2'. "Must be same as above APPEND gd_ass TO gd_restrict-ass_tab. clear: gd_ass. CALL FUNCTION 'SELECT_OPTIONS_RESTRICT' EXPORTING * PROGRAM = restriction = gd_restrict * DB = ' ' EXCEPTIONS TOO_LATE = 1 REPEATED = 2 SELOPT_WITHOUT_OPTIONS = 3 SELOPT_WITHOUT_SIGNS = 4 INVALID_SIGN = 5 EMPTY_OPTION_LIST = 6 INVALID_KIND = 7 REPEATED_KIND_A = 8 OTHERS = 9. IF sy-subrc <> 0. MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4. ENDIF.