Skip to Content
author's profile photo Former Member
Former Member

How to prevent the use of wild cards in select-option

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

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

5 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Oct 09, 2007 at 02:27 PM

    Hi,

    You can use like below :

    SELECT-OPTIONS: o_comp  FOR dbtab-field OBLIGATORY DEFAULT 'FI'.
    
    at selection-screen.
    
    if o_comp-low CP '*' or o_comp-high CP '*'.
    
    message 'Should not input wild cards' type 'E'.
    
    Endif.

    Thanks,

    Sriram Ponna.

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Hi

      The solution you had used was given by me 😊 and also the points were awarded to me and not sriram as mentioned.

      LEAVE SCREEN is not required as I have given an error message and not Information messgae. So, the program will never go to Start-of-selection.

      Regards

      Navneet

  • author's profile photo Former Member
    Former Member
    Posted on Oct 09, 2007 at 02:04 PM

    Hi,

    U can give Conditions for not giving Wildcard Characters.

    For Eg,

    IF o_comp co '*'.

    MESSAGE 'U should not Use Wildcard Characters for Input' TYPE 'I'.

    else.

    Select ....

    endif.

    Regards,

    Padmam.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Oct 09, 2007 at 02:12 PM

    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
    10|10000 characters needed characters exceeded

    • Former Member

      Hi Raymond,

      could you please explain what comes here:

      * 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

      and how I could implement this in my case.

      Thank you

      Nadin

  • author's profile photo Former Member
    Former Member
    Posted on Oct 09, 2007 at 02:15 PM

    Try this: -

    AT SELECTION-SCREEN on o_comp.

    if o_comp-low ca '' or o_comp-high ca ''.

    message i000 with 'No * please!'.

    endif.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Oct 09, 2007 at 02:22 PM

    hi

    good

    you cant give a default value for the select-options as you have given here,you must have to give the default value within the single cotes.

    thanks

    mrutyun^

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.