Selection-options validation

i want to do required field validation for select-options:s_slmtnr for mara-matnr.
that is whether user has entered the high and low value.
s_slmtnr-high and low show not be blank.
Moderator message: please search for available information/documentation before asking.
Edited by: Thomas Zloch on Dec 4, 2010 9:49 PM

aswk,
thanks for the reply.
my code:
IF MA_DE = 'X'.
   IF S_MATUM-LOW = 0 OR S_MATUM-HIGH = 0.
     MESSAGE: 'PLEASE ENTER RANGE' TYPE 'E'.
   ENDIF.
ENDIF.
but here if i put 'AND' instead of 'OR'.it will not work for both low and high.
what i know is 'AND' is used to do for both true,but here 'OR' works like that why.

Similar Messages

  • 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

  • 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

  • Hiii select option validation on screen

    Hi
    please advise how do i do check on selection screen
    Suppose i have a internal table ITAB which has value as below
    ITAB-->
    BUKRS----CODE
    AA-------01
    AA-------08
    AA-------07
    BB-------03
    BB-------04
    i have on selection screen as below:
    Paremeters: P_bukrs
    select_options: S_CODE
    i have to do a check when user enter value on s_code that it is valid for the bukrs
    please advise.  can we do a loop with S_code

    Hi,
    Try like this,
    Just copy paste and execute the code.
    REPORT  z10_test
            NO STANDARD PAGE HEADING
            MESSAGE-ID z10_test.
    Types: begin of t_tab,
           bukrs type bukrs,
           code(4) type c,
           end of  t_tab.
    data: itab type standard table of t_tab with header line.
    parameters: p_bukrs like itab-bukrs.
    select-options: s_code for itab-code.
    AT SELECTION-SCREEN on S_code.
    itab-bukrs = 'AA'.
    itab-code = '01'.
    append itab.
    itab-bukrs = 'AA'.
    itab-code = '08'.
    append itab.
    itab-bukrs = 'AA'.
    itab-code = '07'.
    append itab.
    itab-bukrs = 'BB'.
    itab-code = '03'.
    append itab.
    itab-bukrs = 'BB'.
    itab-code = '04'.
    append itab.
    loop at itab where code in s_code and
                       bukrs = p_bukrs.
    if sy-subrc ne 0.
    exit.
    endif.
    endloop.
    message e000.   <--- Error message.
    Hope this helps.
    Edited by: jagannathan krishnan on Feb 4, 2008 7:12 AM

  • Select options validation in selection screen

    Hi all,
    I have select options for plant in selection screen..I want to validate the Plants. and display the invalid plants in the selection screen itself....Since my report is for online purpose i am in need of this requirement...i dont want to print or display the invalid plants as output of the report..
    Is thaee any way to achieve this...please help.
    points will be rewareded  definetely if problem gets solved by your solution.
    Thanks in advance..

    Hi
    AT SELECTION-SCREEN ON S_WERKS.
    PERFORM F_CHECK_PLANT    USING TEXT-024.
    FORM F_CHECK_PLANT  USING    P_TEXT_004.
      IF S_WERKS IS NOT INITIAL.
        DATA: LV_WERKS TYPE WERKS_D.
        SELECT SINGLE WERKS
               INTO   LV_WERKS
               FROM   T001W
               WHERE  WERKS IN S_WERKS.
        IF SY-SUBRC <> 0.
          CLEAR S_WERKS.
          MESSAGE E000 WITH P_TEXT_004 "(Plant does not exist)
        ENDIF.
        CLEAR LV_WERKS.
      ENDIF.
    ENDFORM.                    " F_CHECK_PLANT
    Reward if useful
    Narendra

  • Select options validation problem

    I have to retrive some data for range of  p.document numbers.for this
    I have declared a select option for p,document number ekko-ebeln.
    when Im trying to retrive data from
    ekko with some condions..
    I have only one record for the specified p.document number(0030).even though im givng something like abc in select -oprions low...its displaying that paritcular records belonging to p.docnum 0030 is not satisfying its showing the result.
    please let me know the sol..its urjent

    Not sure if this is causing your issue, but I suggest you change your code as indicated below:
    SELECT ebeln
      INTO TABLE t_ekko
      FROM ekko
      WHERE ebeln IN s_ebeln
      AND bstyp EQ 'K'
      AND ( bsart EQ 'KW'  OR bsart EQ 'KM'  ). "<<< add brackets to group  
    Your current code is logically the same as:
    SELECT ebeln
      INTO TABLE t_ekko
      FROM ekko
      WHERE ( ebeln IN s_ebeln AND bstyp EQ 'K' AND bsart EQ 'KW' )
              OR ( bsart EQ 'KM'  ).
    I don't think this is what you would want.
    Andrew

  • 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

  • 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

  • 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

  • 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

  • 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

  • Validation of Select Options for a field

    Hi All,
    I need to write a validation logic for a select option for VTWEG (Distribution Channel).
    select-options:  s_vtweg for komg-vtweg.
    I need to check whether the user has entered the correct value based on the search help. The check table of this particular field is TVTW. 
    Following is the code i wrote under the AT SELECTION-SCREEN block:
    IF NOT S_VTWEG-LOW IS INITIAL.
    SELECT SINGLE VTWEG INTO KOMG-VTWEG FROM TVTW
                                     WHERE VTWEG IN S_VTWEG.
    IF SY-SUBRC NE 0.
    CONCATENATE ' Please enter the correct
                                    Distribution Channel '
    Z_MSG INTO Z_MSG.
    SET CURSOR FIELD 'S_VTWEG-LOW'.
    MESSAGE E000 WITH Z_MSG.
    ENDIF.
    ENDIF.
    It works fine when the user enters a wrong value in the S_VTWEG-LOW field, where as if i gives more than one wrong value in the range or giving individual values its not working. Let me know how to do the validation check for multiple values entered individually or in ranges.
    Could you please suggest how to resolve this problem.
    Thank You,
    Suresh

    You could do something like this.....here looping at the select-option table and check the values for low and high.
    report zrich_0003.
    tables: komg.
    data: z_msg(100) type c.
    select-options: s_vtweg for komg-vtweg.
    at selection-screen.
      loop at s_vtweg.
        if not s_vtweg-low is initial.
          select single vtweg into komg-vtweg from tvtw
                 where vtweg = s_vtweg-low.
          if sy-subrc ne 0.
            concatenate ' Please enter the correct
            distribution channel '
                      z_msg into z_msg.
            set cursor field 'S_VTWEG-LOW'.
            message e001(00) with z_msg.
          endif.
        endif.
        if not s_vtweg-high is initial.
          select single vtweg into komg-vtweg from tvtw
                 where vtweg = s_vtweg-high.
          if sy-subrc ne 0.
            concatenate ' Please enter the correct
            distribution channel '
                      z_msg into z_msg.
            set cursor field 'S_VTWEG-HIGH'.
            message e001(00) with z_msg.
          endif.
        endif.
      endloop.
    Regards,
    Rich Heilman

  • 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.

  • Validation of SELECT OPTIONS

    Hi Gurus,
    Please let me know which is the best way to validate a select option and performance way also it must be best.
    May be this is a silly question but still I was not able to find the best convincing answer in the FORUM.
    Kindly validate.
    Method 1:
    AT SELECTION-SCREEN ON so_vbeln . " Delivery document
    PERFORM validate_vbeln .
    FORM validate_vbeln.
    DATA : l_t_vbeln TYPE TABLE OF vbuk-vbeln WITH HEADER LINE ,
    l_f_vbeln TYPE vbuk-vbeln .
    RANGES ra_vbeln FOR vbuk-vbeln.
    LOOP AT so_vbeln.
    IF NOT so_vbeln-low IS INITIAL.
    ra_vbeln-sign = 'I'.
    ra_vbeln-option = 'EQ'.
    ra_vbeln-low = so_vbeln-low.
    APPEND ra_vbeln.
    ENDIF.
    IF NOT so_vbeln-high IS INITIAL.
    ra_vbeln-sign = 'I'.
    ra_vbeln-option = 'EQ'.
    ra_vbeln-low = so_vbeln-high..
    APPEND ra_vbeln.
    ENDIF.
    ENDLOOP .
    IF NOT so_vbeln[] IS INITIAL.
    SELECT vbeln INTO TABLE l_t_vbeln
    FROM vbuk
    WHERE vbeln IN ra_vbeln.
    ENDIF.
    LOOP AT so_vbeln.
    IF so_vbeln-low space.
    READ TABLE l_t_vbeln WITH KEY = so_vbeln-low.
    IF sy-subrc 0.
    SET CURSOR FIELD 'SO_vbeln-LOW'.
    MESSAGE e001(vb) WITH so_vbeln-low.
    ENDIF.
    ENDIF.
    IF so_vbeln-high space.
    READ TABLE l_t_vbeln WITH KEY = so_vbeln-high.
    IF sy-subrc 0.
    SET CURSOR FIELD 'SO_vbeln-HIGH'.
    MESSAGE e001(vb) WITH so_vbeln-high.
    ENDIF.
    ENDIF.
    ENDLOOP.
    ENDFORM. " validate_vbeln
    Method 2
    AT SELECTION-SCREEN ON so_werks.
    PERFORM validate_plant.
    FORM validate_plant.
    DATA: BEGIN OF l_t_werks OCCURS 0,
    werks LIKE t001w-werks,
    END OF l_t_werks.
    IF NOT so_werks[] IS INITIAL.
    SELECT werks INTO TABLE l_t_werks
    FROM t001w
    WHERE werks IN so_werks.
    ENDIF.
    LOOP AT so_werks.
    IF so_werks-low space.
    READ TABLE l_t_werks WITH KEY werks = so_werks-low.
    IF sy-subrc 0.
    MESSAGE e892(m7) WITH so_werks-low.
    ENDIF.
    ENDIF.
    IF so_werks-high space.
    READ TABLE l_t_werks WITH KEY werks = so_werks-high.
    IF sy-subrc 0.
    MESSAGE e892(m7) WITH so_werks-high.
    ENDIF.
    ENDIF.
    ENDLOOP.
    ENDFORM.

    Hello Raj,
    For me if the SELECT-OPTION fetches atleast one record from the check table, processing should be allowed to proceed.
    It's not required to check each & every records in the select-option & throw an error message for these invalid records (unlike PARAMETERs)
    I would code something like this:
    SELECT vbeln INTO TABLE l_t_vbeln UP TO 1 ROWS
    FROM vbuk
    WHERE vbeln IN so_vbeln. ENDSELECT.
    IF sy-subrc NE 0.
      MESSAGE 'No valid Sales Order selected for the input range. Please check.' TYPE 'E'.
    ENDIF.
    BR,
    Suhas

  • Validation Check in Select Options

    Hi All,
         I have a select-options variable. I want to write a check that the user doesnot enter any values other than 04,03 and 07. Can i write this validation check because the select options table can have many values in the option field and two values in the sign field.
    Thanks & Regards,
    Rahul Rathi

    i,
        use below logic
         select-options s_matnr for mara-matnr no intervals.
       at selection-screen.
      ranges r_matnr for mara-matnr.
      R_matnr-LOW = '04'.
      r_matnr-sign = 'I'.
      r_metnr-option = 'EQ'.
      append r_matnr.
      R_matnr-LOW = '03'.
      append r_matnr.
      R_matnr-LOW = '07'.
      append r_matnr.
    clear r_matnr.
    select single matnr from mara into mara-matnr
         where matnr in r_matnr.
    if sy-subrc <> 0.
    message e00 'enter values in range '03,04,07'
    endif.
    or
    you can default this value
    at selection-screen output.
      ranges r_matnr for mara-matnr.
      R_matnr-LOW = '04'.
      r_matnr-sign = 'I'.
      r_metnr-option = 'EQ'.
      append r_matnr.
      R_matnr-LOW = '03'.
      append r_matnr.
      R_matnr-LOW = '07'.
      append r_matnr.
    clear r_matnr.
    s_matnr[] = r_matnr[].
    Regards,
    amole

Maybe you are looking for

  • I am unable to print a copy using my 3510e printer

    I am unable to print a copy of a document using my 3510e printer

  • Organizing Videos in folders

    Hi, is there any way to organize videos in folders? So far I have one long list, mixed with movies, videos from various conferences, family videos an so on. Thx Dieter

  • QT v10.0 "save for web" creates file names with spaces?

    I find it strange that the additional exported files from "save for web" (iPhone, etc) auto exports files with spaces in the file names. Not only that, but changing the file names breaks the javascript. I work on a server that denies permission to fi

  • Netweaver Developer Studio on Eclipse 3.x basis

    Hello everybody, does someone know, when the NWDS will be migrated to a Eclipse 3.x basis? Perhaps with the next Netweaver Version? Background: We're about to make some eclipse plugin considerations, and some of them don't work with Eclipse 2.x Thank

  • HTTP/RFC Session was deleted after timeout

    Hi all, several of my colleagues are working in CRM Web UI. Sometimes they just got logged of from the system. The only hint I can see in sm21 is "HTTP/RFC Session was deleted after timeout" (translated from german) with no additional info. Has someo