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

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

  • Selection screen validation problem.

    Hi Gurus,
    I have a report with a selection screen.
    The report has 2 radio buttons.The radiobuttons are grouped together.
    My Requirement is to display different blocks based on radio button selection.
    These blocks have mandatory fields.
    The problem is that when I switch from one radiobutton to other.
    It checks for the mandatory fields which I want to avoid.
    The mandatory fields should be checked only when I process the report (F8).
    Please advise.
    Thanks in advance.

    Just try this code
    SELECTION-SCREEN: BEGIN OF BLOCK B01 WITH FRAME TITLE TEXT-001.
      SELECT-OPTIONS: S_AUART FOR VBAK-AUART OBLIGATORY NO INTERVALS,
                                                         " Sales Document Type
                      S_AUGRU FOR VBAK-AUGRU OBLIGATORY NO INTERVALS,
                                                         " Order reason
                      S_ERDAT FOR VBAK-ERDAT OBLIGATORY.
                                        " Date on which the record was created
    SELECTION-SCREEN: END OF BLOCK B01.
    *-- Mail Sending Options
    SELECTION-SCREEN BEGIN OF BLOCK B2 WITH FRAME TITLE TEXT-004.
      PARAMETERS:P_EMAIL AS CHECKBOX DEFAULT SPACE USER-COMMAND V_COM .
      PARAMETERS : P_MODE TYPE SO_ESCAPE   default 'U' MODIF ID US1.
      SELECT-OPTIONS: S_EMAIL FOR ADR6-SMTP_ADDR
                                          NO INTERVALS MODIF ID US2.
    SELECT-OPTIONS: S_EMAIL FOR TRDYSE01CM-USERNAME
                                         NO INTERVALS MODIF ID US2.
      SELECTION-SCREEN: BEGIN OF LINE.
        SELECTION-SCREEN: COMMENT 55(40) TEXT-019 MODIF ID US2.
      SELECTION-SCREEN: END OF LINE.
    SELECTION-SCREEN END OF BLOCK B2.

  • Mandatory Select-options field problem

    Hello Gurus,
    I have the below scenario:
    In my Z report I am having a select-options for material selection(s_matnr) on selection screen and that is a mandatory field.
    But when the user tries to enter the multiple single values by pressing the arrow icon present near the select-option it gives an error message " Fill in all the required entries "
    So the problem is I cannot enter the multiple single values in select-options until and unless I fill s_matnr-low. Once I fill s_matnr low then its allowing to enter multiple standard values.
    And as per the requirement the user must be able to enter the multiple single values in s_matnr even if s_matnr-low is not populated.
    Is this the standard functionality of SAP or there is some way out of it?
    <removed_by_moderator>
    Thanks in advance.
    Edited by: Julius Bussche on May 8, 2009 7:59 AM

    Hi Sachin,
    Remove the obligatory addition from the declaration of the select-option....
    see the example code below .... it will help you resolve your issue for sure.....
    TABLES : scarr, sscrfields. " Tables sscrfields is a must to be declared in your code...
    SELECT-OPTIONS : carrid FOR scarr-carrid.
    AT SELECTION-SCREEN OUTPUT.
      LOOP AT SCREEN.
        IF screen-name CS 'CARRID'.
          screen-required = 2.                " though obligatory is not mentioned it will give you tick mark
          MODIFY SCREEN.
        ENDIF.
      ENDLOOP.
    AT SELECTION-SCREEN.
      IF sscrfields-ucomm = 'ONLI'.
        IF carrid IS INITIAL.
          CLEAR sscrfields.
          MESSAGE 'Fill in all required entries' TYPE 'E'.       " once the user press F8 then only this error
    " message will be displayed
        ENDIF.
      ENDIF.
    Regards,
    Siddarth

  • 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

  • Cfif select option value problem

    I have a form with a dropdown box asking users to select
    where they
    heard about my site. The completed form sent to me via email.
    The dropdown is optional so if they don't select it I would
    like nothing
    to be returned in the email.
    The first option reads "I heard about you from" - I've tried
    <option
    value> <option value=""> and even <cfselect>
    with various options but I
    can't get it to work.
    This is what I have for the email:
    <cfif
    isdefined("form.referral")><cfoutput>#form.senderFirst#
    heard
    about you from #form.referral#</cfoutput></cfif>
    This is what I have for the select options:
    <select name="referral">
    <option value="">I heard about you
    from...</option>
    <option value="Google">Google</option>
    <option value="Yahoo!">Yahoo!</option>
    <option value="Ask">Ask</option>
    <option value="MSN">MSN</option>
    <option value="a friend">A friend</option>
    <option value="somewhere else">Somewhere
    else</option>
    </select>

    Radio buttons and checkboxes are the only form elements that
    do not have a default value, so the others will always be defined.
    <cfif IsDefined ("form.senderPhone") AND
    Len(Trim(FORM.senderPhone)) GT 0>
    <p>Phone:
    <cfoutput>#form.senderPhone#</cfoutput></p>
    </cfif>
    <cfif IsDefined("form.senderMessage") AND
    Len(Trim(FORM.senderMessage)) GT 0>
    <p>Message:
    <cfoutput>#ParagraphFormat(form.senderMessage)#</cfoutput>
    </p>
    </cfif>
    Probably a more elegant way to do this but I can't think of
    it right now.
    <cfparam name="FORM.webSiteDesign" default="no">
    <cfparam name="FORM.graphicDesign" default="no">
    <cfparam name="FORM.logoDesign" default="no">
    <cfif FORM.webSiteDesign EQ "yes" OR FORM.graphicDesign EQ
    "yes" OR FORM.logoDesign EQ "yes">
    <p>
    Interested in:<br>
    <cfif FORM.webSiteDesign EQ "yes">
    webSiteDesign <br>
    </cfif>
    <cfif FORM.graphicDesign EQ "yes">
    graphicDesign<br>
    </cfif>
    <cfif FORM.logoDesign EQ "yes">
    logoDesign<br>
    </cfif>
    </p>
    </cfif>
    Ken Ford
    Adobe Community Expert
    Fordwebs, LLC
    http://www.fordwebs.com
    "ryansebiz" <[email protected]> wrote in
    message news:[email protected]...
    > dempster wrote:
    >> Why not use something like <option value="X">
    and then test this way:
    >>
    >> <cfif isdefined("form.referral") AND
    form.referral NEQ "X">
    >> <cfoutput>#form.senderFirst# heard about you
    from #form.referral#</cfoutput>
    >> </cfif>
    >
    > Thanks dempster that worked!
    >
    > Now I'd like to be able to do the same thing to a phone
    text box, a few
    > checkboxes and a textarea.
    >
    > None of the code below works - they all return messages
    (i.e. "Phone:"
    > "Interested in:" and "Message:") even if that field
    isn't filled out.
    > I've tried several different variables with no success.
    >
    > My questions are:
    >
    > 1. Phone - How can I write the cfif so the "Phone:"
    doesn't appear in
    > the email if a phone number isn't entered?
    >
    > 2. Checkboxes - The problem here isn't with the boxes
    themselves, but
    > with the "Interested in. Currently I have it set to
    "WebSiteDesign". The
    > obvious problem here occurs when they check another box,
    such as
    > "GraphicDesign". I've tried OR statements with no
    success. How can I
    > write a cfif for the exclusion of "Interested in" in the
    email if no
    > checkboxes are selected?
    >
    > 3. Textarea - What do I need to change in order for the
    email not to
    > display "Message:" if no message is entered?
    >
    > Here's the code:
    >
    > PHONE
    >
    > <!---Appears in the email--->
    >
    > <cfif IsDefined ("form.senderPhone")>
    > <p>Phone:
    <cfoutput>#form.senderPhone#</cfoutput></p>
    > </cfif>
    >
    > <!---Appears on the page--->
    >
    > <cfinput type="Text"
    > name="senderPhone"
    > message="Please enter your area code and phone number."
    > mask="999-999-9999"
    > validate="telephone"
    > validateat="onsubmit,onserver"
    > size="30"
    > maxlength="16">
    >
    >
    >
    >
    > CHECKBOXES
    >
    > <!---Appears in the email--->
    >
    > <cfif IsDefined("form.webSiteDesign")>
    > <p>Interested in:</p>
    > </cfif>
    >
    > <ol>
    > <cfif isdefined("form.webSiteDesign")>
    > <li>Web site design</li>
    > </cfif>
    > <cfif isdefined("form.graphicDesign")>
    > <li>Graphic design</li>
    > </cfif>
    > <cfif isdefined("form.logoDesign")>
    > <li>Logo design</li>
    > </cfif>
    > </ol>
    >
    >
    > <!---Appears on the page--->
    >
    > <p class="boxes">
    > <cfinput type="checkbox" name="webSiteDesign"
    value="yes">
    > Web site design</p>
    >
    > <p class="boxes">
    > <cfinput type="checkbox" name="graphicDesign"
    value="yes">
    > Graphic design</p>
    >
    > <p class="boxes">
    > <cfinput type="checkbox" name="logoDesign"
    value="yes">
    > Logo design</p>
    >
    >
    >
    >
    > TEXTAREA
    >
    > <!---Appears in the email--->
    >
    > <cfif IsDefined("form.senderMessage")>
    > <p>Message:
    >
    <cfoutput>#ParagraphFormat(form.senderMessage)#</cfoutput></p>
    > </cfif>
    >
    >
    > <!---Appears on the page--->
    >
    > <textarea name="senderMessage" cols="44" rows="6"
    wrap="virtual">
    > </textarea>

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

  • 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 ALV problem

    Hello @all,
    I want to make reporting in webdynpro ABAP. I have one Webdynpro component for this. For this I have see many tutorials. But in all the select-options and alv are on one view. i want to make it on two views. Has anybody an tutorial for this or an idea how i can do this easily.
    On one view i have my select options implemented with one container. Now I want to make the ALV table, but i want display the alv on a other site, not under the select options.
    Anybody an idea how i can do this.
    Thanks and regards
    Chrisp

    Hi,
    You can proceed as follows:
    1.Create select options in one view and ALV table in other view.
    2.since its reporting you might be having some button like SEARCH  ,once the user
       enters the  data in the selection screen he clicks on  the SEARCH  button .
    3.In the action handler of the SEARCH button ,get the data from based on the selection criteria 
        and  store that value   in component controller attribute.(create an attribute in comp controller level)
    4.Create an outbound plug for  selection screen view and inbound plug for the ALV table View .
    once you get the data ,based on selection criteria, fire the outbound plug in action handler of the button.
    5.now in the second view bind the ALV table with  data which was stored in the component controller level.
    Priya

  • Clearing the displayed value for a SELECT-OPTION

    How do I clear the displayed value of a SELECT-OPTION? 
    I have 2 SELECT-OPTIONs on my screen (standard basic report program screen).  I use code like this to populate the drop-down boxes for each one. 
    =====
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR s_prgrp-low.
      PERFORM fill_prgrp_values.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR s_prctr-low.
      PERFORM fill_prctr_values.
    =====
    The value the user picks for the first SELECT-OPTION will affect what values I put in the drop-down list for the second SELECT-OPTION. 
    If a user enters a value for the second SELECT-OPTION, and then goes back and changes the value of the first SELECT-OPTION, then I want to do two things:
    1.  Create a new set of values for the drop-down list for the second SELECT-OPTION (no problem; working fine);
    2.  Clear the displayed value from the second SELECT-OPTION that the user entered previously.  That value became invalid when the user picked a new value for the first SELECT-OPTION. 
    How do I clear that second displayed value? 
    I have tried CLEAR and REFRESH for the second variable using the formats s_prctr, s_prctr[], and s_prctr-low.  They will erase the values of the internal table or part(s) of it, but the displayed value stays on the screen. 
    I need to clear out the displayed value so the user will either leave it blank or enter or select a new value. 
    I am using F4IF_INT_TABLE_VALUE_REQUEST to build the drop-down lists, and it works fine, but I do not see any function module to clear the displayed value off the screen. 
    Thanks for your help.

    Sorry, but calling DYNP_VALUES_UPDATE did not work.  This is how I coded it. 
    fld_reset_rcd-fieldname  = 'S_PRCTR'.
      fld_reset_rcd-stepl      = sy-stepl.
      CLEAR fld_reset_rcd-fieldvalue.      "  re-initialize s_prctr
      CLEAR fld_reset_rcd-fieldinp.        "  what goes in here?
      APPEND fld_reset_rcd TO fld_reset_tbl.
      CALL FUNCTION 'DYNP_VALUES_UPDATE'
        EXPORTING
          dyname = 'ZFI_GL_BALANCE_NGL'
          dynumb = '1000'
        TABLES
          dynpfields = fld_reset_tbl
    <Added code tags>
    I have discovered that CLEAR and REFRESH of s_prctr will clear it somewhat.  If I enter multiple values, ranges, etc., they will all be cleared, EXCEPT for the one single value that is displayed on the main screen.  It is not cleared and it remains if you push the button to display the pop-up to enter ranges, etc. 
    To devrath.sampat  --  Thanks for your example for building the drop-down list, but that is not the problem I am having.  I am already able to build it just fine. 
    To repeat my problem, if I: 
    1.  first enter / select a value for the first SELECT-OPTION s_prgrp
    2.  then enter / select a value for the second SELECT-OPTION s_prctr
    3.  And finally go back and select a new value of the first SELECT-OPTION s_prgrp from its drop-down list,
         when I do, the program needs to clear the value displayed on the main screen for the second SELECT-OPTION s_prctr (any additional values, ranges, etc., are cleared by CLEAR and REFRESH, if I go look; but not the value shown on the main screen).
    Edited by: Scott Crosby on Feb 14, 2012 4:20 PM
    Edited by: Suhas Saha on Feb 15, 2012 12:03 PM

  • Select-options: in inner join

    in this peace of code i got error message like:
    The column name "VBELN" has two meanings..
    Please let me know how to resolve this <b>select-options:</b> problem
    tables:vbap,lips,likp.
    data: begin of first occurs 0,
          vbeln1 like vbap-vbeln,
          matnr2 like vbap-matnr,
          werks3 like lips-werks,
          route4 like likp-route,
          end of first.
    select-options: enter for vbap-vbeln.
          select
                a~vbeln
                a~matnr
                b~werks
                c~route
                into table first
                from vbap as a
                inner join lips as b
              on avbeln = bvbeln
              inner join likp as c
              on bvbeln = cvbeln
             <b> where vbeln in enter.</b>
          loop at first.
              write:/2 sy-vline, first-vbeln1,
                       sy-vline,first-matnr2,
                        sy-vline,first-werks3,
                         sy-vline,first-route4.
              endloop.
    Thanks In advance
    ~~SANDY~~~

    Hi,
    Try this one,it is working fine,
    tables:vbap,lips,likp.
    data: begin of first occurs 0,
    vbeln like vbap-vbeln,
    matnr like vbap-matnr,
    werks like lips-werks,
    route like likp-route,
    end of first.
    select-options: enter for vbap-vbeln.
    <b>select avbeln amatnr bwerks croute into corresponding fields of table first
           from vbap as a inner join lips as b on avbeln = bvgbel
           inner join likp as c on bvbeln = cvbeln
           where a~vbeln in enter.</b>
    loop at first.
    write:/2 sy-vline, first-vbeln,
    sy-vline,first-matnr,
    sy-vline,first-werks,
    sy-vline,first-route.
    endloop.
    Regards,
    Padmam.

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

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

