Validation for selection screen

hi all,
   can anyone help me on the particular issue for adding f4 functionality based on selection criteris.i am using the code below but i am not able to get the selection.
  SELECTION-SCREEN: BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
     PARAMETERS:     P_MBLNR LIKE MKPF-MBLNR OBLIGATORY, "Customer Number
                     P_WERKS LIKE MSEG-WERKS OBLIGATORY.
  SELECTION-SCREEN:SKIP 2.
         SELECTION-SCREEN: BEGIN OF BLOCK B2 WITH FRAME TITLE TEXT-001.
            PARAMETERS:    RAD1 RADIOBUTTON GROUP RAD DEFAULT 'X',
                           RAD2 RADIOBUTTON GROUP RAD.
         SELECTION-SCREEN END OF BLOCK B2.
  SELECTION-SCREEN END OF BLOCK B1.
  AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_MBLNR.
  DATA: BEGIN OF I_MBLNR OCCURS 0,
          V_MBLNR LIKE MSEG-MBLNR,
          V_BWART LIKE MSEG-BWART,
        END OF I_MBLNR.
IF NOT P_MBLNR IS INITIAL.
   IF RAD1 = 'X'.
    SELECT SINGLE MBLNR INTO I_MBLNR-V_MBLNR FROM MSEG
            WHERE BWART = '541'.
ELSEIF RAD2 = 'X'.
    SELECT SINGLE MBLNR INTO I_MBLNR-V_MBLNR FROM MSEG
            WHERE BWART = '551'.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
   EXPORTING
    DDIC_STRUCTURE         = MSEG-MBLNR
     RETFIELD               = IT_HEADER-MBLNR
   PVALKEY                = ' '
   DYNPPROG               = ' '
   DYNPNR                 = ' '
   DYNPROFIELD            = ' '
   STEPL                  = 0
   WINDOW_TITLE           =
   VALUE                  = ' '
   VALUE_ORG              = 'C'
   MULTIPLE_CHOICE        = ' '
   DISPLAY                = ' '
   CALLBACK_PROGRAM       = ' '
   CALLBACK_FORM          = ' '
   MARK_TAB               =
IMPORTING
   USER_RESET             =
   TABLES
     VALUE_TAB              = IT_HEADER.
   FIELD_TAB              =
   RETURN_TAB             =
   DYNPFLD_MAPPING        =
EXCEPTIONS
   PARAMETER_ERROR        = 1
   NO_VALUES_FOUND        = 2
   OTHERS                 = 3
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
        WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDIF.
ENDIF.

HI NAVNEET ,
   thanks for replying actuallty i have n internal table it_header which i have used it for my program but this interna table i have used only for selection criteria. can you plz see the portion of my code which i have used for selection criteria.please find below
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_MBLNR.
  DATA: BEGIN OF I_MBLNR OCCURS 0,
          MBLNR LIKE MSEG-MBLNR,
        END OF I_MBLNR.
