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.

Similar Messages

  • Problem in AT selection screen validation

    Hi,
    I am having problem in AT SELECTION SCREEN Validation.
    I have 2 radiobutton and 6 parameter. if i click first radio button  all the 6 radiobutton should enable and take the user input, that is working fine for me.
    if i click second radiobutton , out of 6 , 3 parameter should disable and remaining 3 should enable. thats also working fine.
    My problem is program has written the validation for this 3 parameter in the AT SELECTION SCREEN.
    For first radioutton all the validation working  fine, for second validation as soon as i press the radiobutton it will display error message. Based on 2 parameter user is filling value for 3 rd parameter.
    I want the same validation to be done for second radio button after user pressing enter.
    PARAMETER: p_single RADIOBUTTON GROUP rad1 DEFAULT 'X' USER-COMMAND f1,
               p_multi RADIOBUTTON GROUP rad1.
    PARAMETERS: s_pwwrk LIKE plaf-pwwrk.          
    PARAMETERS: p_lgort LIKE plaf-lgort.
    PARAMETERS: p_kostl LIKE cobl-kostl.
    here is my code:
    AT SELECTION SCREEN.
    CLEAR t001w.
      CLEAR t001k.
      CLEAR marv.
      SELECT SINGLE * FROM t001w WHERE werks EQ s_pwwrk.
      IF sy-subrc NE 0.
        MESSAGE e999 WITH 'Plant' s_pwwrk 'does not exist'.
      ELSE.
        SELECT SINGLE * FROM t001k WHERE bwkey EQ t001w-bwkey.
        SELECT SINGLE * FROM marv WHERE bukrs EQ t001k-bukrs.
        IF p_budat0(4) NE marv-lfgja OR p_budat4(2) NE marv-lfmon
    IF marv-xruem IS NOT INITIAL.
            IF p_budat0(4) NE marv-vmgja OR p_budat4(2) NE marv-vmmon.
    MESSAGE e999 WITH p_budat4(2) p_budat0(4)
                                'is closed.
                                            Please try again.'.
            ENDIF.
          ELSE.
            MESSAGE e999 WITH p_budat4(2) p_budat0(4)
                              'is closed.
                                          Please try again.'.
          ENDIF.
        ENDIF.
      ENDIF.

    For your Case ,
    If i understand clearly,You can do the validation when you want on AT SELECTION SCREEN ON WP_FIELD.
    If you say your validation to be done only for Selection of Second Radio Button, then..
    AT SELECTION SCREEN.
    if p_multi  eq 'X'. "<- Make Validation to be done only if user select Second Button
    CLEAR t001w.
    CLEAR t001k.
    CLEAR marv.
    SELECT SINGLE * FROM t001w WHERE werks EQ s_pwwrk.
    IF sy-subrc NE 0.
    MESSAGE e999 WITH 'Plant' s_pwwrk 'does not exist'.
    ELSE.
    SELECT SINGLE * FROM t001k WHERE bwkey EQ t001w-bwkey.
    SELECT SINGLE * FROM marv WHERE bukrs EQ t001k-bukrs.
    IF p_budat+0(4) NE marv-lfgja OR p_budat+4(2) NE marv-lfmon
    IF marv-xruem IS NOT INITIAL.
    IF p_budat+0(4) NE marv-vmgja OR p_budat+4(2) NE marv-vmmon.
    MESSAGE e999 WITH p_budat+4(2) p_budat+0(4)
    'is closed.
    Please try again.'.
    ENDIF.
    ELSE.
    MESSAGE e999 WITH p_budat+4(2) p_budat+0(4)
    'is closed.
    Please try again.'.
    ENDIF.
    ENDIF.
    ENDIF.
    endif.

  • Problem in selection screen validation.

    Hi All,
    I am having the following in the selection screen:
    PARAMETERS : p_r1 RADIOBUTTON GROUP grp DEFAULT 'X' USER-COMMAND dlvy,
                 p_r2 RADIOBUTTON GROUP grp .
    SELECTION-SCREEN BEGIN OF BLOCK b1 with frame title text-001.
    SELECT-OPTIONS: s_vbeln FOR lips-vbeln             MODIF ID dly.
    SELECT-OPTIONS: s_lfart FOR likp-lfart  OBLIGATORY MODIF ID dly.
    SELECT-OPTIONS: s_vstel FOR likp-vstel             MODIF ID dly.
    SELECT-OPTIONS: s_matnr FOR lips-matnr             MODIF ID dly.
    SELECT-OPTIONS: s_wadat FOR likp-wadat  OBLIGATORY MODIF ID dly.
    SELECT-OPTIONS: s_wbsta FOR vbup-wbsta             MODIF ID dly.
    SELECTION-SCREEN END OF BLOCK b1.
    SELECTION-SCREEN BEGIN OF BLOCK b2 with frame title text-002.
    SELECT-OPTIONS: s1_matnr FOR lips-matnr MODIF ID mat.
    SELECT-OPTIONS: s_extwg  FOR mara-extwg MODIF ID mat.
    SELECT-OPTIONS: s_werks  FOR marc-werks MODIF ID mat.
    SELECTION-SCREEN END OF BLOCK b2.
    If I choose Radio Button 1, only option 1 should be triggered,
    If I choose Radio Button 2, only option 2 should be triggered,
    For this I have:
    AT SELECTION-SCREEN OUTPUT.
      IF p_r1 = 'X'.
        blk_hide = 'MAT'.
        blk_show = 'DLY'.
      ELSE.
        blk_hide = 'DLY'.
        blk_show = 'MAT'.
      ENDIF.
      LOOP AT SCREEN.
        IF screen-group1 = blk_hide.
          screen-active = 0.
        ELSE.
          IF screen-group1 = blk_show.
            screen-active = 1.
          ENDIF.
        ENDIF.
        MODIFY SCREEN.
      ENDLOOP.
    Now I need to validate the selection Screen, I am facing issue in doing selection screen validation:
    Can any one help me in how to go about this?
    Thanks,
    Debrup.

    pls. replace the AT SELECTION-SCREEN OUTPUT event with this one:
    AT SELECTION-SCREEN OUTPUT.
      LOOP AT SCREEN.
        CASE 'X'.
          WHEN p_r1.
            CASE screen-group1.
              WHEN 'DLY'.
                screen-active = '1'.
              WHEN 'MAT'.
                screen-active = '0'.
            ENDCASE.
          WHEN p_r2.
            CASE screen-group1.
              WHEN 'DLY'.
                screen-active = '0'.
              WHEN 'MAT'.
                screen-active = '1'.
            ENDCASE.
        ENDCASE.
        MODIFY SCREEN.
      ENDLOOP.

  • Selection-screen validation

    Hi Experts,
          Please can any one give me the details ..
      1)What is the actual use of selection screen  validation?
    2) When we use Selection-screen validation?
    3)If we are not written the selection-screen validation is there any effect?
    I know how to write the validation for a selection screen. But why i am asking above questions is I am very new to ABAP .My Functionl people also new to ABAP. They told me one report.I asked me what are the validation for selection screen . At that time they told there is no validation.
         Thats the reason to ask above questions..
      please tell me the details..
    Thanks In Advance..
    Thanks and Regards
    Siri..

    Abhi,
    Selection Screen Validation are used for correct input processing.
    Selection screen elements are used further in select queries to fetch data. if user enters some wrong input
    we will unnecessarily hit the data base with wrong values and select will fail , hence validation of the input
    will avoid unnecessary data base hit.
    <REMOVED BY MODERATOR>
    Edited by: Alvaro Tejada Galindo on Feb 27, 2008 12:26 PM

  • Raising Exception in Selection screen validation

    Hi All,
    I am doing a selection screen validation in BI report using the CMOD. If my validation fails i need to raise a error message instead showing the report. How can i perform that. How should i handle this using abap.
    Thanks in advance
    Prem

    Hi,
    But this does not stop the execution of the report, the error message which i have given is been displayed in the report top and still the report gets executed.
    Please suggest how to stop the report execution and to stay on the same selelction screen page.
    Thanks
    Prem

  • Selection Screen Validation for Character

    Hi All
    My query is regarding the selection screen validation for character.
    I am using a Select-option: S_ORDER FOR VBAK-VBELN OBLIGATORY.
    and S_order should be only having the numeric field.
    Please help how to validate it for character field.

    Hi,
    Do as below :
    at selection-screen.
    if not s_order[] is initial.
       if s_order-low CA 'ABCDEF.............Z'.
         message 'Enter only numerics only' type 'E'.
      endif.
    "similarly for s_order-high also.
    endif.
    Thanks,
    Sriram Ponna.

  • Re selection screen validation

    Hi experts,
    In one of my report I have to put validation on selection screen. I have  4 fields defined under select-options (S_LGNUM, S_WERKS S_EXIDV2, S_EXIDV).
    Now
    When warehouse(LGNUM) and Plant(WERKS) are blank then Case# (EXIDV2) or HU#(EXIDV) become mandtory at selection screen.
    How to code for this Please help.Points sure.
    Anshu.

    Hi ,
    Please go through the sample code.
    tables: mara.
    select-options: matnr for mara-matnr,
                    mbrsh for mara-mbrsh,
                    meins for mara-meins ,
                    mtart for mara-mtart.
                    at selection-screen.
                    if matnr is initial and mbrsh is initial.
                      if meins is initial or mtart is initial.
                      message e000(0) with 'Please enter values'.
                      endif.
                    endif.
    Hope this solves the problem.
    Reward points if helpful.
    Thanks and Regards.

  • Selection screen field problem

    Hello experts..
    i have a selection screen , in that i have a field   s_bwart for mseg-bwart.
    some times the user will input the data in the field and sometimes he wont. we have fixed movement types combination like
    11-21 , 13-24 , 13-56 , 101-543 , 101-544 etc.
    if the user did not input any thing in the selection screen , i am populating s_bwart in at-selection screen event with all the mvt types. after executing the report when user presses the back button to come to the selection screen, there the s_bwart field is containing all the mvt types in single values ie in the select options screen. So the user dont want that, if he comes back nothing should be there in the selection screen field s_bwart if he has not inputted anything. if he inputs only 11 mvt type then when he comes back after executing the report he should see only 11 in the select screen field ie s_bwart. Please send the replies on how to solve the problem.

    hi,
    in ur program try to display values for users in START-OF-SELECTION event as it triggers after the selection screen displayed for users. if user doesn't give any input then display default values in this event. and also create a variable
    for ex:
    data: ws_flag type c,
             p_value type i.
    after u display default values for users in selection screen assign the flag as ' X '
    ws_flag = 'X'.
    before leaving ur program based on flag try to do like this.
    if ws_flag = ' X '.
        clear s_data. // s_data is the select options for u.
    else.
         s_data = p_value. // the value which user gave in selection screen as i/p.
    endif.
    if helpful reward some points.
    with regards,
    Suresh Aluri.

  • At selection screen output problem when a field is obligatory

    Hi All,
    I have two radiobuttons on the selection screen and when I select first radiobutton one screen should display and the other should not be displayed and vice-versa. It is working fine if I do not have a mandatory field.I am pasting my code here.Can anyone please help me how to handle this situation when we have some mandatory fields on one of these screens.
    TABLES : mara,marc.
    SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
    PARAMETERS : p_meth1 RADIOBUTTON GROUP g1 USER-COMMAND g1,
                 p_meth2 RADIOBUTTON GROUP g1.
    SELECTION-SCREEN END OF BLOCK b1.
    SELECTION-SCREEN BEGIN OF BLOCK matnr WITH FRAME TITLE text-002.
    SELECTION-SCREEN SKIP 1.
    SELECT-OPTIONS : so_matnr FOR marc-matnr MODIF ID m1 obligatory.
    SELECTION-SCREEN SKIP 1.
    SELECT-OPTIONS : so_werks FOR marc-werks MODIF ID m1 .
    SELECTION-SCREEN END OF BLOCK matnr.
    SELECTION-SCREEN BEGIN OF BLOCK file WITH FRAME TITLE text-003.
    SELECTION-SCREEN SKIP 1.
    PARAMETERS: p_fpath TYPE ibipparms-path MODIF ID m2 LOWER CASE.
    SELECTION-SCREEN END OF BLOCK file.
    SELECTION-SCREEN BEGIN OF BLOCK date WITH FRAME TITLE text-004.
    SELECTION-SCREEN SKIP 1.
    PARAMETERS : p_date TYPE datuv.
    SELECTION-SCREEN END OF BLOCK date.
    AT SELECTION-SCREEN OUTPUT.
    LOOP AT SCREEN.
    CASE screen-group1.
    WHEN 'M1'.
    IF p_meth1 = 'X'.
    screen-active = 1.
    ENDIF.
    IF p_meth2 = 'X'.
    screen-active = 0.
    ENDIF.
    WHEN 'M2'.
    IF p_meth2 = 'X'.
    screen-active = 1.
    ELSE.
    screen-active = 0.
    ENDIF.
    IF p_meth1 = 'X'.
    screen-active = 0.
    ENDIF.
    ENDCASE.
    MODIFY SCREEN.
    ENDLOOP.
    Thanks in advance
    Sandeep

    Obligatory fields with your requirement will not work, reason : The GUI checks obligatory fields before passing the control back to the program (i.e Before triggering the PAI )
    If you check for empty fields and give appropriate error message in the PAI, the program will not allow you to switch to the other radio button until you fill something in the fields because the moment you select a radiobutton, it will validate the field and issue the error message.
    So it is like a catch 22 situation.
    All you can really do is to check see which radio button is clicked and then do your processing. Also make sure to assign a user command to the radiobutton and query it in the AT SELECTION SCREEN and based on the radiobutton selected, decide which fields should be validated.
    " Additon...
    INITIALIZATION  " Default values
    p_meth1 = 'X'.
    AT SELECTION-SCREEN.  " General PAI
    if p_meth1 EQ 'X'.
    "validate fields for meth1.
    elseif p_meth2 EQ 'X'.
    " validate fields for meth2.
    endif.
    regards,
    Advait

  • Selection screen validation in HR ad hoc query

    Hi Experts,
    I have created a query in SQ01. My infoset is created using Logical database PNPCE. Selection criteria contains Fields  Personnel Number and Employment status. so when the query will be run, I want to display error message if invalid personnel number or Employment status is entered. Please let me know, How do I achieve it.
    Thanks in advane.
    Regards.

    Hi
    After declaring selection screen fields.
    select the field to handle validation and click on the button 'Check coding for
    Element' .
    you will get a block to handle the validation.

  • Selection screen validation when using PNP LDB

    Hi guys,
    I want to validate my selection screen parameters.Thats is if somebody wants to run the program without giving any input parameters to the selection screen(trying to run the report with a blank screen) I want to pop up an error/information message so that it will return the selection screen.I am using PNP Logical database for my selection screen.Please help.Thanks in advance.
    Thanks,
    Karthik.

    Welcome to SDN.
    If you are using PNP logical data base then validating the fields will be little tricky...
    You canc check all the other fields in START-OF-SELECTION and if they are empty return eroor. Remember all the field s on the scree... so I will suggest you to choose HR report Category accordingly.
    Also,when it comes to date field then you need to check for the start and end dates rather than blank fields as SAP defaulted them to system start and end date.
    Still, I will prefer to create a HE Report Category for the PNP database and use the screen while validating....that will be easy...

  • Selection-screen validations

    Hi Experts ,
    I have module pool program there in first screen user have choice to select screen if user select the first screen .The selection will be displayed with two parameters using key word
    selection-screen begin of screen 2002.
    parameters : p_date type sy-datum,
                         p_num  type kunnr.
    selection-screen end of screen 2002.
    call screen '2003'.
    now i want to do validations on these parameters ,
    please let me know how can i validate these selection-screen fields  there i try chain and endchain in screen 2003 , it says no fields in screen 2003. screen 2002 was developed dynamically by systemplease let me know  how to do validations i search it i cant find it plz solve issue .

    hi
    i think there are two methods two create selection screen
    1.  using layout here we can create selection screen with screen painter
    here we can validate using chain end endchain.
    Plz try this on
    Selection Screen
    Defined within an ABAP program; called by the runtime environment or using the CALL SELECTION-SCREEN statement; processed in event blocks of the corresponding ABAP program.
    in main screen we have 3 selections for screen 2002 ,2004, 2006.
    if sy-ucomm = 2002.
    2 .  selection-screen begin of screen 2002.
    parameters : .........
          selection-screen end of screen 2002.
    call selection-screen '2002'.
    once this was triggered after entering vales it return to the next step then
    call screen 2003.
    then it goes to PBO and PAI events.
    endif.
    if sy-ucomm = 2003.
    selection-screen begin of screen 2003.
    parameters : .........
          selection-screen end of screen 2003.
    call selection-screen '2003'.
    once this was triggered after entering vales it return to the next step then
    call screen 2004.
    then it goes to PBO and PAI events.
    endif.
    all these are done in initial screen PBO . and those are created dynamically now i want to do validations on selection-screen fields. we can;t use at selection-screen in module end end module .
    plz let me know if you know any thing more.

  • At Selection screen validation

    Hi All,
    I Have a Situation, If User does not enter any thing on seelction screen my report still displays the data based on the selection criteria, what validation can be done at seelction screen to resolve this issue.
    Regards,
    VB

    put your cursor on Selection-screen and press ABAP help...
    or, use the appropriate program event, in this case: AT SELECTION-SCREEN [for screen-name is an addition].
    If structure SSCRFIELDS-UCOMM eq 'SJOB' or 'PRIN' or 'ONLI', the user has selected an execution mode and you can enforce entry of something into your ranges tables (SELECT-OPTION creates a table of the same name).
    In cases like this, please search forum and/or utilize SAP's excellent ABAP HELP capability.

  • AT SELECTION-SCREEN validation prob

    Could you please give idea of how can I go back to selection screen if wrong mail id entered ( if possible cursor should go to the email id field where wrongly entered ?) ?
    AT SELECTION-SCREEN .
    *Emailid validation.
      IF  NOT s_mail1[] IS INITIAL.
        LOOP AT s_mail1.
    *-----If email id entered on the selection screen doesnot contain
    *'@' and '.', then give relevent message to user as popup.
          IF s_mail1-low NA '@' OR s_mail1-low NA '.'.
            MESSAGE i038(zs) WITH 'Please enter a valid email id'.
            gc_flag_mail = 'X'   .    
            EXIT.
          ENDIF.
        ENDLOOP.
        IF  gc_flag_mail = 'X'.    
        CLEAR : gc_flag_mail .
          EXIT.
        ENDIF. " IF  gc_flag_mail = gc_x.     "
    Thanks in advance

    Hi
    Refer the below threads
    Re: email id validation .
    email validation
    Regards,
    Chithra

  • Needed  selection screen validation for all entries in the range

    Hi all,
    I'm using the below code for Material validation in selection-screen.
    SELECT SINGLE MATNR FROM MARC INTO MARC-MATNR
      WHERE MATNR IN S_MATNR.
      IF sy-subrc NE 0.
        MESSAGE e000(su) WITH text-035.     "Invalid Material Number
      ENDIF.
    This validation is working only for one record in the range.
    If I give multiple material numbers in the range having a record which doesn't exist in MARC, its not throwing the error.
    Seems like loop should be placed at s_matnr. Is that correct procedure or any pointers on the same would be of great help.
    Regards,
    Vamsee Priya.

    Hi priya
    Use this way,
    REFRESH IT_LIPS. CLEAR IT_LIPS.
      SELECT VBELN
             POSNR
             MATNR
             WERKS
             LFIMG
             ARKTX
             VGBEL
             VGPOS
             BWART
             FROM LIPS INTO TABLE IT_LIPS
             WHERE PSTYV IN
       ('ZZTC', 'ZTAD', 'ZMVN', 'ZCVA', 'ZCVB', 'ZCVC') AND "ASR 18721
                   WERKS IN ('1140', '1143', '1149').
      IF IT_LIPS[] IS INITIAL.
        MESSAGE E000 WITH TEXT-005.
    endif.
    revert back if you need any help..
    Help us to help you, Manas

Maybe you are looking for

  • Soap with Attachment

    Hello, I need to develop a WebDynpro application with NetWeaver 2.0 for SAP EP6 that call a remote web service in order to send an attached file with SWA (Soap With Attachment) methodology. The kind of file to attach is XML. Can someone give me refer

  • Problems with storing photos in iphoto.

    When we import photos to iphoto it looks right and the events is updated, but when we reopen iphoto, the photos are not there and the events count is back to what it was before the import.... any suggestions to solve this, from anyone.... we have use

  • DB insertion problem

    //checkboxes req.getParameter("srvis1"); req.getParameter("srvis2"); req.getParameter("srvis3"); req.getParameter("srvis4"); req.getParameter("srvis5"); //Oracle DB Table is: co_id, co_services; Question: user may check one, two or all of them but ho

  • Skype refuses to join group call

    So, I was in a group call earlier today and suddenly the call dropped.  When I rejoined my friend said something along the line of "the peasants" or something silly like that and I was immediately kicked.  At first I thought they were messing with me

  • Software problems with my imac

    hey I got a ipod shuffle for my birthday but i am struggling with the software on my computer. I bought Panther OS X 10.3 but cannot install it - it claims my firmware is not updated, I have updated the firmware from the instructions discovered in he