Maybe you are looking for

  • F-43 Withholding tax error

    Hi, I posted correctly in F-43 using WHT, but while saving the error arise: <b>Error</b> Could not determine the year for TDS certificate number range Message no. 8I017 <b>Diagnosis</b> The excise year could not be determined for generating the numbe

  • Return Value of a Select List with Submit

    I have a Select List with Submit (P8_COLOR) which I want to use to filter the data in my report. P8_COLOR has 3 static values ALL, RGB, BYP that return ALL,RGB and BYP. When the page is submitted, my SQL Query (PL SQL function body returning SQL Quer

  • SAML2 configuration upload metadata file

    Hi experts, currently, we are implementing SAML2 and we have an issue by uploading the metadata.xml within the SAML2 trusted provider tab. I tried to upload the metadata.xml file of the identity provider on service provider site. After clicking uploa

  • Flash Player 9 + Firefox / Internet Explorer and Proxyserver Settings inside the Browser

    Dear Adobe, according to this document from your Website: http://www.adobe.com/devnet/flashcom/articles/firewalls_proxy04.html which says: "When running within a browser, Macromedia Flash Player uses the browser's HTTP services to communicate through

  • Costing relevancy in BOM "X" is not active.

    Dear Experts After MRP run, trying to convert Planned order to Proc. order the <b>costing relevancy in BOM "X" is not active</b>. But when i am trying  to create process order with manually(cor1) costing relevancy in BOM "X" is active. Can i know y t