Validating select-options entries

hi
i need to check whether all entries in SELECT-OPTIONS range are valid or not.
*my select-options field is s-pernr as below.
SELECT-OPTIONS: s_pernr  FOR pernr-pernr.
*all valid entries from PA0000 table will be selected into pernr_table.
SELECT DISTINCT pernr
        FROM pa0000
        INTO TABLE pernr_table
        WHERE pernr IN s_pernr.
now i have to check all invalid pernr's in s_pernr.
s_pernr contains: 1, 5, 6, 7, 8, 9, 10.
PA0000 contains: 1, 2, 5, 8, 10, 11, 13, 15...
then pernr_table = 1, 5, 8, 10 only.
that means pernr 6, 7, 9 in s_pernr were invalid.
How to fetch these values  as s_pernr is SELECT-OPTIONS field and it may have any combination of values.

Hi,
  As far as what i get from your question is, user put multiple values in the LOW field of the select-option and you have to
check all the values entered in the select-option-LOW field.
  If this is the case, you can loop at select-option as show :-
1) create an internal table of type
BEGIN OF ty_pernr ,
   sign(1)   TYPE c,
   option(2) TYPE c,
   low       TYPE pa0000-pernr,
   high      TYPE pa0000-pernr,
END   OF ty_pernr.
2) create workarea of type ty_pernr.
data wa_pernr type ty_pernr.
3) loop at the select-option.
loop at s_pernr into wa_pernr.
    SELECT single pernr
   FROM pa0000
    INTO TABLE pernr_table
    WHERE pernr eq wa_pernr-low.
  if sy-subrc ne 0.
     "give error message.
  endif.
endloop.
Hope this solves ur problem.
Regards,
Bhavesh.

