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

Similar Messages

  • MANDATORY CHECK FOR SELECT OPTION.

    Hi gurus,
    How to do a mandatory check on select options..
    how do wegive messages in webdynpro..as in information, error as we do it in report programming..!
    Best Regards,
    Navin fernandes.
    Edited by: NAVIN FERNANDES on Dec 30, 2009 3:18 PM

    Hi,
    To make a selection field mandatory:
    wd_this->m_handle->add_selection_field(
                            i_description = 'Candidate Profit Center'
                            i_id = '/MRSS/T_RMOR_PROF_CENTER'
                             i_value_help_type = if_wd_value_help_handler=>co_prefix_searchhelp
                            i_value_help_id = '/MRSS/SH_RM_PC_GROUP'
                            it_result = lt_range_table
                           *I_OBLIGATORY = ABAP_TRUE*
                            i_read_only = read_only ).
    MAKE THE PARAMETER ABAP_TRUE  TO MAKE IT MANDATORY.
    OR PUT THE PARAMETER AS ABAP_FALSE.
    Priya
    Edited by: Chaitanya Priya Puvvada on Dec 30, 2009 6:34 PM

  • Checking against Select-Options with "CP" using "IF value IN select_option"

    Dear experts,
    first of all: I'm sorry, if this question already should have been asked and answered!
    I tried quite a lot of search terms but didn't find anything helpful.
    We are using a statement like "IF value IN select_option" to perform comparisons after the Select-Options have been used in a SELECT statement. This logical expression fails (compared to the results of the DB-SELECT) whenever a select-option line contains the option CP (Contains Pattern). To be more specific: The case sensitivity of the LOW value doesn't seem to play a role any more. A variable with the value 'ABCD' would be positively checked against a select-option with OPTION 'CP' and LOW 'abc*', whereas this value wouldn't have been selected if the select-option had been used in a DB-SELECT.
    Does anybody know a workaround?
    Thanks in advance
    Andreas

    Dear Keshav,
    it's an own field in an own table, defined as CHAR of length 140 (lowercase allowed), reflecting to a line of remittance info of an account statement. A regular Select-Option for this field is provided in a report which works perfectly fine regarding the case sensitivity. For reasons I don't want to point out in detail we need to check a value in this field against the select-option without selecting it from the db again.
    Let's assume that a field remittance_info contains the value 'ABCD'.
    A line of the select-option table looks like this:
    select_option_table-SIGN = 'I'
    select_option_table-OPTION = 'CP'
    select_option_table-LOW = 'abc*'.
    Then an ABAP statement such as
    IF remittance_info IN select_option_table.
    * would be true !!!
    ENDIF.
    but wouldn't deliver a result in a SELECT such as
    SELECT * FROM my_table INTO TABLE my_internal_table WHERE remittance_info IN select_option_table.
    because of the differences in lower/upper case.
    regards
    Andreas

  • Selection screen: no sequence check for select option

    Hello everyone,
    I am an SAP starter and this will is my first question:
    I am making a program that approves a stock demand over several levels. When a level approves, the demand goes to the next level.
    for example:
    level 1 = planning
    level 2 = management
    level 3 = buyer
    In an overview report i want to choose for which levels i want to see stock demands. But when I make a select option for the level, I cannot choose the range between management and buyer or planning and buyer for example, because it is alphabetically not in the right order. In this case the alfabet is not important but the order of the levels is, so can I prevent this check from happening?
    Thank you very much

    Hi vandersteen,
    1. There should be some CODE
       for each level.
    2. Each code will have some description.
      eg. planning, management, buyer
    3. So, make select-option
       for the FIELD of CODE
       (and not the description)
    regards,
    amit m.

  • Authorization check for select-options field - Company code.

    Hi experts,
    i have company code field on the report selection screen and i have to validate the authorization check for BUKRS.
    How to do authorization check for a select-options field?
    Any function modules used to write the authorization check for a SELECT-OPTIONS FIELD?
    Thanks.

    >
    RNB wrote:
    > Any function modules used to write the authorization check for a SELECT-OPTIONS FIELD?
    Does it hurt to type a few lines of code? Why do you need an FM for this my friend?
    Anyways can you please tell which SAP application area (viz. FI, SD etc.) do you want to run the report?
    Suhas

  • Validation for the select option value range of selection screen

    Hi All.
    if i wish to validate the selection screen parameter for a value range(select options),is it possible?
    what should i write in code.Also,m using FM DD_DOMVALUES_GET to get the values for a specific domain name.
    Please reply.

    Hiii,
         Yes it is possible.... Can you give me the piece of code ... about the select option
    and also the value range against which you want to validate the select option.
    So that i can help you with the coding tips...
    Thanks in advance..

  • Validation check in selection screen

    Hi experts,
    I have a selection screen in which there are 2 radio buttons S1 n S2, and a text field (Parameter) namely P_PATH.
    I am using a method (CALL METHOD cl_gui_frontend_services=>file_save_dialog) for selecting a file to save some
    data in the XLS format.
    Once the user selects S2, and presses the F4 help in the parameter P_PATH, this method is called.
      CALL METHOD cl_gui_frontend_services=>file_save_dialog
        EXPORTING
          window_title      = p_title
          default_file_name = p_filename
          file_filter       = l_file_filter
          initial_directory = p_download_path
        CHANGING
          filename          = p_filename
          path              = p_download_path
          fullpath          = p_full_path
          user_action       = g_user_action    "save or cancel
        EXCEPTIONS
          OTHERS            = 1.
    The  g_user_action given here has a value of 9 in case the user selects the CANCEL button in the pop up that asks for the file name to be given for saving the file.
    My req. is that when  g_user_action = 9. then the selection screen should be displayed back, with the S1 being selected (instead of the earlier S2).
    I have done the below coding, but its not working. Is there something that I am doing incorrect?
    SELECTION-SCREEN: BEGIN OF BLOCK b4 WITH FRAME TITLE text-004.
    PARAMETERS: s1 RADIOBUTTON GROUP rad2 DEFAULT 'X' USER-COMMAND ac,
                s2 RADIOBUTTON GROUP rad2.
    SELECTION-SCREEN: END OF BLOCK b4.
    DATA: g_s1 type c.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_path.
    PERFORM get_download_path
    AT SELECTION-SCREEN OUTPUT.
    if g_s1 = 'X'.
      s1 = 'X'.
      s2 = ''.
    endif.
    FORM get_download_path
    the above method is called**
    IF g_user_action = 9.
    g_s1 = 'X'.
      exit.
    endif.
    ENDFORM.

    Hello Ajay,
    As Advait has pointed out already AT SELECTION_SCREEN OUTPUT event (or the PBO) does not trigger after the ON VALUE-REQUEST (or the POV) event.
    You have to use the FM: DYNP_VALUES_UPDATE to update the selection-screen value.
    FORM get_download_path
    ** the above method is called**
      data: dyname like d020s-prog,
            dynumb like d020s-dnum.
      data: it_dyfields type standard table of dynpread,
               st_dyfields type dynpread.
    IF g_user_action = 9.
      dyname = sy-repid.
      dynumb = sy-dynnr.
      CLEAR s2.
      s1 = 'X'.
      move 'S1' to st_dyfields-fieldname.
      move  'X'  to st_dyfields-fieldvalue.
      append st_dyfields to it_dyfields.
      move 'S2' to st_dyfields-fieldname.
      CLEAR st_dyfields-fieldvalue.
      append st_dyfields to it_dyfields.
      call function 'DYNP_VALUES_UPDATE'
           exporting
                dyname               = dyname
                dynumb               = dynumb
           tables
                dynpfields           = it_dyfields
           exceptions
                invalid_abapworkarea = 1
                invalid_dynprofield  = 2
                invalid_dynproname   = 3
                invalid_dynpronummer = 4
                invalid_request      = 5
                no_fielddescription  = 6
                undefind_error       = 7
                others               = 8.
      check sy-subrc eq 0.
    endif.
    ENDFORM.
    Check this out.
    BR,
    Suhas

  • Check select-options parametr value

    hi,
    i want to check if select-option parameter value is '002' then execute some code, how can i do that .
    thanks in advance,
    ramakrishna buddala.
    Moderator Message: Not enough search done. Thread locked.
    Edited by: Suhas Saha on Oct 20, 2011 3:15 PM

    Hi
    Perform the validation in AT Selection-screen on field event.If validation is not succes then give error message.
    AT selection-screen on <Fieldname>.
    if fieldname-low <> '002'.
       message '<Message Text>' type 'E'.
    endif.
    Regards.
    Raghu.

  • FM to check values in select option

    Hi Experts ,
    I want to compare values entered in select option with certain constant values. Is there any FM which will do this?
    Thanks & Regards ,
    Jigar Thakkar

    I believe that there is no such FM. You need to build a range for your constant values and then compare your select option with the range build for constants.
    Eg.
    select-options: s_werks for t001w-werks.
    ranges r_werks for t001-werks.
    r_werks-sign = 'I'.
    r_werks-option = 'EQ'.
    r_werks-low = '2101'.   "Pass the constant value.
    append r_werks.         "Range built for one entry 2101. Similarly append further constant values.
    *Check if select option contains any of the constant values.
    if s_werks in r_werks.
    * Select-options contains value as defined in range
    else.
    * No matching value found.
    endif.

  • Passing SELECT-OPTIONS to smart forms

    hi ,
       how can we pass select options from a program to a smart form.
    Regards
    Arun

    Hi,
    Just try to append the valid values in select options  to internal table from report.
    Then pass that internal table(ofcourse, you need to create user-defined struture if needed in SE11) from report to smart forms.
    Rgds,
    J.Jayanthi

  • Multiple selection tab on Custom F4 of select option in report

    Hi folks ,
      how to get MULTIPLE SELECTION tab on extension of my selec option of report screen.
    If i pass Multiple_choice = 'X' in fm 'F4IF_INT_TABLE_VALUE_REQUEST' check boxes are appearing of each my f4 values when i press f4, i dnt want like this i want it my extension as Multiple selection as how it appears for standard 4 helps.
    <removed by moderator>
    Thanks,
    Shwetha
    Edited by: Thomas Zloch on Jan 7, 2012 10:32 PM

    Hi Clemen,
    Any selectin screens element(select-option) if we click on extension we will get a pop up window with  SINGLE VALUES,SELECT RANGES,EXCLUDE SINGLE VALUES, EXCLUDE RANGES bottome of this window we are having some icons along with it we have MULTIPLE SELECTION Tab.if we click on multiple selection tab we will be getting our all values with checkboxes each front of it so that we can select multiple vlaues at a time for the particular f4 .
    i want this multiple selection tab for my custome F4, iam not getting this MULTIPLE SELECTION tab.
    for example you can check for select-option of account group(T077D-KTOKD).
    in F4 function module if iam using paramter MULTIPLE_CHOICE = 'X', iam not getting the extension pop window with singlevalues, select ranges etc ., instead of it iam getting all my f4 fields with the checkboxes infront of each of it.
    please throw some light it is very urgent.
    please tell me iam using following parameters in function module please let me know if i need to use any other to get it..
    with the following if iam selecting multiple also i am able to see only last value in selection(inpopup window)
    CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
        EXPORTING
          retfield        = 'ATWRT'
          dynpprog        = sy-cprog
          dynpnr          = sy-dynnr
          dynprofield     = 'S_CHVAL1-HIGH'
          display         = c_sp
          value_org       = c_s
          multiple_choice = 'X'
          callback_program = sy-repid
        TABLES
          value_tab       = t_finals
          return_tab      = t_return4
        EXCEPTIONS
          parameter_error = 1
          no_values_found = 2
          OTHERS          = 3.
      IF sy-subrc = 0.
        READ TABLE t_return4." WITH KEY retfield = 'S_CHVAL1'.
        IF sy-subrc EQ 0.
          s_chval1-high = t_return4-fieldval.
        ENDIF.
      ENDIF.
    Thanks,
    Shwetha
    Edited by: swetha rishi on Jan 8, 2012 11:15 AM

  • Chain-end_chain for a select-option in a subscreen

    hi all, I have a program with a screen 0010 with some fields....one of this fields must have "multiple input" (as with select-options) so I´ve created a subscreen 0020 within this screen 0010 (it´s the only way I know to put select-options in a screen)
    The problem is in screen 0010 I have a chain end_chain to check data in the custom fields:
    CHAIN.
       FIELD zget_assigner-fipex.
       FIELD zget_assigner-ebeln.
       FIELD zget_assigner-belnr.
       MODULE check_fields.  " ON CHAIN-REQUEST.
    and in my screen 0020 i have other chain endchain to check the select-option....
    CHAIN.
      FIELD  S_BNAME-LOW.
      MODULE %_END_OF_SCREEN.
      MODULE %_OK_CODE_1000.
      module check_fields_0020.
    ENDCHAIN.
    the problem is when I enter data in the select-option and hit enter the program give me an error message saying I can´t use "set screen and leave screen in a subscreen" and the program finish....
    if I don´t hit enter but press OK to continue the process....the chain end chain from 0020 give me a message saying the data is wrong (this is ok) but the select-option stay in display mode (chain endchain did this) and I can´t modify the data in the select-option...
    What I need to do in order to get editable the select-option after the error messager from chain is showed????
    Thanks in advance....
    How can I check the data in the select-option S_BNAME is correct????

    hi all, thanks for your kindly answers...
    finally I fixed the problem using  
    "at selection-screen on s_bname" and a bit of new code in the module where I manage actions to do in base to the values of the sy-ucomm.....
    so If the data in the select-option is wrong I show an error message in the "at selection-screen" and I call screen 0010 in my user_command_0010 where I checks the sy-ucomm values....
    Thanks again.

  • Problem if Select-Option  is INITIAL.

    HI all,
    I have a question on how to handle to handle Select-Options.
    IF some_value IN S_value.
    Logic1.
    ELSE.
    Logic2.
    ENDIF.
    Problem here is when Select-Option S_value is Empty. It is true for all values in 'some_value'. Is there any easy way to handle it, WITHOUT explicitly checking if the Select-Option IS INITIAL or not, it make my code lot simpler.
    Thanks in Advance,
    Ravi.

    Hi,
    Why do you want to avoid checking whether select-option is initial. That is the simplest way to handle this.
    If you dont want that then my suggestion is use, describe table S_OPTION and get number of lines. You can check whether number of lines is zero or more than zero.
    Ex:
    data : l type i.
    describe table s_option lines l.
    if l = 0.
    else.
    endif.
    Still checking for initial is the best option.
    Regards,
    Ramesh.

  • 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

Maybe you are looking for