Hello experts,
Is it possible to prevent the use of wild cards in a select-option? If yes, how is it done please?
I have a
SELECT-OPTIONS: o_comp FOR dbtab-field OBLIGATORY DEFAULT 'FI'.
and, I want to prevent the users for giving in some thing like FI* with the wildcard bc it would lead to dump.
I want an error message to display and prevent the users for making such entry.
Please I need your help and I would be very grateful.
Thanks
Nadin
You have to use SELECT_OPTIONS_RESTRICT to restrict input allowed. Call this FM in INITIALIZATION or SELECTION-SCREEN OUPUT sections.
Sample :
TYPE-POOLS: sscr. INITIALIZATION. * Restrict SELECT-OPTIONS PERFORM restrict_select. * (...) FORM restrict_select. DATA: restrict TYPE sscr_restrict, opt_list TYPE sscr_opt_list, ass TYPE sscr_ass. * Défine select-options modes (aka option list) * - ALL standard - all options allowed CLEAR opt_list. MOVE 'ALL' TO opt_list-name. MOVE 'X' TO: opt_list-options-bt, opt_list-options-cp, opt_list-options-eq, opt_list-options-ge, opt_list-options-gt, opt_list-options-le, opt_list-options-lt, opt_list-options-nb, opt_list-options-ne, opt_list-options-np. APPEND opt_list TO restrict-opt_list_tab. * - EQU only equality allowed (list of values) CLEAR opt_list. MOVE 'EQU' TO opt_list-name. MOVE 'X' TO opt_list-options-eq. APPEND opt_list TO restrict-opt_list_tab. * Affect modes to parameters or block of parameters * ALL by default CLEAR ass. MOVE: 'A' TO ass-kind, '*' TO ass-sg_main, 'ALL' TO ass-op_main. APPEND ass TO restrict-ass_tab. * EQU to internal material number CLEAR ass. MOVE: 'S' TO ass-kind, 'S-MATNR' TO ass-name, 'I' TO ass-sg_main, " no exclusion 'EQU' TO ass-op_main. " only value list APPEND ass TO restrict-ass_tab. * Call FM CALL FUNCTION 'SELECT_OPTIONS_RESTRICT' EXPORTING restriction = restrict EXCEPTIONS OTHERS = 1. ENDFORM. " restrict_select
In the sample, only select-options for matnr is restricted to single value list.
For your request build a mode with all options except "pattern" ones : CP and NP.
Regards
Add a comment