Similar Messages

  • Validation of select-options in WEb DynPro ABAP

    Can anyone please help me on validating select-options. I want to have a functionality like what we use in normal text field while validating the field. We generally use the REPORT_ATTRIBUTE_ERROR_MESSAGE funciton.
    How can we achieve the same thing with select-options, cuz the select-options are not bound with any attribute.
    Edited by: Tirth Pandya on May 7, 2009 2:02 AM

    Hi,
    Refer to this link..Re: validate select option fields

  • Any standard FM to print select-options criteria on a basic report?

    Hi Experts,
    Am trying to print the user entered selection criteria on a classical/basic report. I wrote the code for select-options entries, but, am looking for any standard function module (if i pass my_select_options table, I need to get printable/readable entires) to print on my basic report, pls. let me know (I tried in SE37, but i got an in-active FM - PRINT_SELECTOPTIONS!!)
    Thank you

    Hello,
    CALL FUNCTION 'PRINT_SELECTIONS'
        EXPORTING
          rname     = program name
          rvariante = sy-slset "It will catch the selected variant
          mode      = 'TABLE'
        TABLES
          infotab   = li_info.
    li_info table will contain all selection screen data, you will can restrict what needs to be shown on spool list!
    Thanks.

  • Validation for Select-Option - Issue

    Hi Experts!!
    I have a select-option s_field on which I have written a validation under AT SELECTION-SCREEN. Now, the problem is that, if validation fails in second line of s_field, then to change it when we click on Extension, it's not allowing to enter but is throwing error message again and again as AT SELECTION-SCREEN is called.
    Suppose, I have entered 2 single values as C001 and F001. s_field will have 2 entries. Now, C001 is a valid value but F001 is not. PFB my code:
    LOOP AT s_field.
    SELECT SINGLE *
      FROM ztable INTO ls_field
      WHERE field EQ s_field-low.
    IF sy-subrc NE 0.
    " Error Message
    ENDIF.
    ENDLOOP.
    Now, for C001, sy-subrc will be 0. But for F001 sy-subrc is 4 and hence will throw an error. Now, to correct this, I am trying to enter into extension, but as this will be called again, I am unable to. Hope I explained it clearly.
    I do not see any possibility to correct this. Can anybody please suggest if any workaround can be implemented?
    Your help is highly appreciable.

    Hi,
    You can try the following:
    AT SELECTION-SCREEN on s_field.
    LOOP AT s_field.
    SELECT SINGLE *
      FROM ztable INTO ls_field
      WHERE field EQ s_field-low.
    IF sy-subrc NE 0.
    MESSAGE s398(00) DISPLAY LIKE 'E' with 'ERROR MESSAGE'.
    ENDIF.
    ENDLOOP.
    I hope this works as per your requirement.
    <<point-begging removed>>
    Edited by: micky prasad on Jan 6, 2012 1:00 PM
    Edited by: kishan P on Jan 9, 2012 1:40 PM

  • Select option for selection valid and invalid data.

    Hi All,
    Any one pleas help in validating following case :-
    In the selection screen there is a select option for equipment number like EQUI-EQUNR
    if any user will give wrong equipment no. It will generate an error message from the  range of equipment no.
    and put it to an internal table it error.
    and if any value in between the select option(equipment no) is correct then that value I need to proceed for some other logic.
    Iu2019d appreciate if some one help me in generation code for the above case or logic.
    Thanks

    Hi,
    Use FM 'RS_REFRESH_FROM_SELECTOPTIONS'
    DATA: RSPAR TYPE STANDARD TABLE OF RSPARAMS.
          REFRESH RSPAR.
          CALL FUNCTION 'RS_REFRESH_FROM_SELECTOPTIONS'
              EXPORTING
                CURR_REPORT           = 'prog name'
        IMPORTING
          SP                    =
              TABLES
                SELECTION_TABLE       = RSPAR
             EXCEPTIONS
               NOT_FOUND             = 1
               NO_REPORT             = 2
               OTHERS                = 3.
          IF SY-SUBRC <> 0.
       MESSAGE I000.
          ENDIF.
    In table parameter you ll get the all entries entered .
    Check out the values with respective tables.If value is not correct tk it into internal table
    else proceed ahead. You can Remove incorrect entries this way.
    regards,
    ajit.

  • Select-option validation

    Hi,
    Can any body tell me the best option for validating the select-option field in selection  screen.
    suppose i have a select option s_lifnr on selection screen.how i can validate that vendor.we have to validate the range or we have to check for at least single  value..is valid..what is the best possible solution?
    Thanks.

    the best solution is to check if a single value is fetched from the db
    at selection screen on so_lifnr
    select single * from lfa1
    where lifnr in so_lifnr.
    if sy-subrc NE 0.
    Message 'Invalid vendor' type 'E'.
    endif.
    The reason is simple imagine you give a range of 1 to 10 in so_lifnr, then there might be vendors only for 1, 3, 5 ,7. You dont want to give an error message in this case if there is no vendor 2,4, etc...
    Also imagine that there are 10000 vendors and the range now has 1 to 10000, imagine the performance if you are to validate each value in the select option.
    Last but not the leaset the user has a free option to use patterns (astericks ), signs ( E or I ) , options (  EQ, NE, GE, LE, GT, LT,BT etc ) in select options. So user may enters ABC  and 'I in the sign. It would then be hard to code to find exactly all the possible entries the user wants, unless they are selected from db.
    So as you can see there are a lot of possible inputs for a select option, the best approach is to validate a single value from database.
    regards,
    Advait

  • Multiple select options validation at selection screen

    Hi,
    I have the requirement to create a selection screen with 3 select options. Two of them are cross-dependent. It is mandatory to fill one of them and it is not allowed to fill both. The third one is optional. I tried the validation at selection-screen on block... and I have a problem that search help buttons for select options react like execution buttons, when I press any of them I am getting one of errors instead of search help.
    Any help on this issue would be appreciated.
    Here is my code:
    DATA:
          so_rbkp TYPE rbkp,
          so_mseg TYPE mseg.
    SELECTION-SCREEN BEGIN OF BLOCK blok WITH FRAME.
      SELECT-OPTIONS:
            s_fakt   FOR so_rbkp-belnr,
            s_matdok FOR so_mseg-mblnr,
            s_god FOR so_mseg-gjahr.
    SELECTION-SCREEN END OF BLOCK blok.
    INITIALIZATION.
    SET TITLEBAR '0100'.
    START-OF-SELECTION.
      AT SELECTION-SCREEN on block blok.
          if s_fakt <> space and s_matdok <> space.
            MESSAGE 'Message1' TYPE 'E'.
          elseif s_fakt = space and s_matdok = space.
            MESSAGE 'Message2' TYPE 'E'.
          endif.
        ENDIF.

    Only perform the check when user wants to execute or submit the program, not when pressing F4 or even Enter, but in a selection-screen event, before START-OF-SELECTION which were program would terminate in error :
    TABLES: SSCRFIELDS.
    AT SELECTION-SCREEN OB BLOCK b01.
        IF sscrfields-ucomm EQ 'ONLI'
        OR sscrfields-ucomm EQ 'PRIN'
        OR sscrfields-ucomm EQ 'SJOB'.
          IF s_fakt[] IS NOT INITIAL AND s_matdok IS NOT INITIAL.
            MESSAGE 'Message1' TYPE 'E'.
          ELSEIF s_fakt[] IS INITIAL and s_matdok[] IS INITIAL.
            MESSAGE 'Message2' TYPE 'E'.
          ENDIF.
        ENDIF.
    (You could also always send the message, but using type 'E' for those function code and 'S' status for any other value.)
    Regards,
    Raymond

  • Event should trigger when enter is pressed on select option for validation

    Hi,
    I want to trigger a event when enter is pressed on a select option field for validation.
    I have created a select option through coding. I am not able to find out any method or class for that.
    please advice.

    Hi Sachin ,
         If you want ot use the methods in the class CL_WDR_SELECT_OPTIONS.
    You can find here:-
    [WDR_SELECT_IPTIONS|https://cw.sdn.sap.com/cw/docs/DOC-20864.pdf]
    Check these if can find ur required one.
    If you are using any ui element then you can use ON_ENTER event as a action as stated by Baskaran.
    Check also if these threads can help you:-
    [WebDynpro ABAP select options method SET_VALUE_OF_PARAMETER_FIELD;
    [http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/60474842-91ca-2b10-3390-d2fd30f335fd]
    Thanks & Regards,
    Monishankar Chatterjee

  • Selection option for variable entry in BEx in 2004s

    Hi All,
    Have any of you noticed that the selection option functionality for variable entry  while creating a variable does not allow wild card entry,Even though you create the variable with selection option as input.
    In 3.5 we had option the option "contains the pattern " but in 2004s its not available in the variable entry screen.

    Hello Guys,
    When I posted this thread we were upgrading to SP11, now I am in the middle of another upgrade (SP15) and I still notice that wild card option is yet to be made available for a variable of type selection option.
    Back then I had sent a message to SAP and was told that the functionality would be rolled out in new SP's. I am very curious as too how others are handling this problem, as they are bound to be reports for which such variables are a must.
    P.S - The option has been made available
    Edited by: Karthik on Jul 22, 2008 6:52 PM

  • Validation of SELECT-OPTIONS in selection screen

    Hi Experts,
    I need to validate the user entered values in the selection screen, specifically in SELECT-OPTIONS. So, currently am doing by checking S_VBELN-LOW and S_VBELN-HIGH.
    BUt, curious that Is there any standard SAP Function module to use for this purpose? I searched in SE37 by giving OPTIONS but did not find any!!
    Thank you

    Hi,
    Instead of searching  for the function module .. use the event at selection-screen on or  at selection-screen  and write your validation logic only if there  no value table for the particular field..
    Thanks
    Krishna

  • Is there any restriction on no of entries in Select-option-low ?

    Is there any restriction on no of entries in Select-option-low ? I have a select option which has 22 thousand entries and the select query is thrwoing a dump.
    Any inputs ?
    Regards,
    Ankur Bhandari

    Hi Ankur,
    1. i had faced same problem.
    2. Virtually the limit in SELECT-OPTION low
       is not the problem.
    3. The problem is with SQL query and database limit.
    4. The R/3 system generates final database query
       in the form of (for select option)
       FIELD IN ('ABC','DEF','XYZ',........'')
    5. Now Oracle/SqlServer
       has limit of THESE IN VALUES.
       limit is something in 2500 approx.
    6. So your approach will not work
      using IN.
       It will always give error when
       entries are more.
    7. SOLUTION which i did.
       1. First select all appropriate records from
          master table in your itab
         (without using IN select option clause)
      2. After that use this concept.
         Loop at ITAB.
         If Itab-Field in SelectOption.
         Else.
         DELETE ITAB.
         ENDIF.
    The above will take care for any number of records. 
    I hope it helps.
    regards,
    amit m.
    Message was edited by: Amit Mittal
    Message was edited by: Amit Mittal

  • How many entries can we put in the select options

    Hi all,
    As per  my requirement I am trying to store the data in the select-option( s_kunnt)  as below
    select kunnr from kna1 into (l_kunnr) where
                and spart in p_spart.
      move 'I'         to s_kunnr-sign.
      move 'BT'        to s_kunnr-option.
      move l_kunnr to s_kunnr-low.
      move l_kunnr  to s_kunnr-high.
      append s_kunnr.
    endselect.
    Using s_kunnr in the select statement to fetch the data.
    When the customer numbers are more than 1800 in the s_kunnr, select statment going to the dump. Is number of entries in the select options are restricted for some count( around 1800)?.
    How many entries can we put in the select options?
    Thanks
    Regards
    Raj.

    Firstly, there is an error in your code. You should do the following instead:
    move 'I' to s_kunnr-sign.
    move 'EQ' to s_kunnr-option.
    move l_kunnr to s_kunnr-low.
    append s_kunnr.
    To answer your original question, the limit depends on the field width you are using in the ranges. If the field width is small, you can have thousands of entries in the range table.
    The limitation is in the length of the SQL statement string generated by the ABAP OPEN SQL engine. With the way I defined it above, the statement would have WHERE KUNNR IN ( 'value1', 'value2', 'value3'). With way you defined it, it would have WHERE KUNNR BETWEEN 'value1' and 'value1' and KUNNR BETWEEN 'value2' and 'value2'.
    When the range table is so large that it results in a short dump, you should look into FOR ALL ENTRIES option of SQL.

  • How to do validations for select-options

    Hi gurus,
    can you suggest me
    how to do validations for select-options
    Thanks&ragards,
    Kals.

    HI,
    TABLES: BKPF.
    TYPES: BEGIN OF TY_BKPF,
           BUKRS TYPE BUKRS,   "COMPANY CODE
           GJAHR TYPE GJAHR,   "FISCAL YEAR
           MONAT TYPE MONAT,   "FISCAL PERIOD
    DATA: T_BKPF TYPE TABLE OF TY_BKPF,
          W_BKPF TYPE TY_BKPF.
    SELECTION-SCREEN : BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
    SELECT-OPTIONS: S_CODE   FOR BKPF-BUKRS,
                    S_YEAR   FOR BKPF-GJAHR,
                    S_PERIOD FOR BKPF-MONAT.
    SELECTION-SCREEN: END OF BLOCK B1.
                        AT SELECTION-SCREEN                           *
    IF S_CODE IS INITIAL OR S_YEAR IS INITIAL OR S_PERIOD IS INITIAL.
      MESSAGE E000(0) WITH 'ENTER VLAUES'.
    ENDIF.
    SELECT SINGLE * FROM BKPF WHERE BUKRS IN S_CODE.
      IF SY-SUBRC <> 0.
      MESSAGE E000(0) WITH 'ENTER VALID VALUES'.
      ENDIF.
    reward if useful
    thanks and regards

  • Restrict number of entries in Select-Options

    Hi,
    I would like to restrict the number entries in select options. Lets say I have select options field defined for GL and I want only 10 GLs to be entered on Select-Options. If more than 10 Gls then it should give message that GL count is exceeding its Limit.
    Please may I know how I can do this ?
    Thanks for you help.

    Try this if you want to restrict rows in s_matnr for example.
    At selection screen.
    data: line type i.
    describe table s_matnr lines line.
    if line > 10.
       Message 'Error' Type 'E'.
    endif.
    or else if you want only 10 Materials to be selected then try this.
    At selection-screen.
    if s_matnr-high - s_matnr-low > 10.
        Message 'Error' type 'E'.
    endif.
    Regards,
    Vamsi

  • Select-options restrict possible entries

    Hi
    I use select options like in this example
    select-options: so_matnr for mara-matnr.
    In my report,when running, if pressing f4 for possible entries i only want to have material 123 and 234 for example,and not the whole list of materials.How can i restrict this possible entries to only my desired materials.
    thanks

    Hi Seba,
    1. Demo program for F4 help on Selection-screen : <b>demo_selection_screen_f4.</b>
    2. Sample program
       REPORT zvenkat_f4_for_selops MESSAGE-ID zmsg .
       TABLES :marc.
       TYPES:
          BEGIN OF t_t001w,
            werks       TYPE t001w-werks,
            name1       TYPE t001w-name1,
          END OF t_t001w,
          t_return_tab  TYPE ddshretval.
       DATA:
           w_t001w      TYPE t_t001w,
           w_return_tab TYPE t_return_tab.
       DATA:
           i_t001w      TYPE STANDARD TABLE OF t_t001w,
           i_return_tab TYPE STANDARD TABLE OF t_return_tab.
    *&      SELECTION-SCREEN
       SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME.
       SELECT-OPTIONS : s_werks FOR marc-werks.
       SELECTION-SCREEN END OF BLOCK b1.
    *&      AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_werks
       AT SELECTION-SCREEN ON VALUE-REQUEST FOR s_werks-low.
         PERFORM f4_help_for_palant USING 'S_WERKS-LOW'.
       AT SELECTION-SCREEN ON VALUE-REQUEST FOR s_werks-high.
         PERFORM f4_help_for_palant USING 'S_WERKS-HIGH'.
    *&      Form  f4_help_for_palant
       FORM f4_help_for_palant USING l_dynprofield.
         SELECT werks name1
         FROM t001w
         INTO TABLE i_t001w.
         CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
           EXPORTING
             retfield        = 'WERKS'
             dynpprog        = sy-repid
             dynpnr          = sy-dynnr
             dynprofield     = l_dynprofield
             value_org       = 'S'
           TABLES
             value_tab       = i_t001w
             return_tab      = i_return_tab
           EXCEPTIONS
             parameter_error = 1
             no_values_found = 2
             OTHERS          = 3.
         IF sy-subrc <> 0.
           MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                   WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
         ENDIF.
       ENDFORM.                    " f4_help_for_palant
    I hope that it solves your problem.
    Thanks
    Venkat.O

Maybe you are looking for

  • ITunes freezes and crashes every time I try to open it

    MacBook using OS X 10.9.2 - Every time (without exception) I try to open iTunes, it goes to the "Accessing iTunes Store" window, and then stays there while launching that much dreaded Mac "spinning wheel of death".... I have to force quit in order to

  • Can I use iCloud if I no longer have an Apple product?

    My phone was corrupted when I updraded to iOS7. After 3 visits and 3 complete wipeouts and resets - the last time using no restore because they told me the backups were corrupted -  it still is very unstable. I cannot use the phone is this condition.

  • SP Designer 2007 Variables

    I have a word form in a dpocument library that when a new document is uploaded, a workflow creates a new task list item.  When the task is completed and the status changed, I want the document properties to be updated in the library. I am having an i

  • Where should the "English" Folder be in Master Suite CS4 for Mac

    For some reason the English folder is sitting on my desktop. On my PC it is buried several folders down. It makes no sense but being mostly a PC person, I'm afraid to move the darn thing. Can anyone help? Cindy 

  • Nikon D70 wrong image size

    I haven't figured out why Aperture is telling me the size of the images coming from my D70 are 3024 X 1998 px instead of 3008 X 2000 px. Does it stretch the images ? Until it does it right I don't trust it and don't dare to translate all my photos in