IF NOT ( P_MBLNR IS INITIAL ).
   refresh i_mblnr.
   clear i_mblnr.
  IF ( RAD1 = 'X' ).
     SELECT  MBLNR INTO I_MBLNR FROM MSEG
            WHERE BWART = '541'.
        ENDSELECT.
  ELSEIF ( RAD2 = 'X' ).
     SELECT MBLNR INTO I_MBLNR FROM MSEG
            WHERE BWART = '551'.
        ENDSELECT.
  ENDIF.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
   EXPORTING
   DDIC_STRUCTURE         = 'MSEG'
     RETFIELD               = 'MBLNR'
   PVALKEY                = ' '
    DYNPPROG               = SY-REPID
    DYNPNR                 = SY-DYNNR
    DYNPROFIELD            = 'P_MBLNR'
    VALUE_ORG              = 'S'
    CALLBACK_FORM          = SY-REPID
   TABLES
     VALUE_TAB              = I_MBLNR
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
        WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDIF.

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

  • How to write HTML code in Web Template for selection screen

    Hello All,
    Is it possible to write a html code in the web template html tag so that the output of the html is displayed in the selection screen, i.e before the execution of query.
    I know that we can write html, which will be displayed once the query has been executed, but can it be done for selection screen.
    if so, how.
    My exact requirement is : to display a 2-3 lines of text in the selection criteria screen - sort of, various options available to user for entering values in the selection screen.  I was thinking of putting this text using HTML code in the selection screen.
    Regards,
    Nagendra.

    Hi Erick,
    No, unfortunately nobody replied to this thread. So i assumed it is not possible to modify the selection screen thru html code.
    Btw, as my requirement was to provide user with multiple answers on the selection screen. I did the validations on customer exit and popped an errror dialog when applicable.
    Regards,
    Nagendra.

  • 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 in selection screen

    SELECT-OPTIONS AND PARAMETERS
    selection-screen begin of block a with frame title text-001.
    selection-screen begin of line.
    selection-screen comment 1(20) for field p_bl.
    parameters : p_bl    as   checkbox .
    selection-screen end of line.
    selection-screen begin of line.
    selection-screen comment 1(20) for field p_di.
    parameters : p_di    as   checkbox .
    selection-screen end of line.
    selection-screen begin of line.
    selection-screen comment 1(20) for field p_pl.
    parameters : p_pl    as   checkbox .
    selection-screen comment 25(20) for field p_plout.
    parameters : p_plout like nast-kschl.
    selection-screen end of line.
    selection-screen begin of line.
    selection-screen comment 1(20) for field p_in.
    parameters : p_in    as   checkbox .
    selection-screen comment 25(20) for field p_inout.
    parameters : p_inout like nast-kschl.
    selection-screen end of line.
    selection-screen end of block a.
    selection-screen begin of block c with frame title text-003.
    parameters: pa_email no-display ,
                pa_downl no-display.
    selection-screen end of block c.
    START-OF-SELECTION
    if p_bl eq c_x.
        perform download_bl.
      endif.
      if p_di eq c_x.
        perform download_di.
      endif.
    If Delivery Order is checked
      if p_pl eq c_x.
        perform download_packlist.
      endif.
    If Invoice , Based On The OutPut Type is checked
      if p_in eq c_x .
        perform download_invoice.
      endif.
    I using the above program.
    My question is i want validation in selection screen  for below stmts.
                      1) atleast 1 of the check box should be selected
                      2) If packing list is selected, then the message type Must be selected. (can not allow blank)
                     3) If invoice list is selected, then the message type must be selected
                     4) Validate the message type field entered.

    Hi Sen 001
    It depends how you want to validate. If you want to validate immediately after the user put a check box or enter value then you shoul use <AT SELECTION SCREEN> event and <USER-COMMAND> following your parameters (or select-options) in your selection screen. You can also validate when user presses F8, where you should put your validation inside <START-OF-SELECTION> event.
    Example to immediate validate after check box entered
    SELECTION-SCREEN: BEGIN OF BLOCK b02 WITH FRAME.
    PARAMETERS: p_grp RADIOBUTTON GROUP gr1 DEFAULT 'X' USER-COMMAND zcomm,
                p_dst RADIOBUTTON GROUP gr1.
    SELECTION-SCREEN: END   OF BLOCK b02.
    AT SELECTION-SCREEN.
      IF sy-ucomm(6) = 'ZCOMM'.
        PERFORM xxx.
      ELSE.
        PERFORM yyy.
      ENDIF.

  • Code for selection screen,  urgent

    Hi Everyone,
      I need code for selection screen.
      I have four radio buttons, p1, p2,p3,p4(assume)
    If I select second radiobutton, remaining three radiobuttons should be in disable mode and also the information under them should be in disable mode. Give the coding details. Thanks in advance. U will be rewarded.
    Regards,
    Nagaraju

    Hi,
    REPORT ZTEST222 .
    PARAMETERS : p_add  RADIOBUTTON GROUP radi
                             USER-COMMAND radio MODIF ID MOD,
      p_disp RADIOBUTTON GROUP radi DEFAULT 'X'  MODIF ID pod,
      p_chng RADIOBUTTON GROUP radi MODIF ID rad,
      p_er_log RADIOBUTTON GROUP radi MODIF ID cod.
    SELECT-OPTIONS : s_idn    FOR  vendor   MODIF ID mod,
                                   s_pcode  FOR ws_c_pcode MODIF ID pod.
    PARAMETERS:  p_plant    LIKE  zaw_pol_plan-plant   MODIF ID rad,
                 p_zzvend   LIKE  zaw_pol_plan-zzvendor   MODIF ID cod.
    AT SELECTION-SCREEN OUTPUT.
    LOOP AT SCREEN.
    IF p_add EQ 'X'.
          IF screen-group1 EQ 'MOD'.
            screen-active = 1.
            MODIFY SCREEN.
    ELSE.
             screen-active = 0.
            MODIFY SCREEN.
    ENDIF.
    IF p_disp EQ 'X'.
          IF screen-group1 EQ 'POD'.
            screen-active = 1.
            MODIFY SCREEN.
    ELSE.
             screen-active = 0.
            MODIFY SCREEN.
    ENDIF.
    IF p_chng EQ 'X'.
          IF screen-group1 EQ 'RAD'.
            screen-active = 1.
            MODIFY SCREEN.
    ELSE.
             screen-active = 0.
            MODIFY SCREEN.
    ENDIF.
    IF p_er_log EQ 'X'.
          IF screen-group1 EQ 'COD'.
            screen-active = 1.
            MODIFY SCREEN.
    ELSE.
             screen-active = 0.
            MODIFY SCREEN.
    ENDIF.
    Pls. reward if useful
        ENDLOOP.
    Pls. reward if useful

  • Validations at selection-screen

    hi ,
    how to do validations at selection-screen?
    with regards
    always learner
    points will be rewarded if useful

    Hi Buddy
      Its good to learn alwasys . Here are some progarms which are useful in selection- screen.
    Dont forget to reward points.
    at selection-screen.
    select LIFNR
           from LFB1
           into table
           where lifnr in s_lifnr.
    if sy-subrc ne 0.
    message e888(sabapdocu) with 'no number found'.
    endif.
    in this way u can write the select query.
    selection-screen begin of block b1.
    parameters: p_datum1 type sy-datum,
    p_datum2 type sy-datum.
    selection-screen end of block b1.
    at selection-screen on block b1.
    if p_datum1 is initial
    and p_datum2 is initial.
    message e001(00) with 'Enter at least one date'.
    endif.
    PARAMETERS: TEST1(10) MODIF ID SC1,
                TEST2(10) MODIF ID SC2,
                TEST3(10) MODIF ID SC1,
                TEST4(10) MODIF ID SC2.
    AT SELECTION-SCREEN OUTPUT.
    LOOP AT SCREEN.
      IF SCREEN-GROUP1 = 'SC1'.
        SCREEN-INTENSIFIED = '1'.
        MODIFY SCREEN.
        CONTINUE.
      ENDIF.
      IF SCREEN-GROUP1 = 'SC2'.
        SCREEN-INTENSIFIED = '0'.
        MODIFY SCREEN.
      ENDIF.
    ENDLOOP.
    SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME.
      PARAMETERS: R1 RADIOBUTTON GROUP RAD1 DEFAULT 'X',
                  R2 RADIOBUTTON GROUP RAD1,
                  R3 RADIOBUTTON GROUP RAD1.
    SELECTION-SCREEN END OF BLOCK B1.
    SELECTION-SCREEN BEGIN OF BLOCK B2 WITH FRAME.
      PARAMETERS: R4 RADIOBUTTON GROUP RAD2 DEFAULT 'X',
                  R5 RADIOBUTTON GROUP RAD2,
                  R6 RADIOBUTTON GROUP RAD2.
    SELECTION-SCREEN END OF BLOCK B2.
    AT SELECTION-SCREEN ON RADIOBUTTON GROUP RAD1.
      IF R1 = 'X'.
        MESSAGE W040(HB).
      ENDIF.
    AT SELECTION-SCREEN ON RADIOBUTTON GROUP RAD2.
      IF R4 = 'X'.
        MESSAGE W040(HB).
      ENDIF.

  • Change default value (200) of Max No of Hits for selection screen in WAD

    How do i change the default value of Maximum Number of Hits from 200 to 1000 for selection screen's find box in Web Application Designer .
    Thanks in Advance
    Points will be surely Rewarded

    Dear Hammad,
    Please refer to the wiki created by me,
    http://wiki.sdn.sap.com/wiki/display/BI/Information+on+the+user+setting+for+the+selector+dialog
    Regards,
    Arvind

  • How to set default variant for selection screen

    Hi,
    I want to make one variant as default for selection screen for one user.
    For eg., take COOIS. For the selection screen, i have 3 variants. But i want one variant to be default. Thsi is not for all users. Thsi is for particular user.
    I am not seeing any way to do this. please help me..
    Thanks
    Srini

    Hi,
    If you are using Z program then you can ask your developer to get Variant name Runtime from Parameter ID.
    This means you decide a Parameter ID name : ZVAR in your Z program and ask your developer to load variant each time your Z program loads.
    Now, second step will be using SU01 transaction you can set value of ZVAR in Parameters tab for the user. This value will be the variant which you created for this user.
    This will solve your problem and you can make n number of variants and assign it to different users.
    Regards,
    Arpit

  • Dinamic variant for selection screen

    Hi,
    I got a requirement where i need  a Dynamic variant for selection screen .There is a date field in the selection screen i want to create  a variant such that when i choose it,it should give the current day date in selection screen.can anyone help me.
    Regards,
    Ravi

    Hi,
    Using Customer Exit code you can give it.
    Create a Customer Exit Variable and write simple code in CMOD. See the usefull Exit code for reports in the following url.
    https://wiki.sdn.sap.com/wiki/display/profile/Surendra+Reddy
    WHEN 'ZV_DAT'.
        IF i_step = 1 .
          CLEAR l_s_range.
          l_s_range-low = sy-datum.
          l_s_range-opt = 'EQ'.
          l_s_range-sign = 'I'.
          APPEND l_s_range TO e_t_range.
        ENDIF.
    Thanks
    Reddy

  • Transaction Variant for Selection Screen

    Hi, experts!
    A question regarding transaction variants: Is it possible to create screen variants and transaction variants via SHD0 for selection screens? I' ve created a customer report with one selection screen including parameters and select options and would like to provide the users with a variant transaction for this.
    Utilizing the "Save as variant" option from the selection screen itself works out perfectly, but this variant cannot be transported. And trying to create a transaction variant via SHD0 fails because values entered in the selection screen parameters and select options help screens are not saved and presented.
    Any hints are more than welcome!
    Regards,
    Thomas

    You wrote
    Utilizing the "Save as variant" option from the selection screen itself works out perfectly, but this variant cannot be transported.
    But, give the variant a name beginning with "CUS&" and this variant will be transported. Variant beginning with "CUS&" or "SAP&" are so-called "system variant" and are  transported automatically. You can then copy the transaction code and use this new variant in the new transaction.
    Regards,
    Raymond

  • Global Variable for selection screen variable

    Hi All,
    We need to create a report where calendar day has to be included in the selection screen.Later after executing the report we should be able to retrieve the selection screen input for calendar day and modify it and use the modified one for other calculations.Can somebody help me out in finding the global variable in the variable exit where we find all the inputs for selection screen variables....
    Regards,
    Shravani

    shravani,
    I_vnam will store the varaible names...if you have varaible in the query...
    please use this code for ur help...
    DATA: ww_der_date LIKE sy-datum,
            wzdate LIKE sy-datum,
            wzact_gi_dte TYPE /bi0/oiact_gi_dte.
      wzact_gi_dte = sy-datum.
      IF i_step = 2.
        READ TABLE i_t_var_range INTO wa_i_t_var_range WITH KEY vnam =
        'ZNODAYS'.
        ww_der_date = sy-datum - wa_i_t_var_range-low.
            CLEAR wa_i_t_var_range.
        IF i_vnam = 'ZVAGIDCUSTEXIT'.
          CLEAR l_s_range.
          l_s_range-low    =  ww_der_date .
          l_s_range-high   =  wzact_gi_dte.
          l_s_range-sign   = 'I'.
          l_s_range-opt    = 'BT'.
          APPEND l_s_range TO e_t_range.
          CLEAR l_s_range.
        ENDIF.
      ENDIF.
    in this case user will enter no.of days in ZNODAYS and that being is used in calculation and used in the next varaible....

  • Default value for selection screen field

    Hi all,
      I am using LDB PNPCE. I want to give default value for field Personnel area on selection screen.
    How can I do it?
    Thanks
    Rahul

    Hi Rahul,
    In the INITIALIZATION event we can set the default values for selection screen fields.
    INITIALIZATION.
    loop at screen.
    if screen-name = 'S_MATNR-LOW'.
    CLEAR S_MATNR.
    s_matnr-low = '1234'.
    s_matnr-option = 'EQ'.
    s_matnr-sign = 'I'.
    append s_matnr.
    CLEAR S_MATNR.
    s_matnr-high = '5678'.
    s_matnr-option = 'EQ'.
    s_matnr-sign = 'I'.
    append s_matnr
    clear s_matnr.
    endif.
    endloop.
    Hope it helps.
    Mark if useful
    Regards,
    Saumya

  • How to create variant for selection screen which is in subscreen

    Hi,
    How to create variant for selection screen which is in subscreen in a module pool program?
    it is very urgent.
    Thanks in advance.

    Hi,
    You can create the 'Parameter Transaction' so that whenever you run the particular transaction it will run with the initial value given when the Tcode was created and hence you can skip the initial screen of the module pool program.
    To create Parameter transaction from SE93 you have to choose the last option i.e Parameter Transaction.
    Regards
    Sudheer

  • Code for i_step = 2 in user exit ZXRSRU01 for selection screen validation

    Hello Experts,
    I have BI report, in which on selection screen I have 4 formula variable.
    I want to check, what number user has entered in these variables and summation of these fields should not be getter than 100 or less than 100. It should be 100 only. If that summation is not 100 then, I have to display message and again go back to selection screen so that user will make the correction.
    I came to know that for this I have to write a code in user exit ZXRSRU01, when  i_step = 2. I have written the code but it's not working. I have declare one more variable which is not ready for input and which I am checking in the code.
    Can anyone help me out in this regards.
    Thanks
    Chetan

    Hi
    Have you gone through the proper steps for creating and activating the enhancement?
    You can find more detailed documentation in the[ SAP Help|http://help.sap.com/saphelp_nw70/helpdata/en/f1/0a56f5e09411d2acb90000e829fbfe/frameset.htm].
    Regards

Maybe you are looking for