Validating a selection-screen field

Hi all,
I am Anil.can any body explains me how to validate a selection-screen field for the following scenario?
I have customer nos ranging from 100-1000.among them i dont have any sales orders for the customers who are in between 150-250.I have sales order(VBELN) as select-options and Plant(WERKS) as Parameter on the selection-screen.I want to validate these fields without hardcaode.How can i do that?Please send me the complete code.
I am not getting how to validate a field  which is declared as parameter?
regards and thanks in advance.
Anil.

Make sure that u are validating against the header table.
say eg if u wnat t validate matnr in marc, then do as below.
SELECT-OPTIONS: s_matnr FOR  marc-matnr.                  "Material No
AT SELECTION-SCREEN.
*Validate material no details
  PERFORM validate_matno.
FORM validate_matno.
DATA: v_matnr LIEK mara-matnr.
  SELECT SINGLE matnr INTO v_matnr
         FROM <b>mara</b>
         WHERE matnr IN s_matnr.
  IF sy-subrc NE 0.
    MESSAGE i128.
    LEAVE LIST-PROCESSING.
  ENDIF.
ENDFORM.
Dont select from marc.
Hope this is clear.

Similar Messages

  • Selection screen fields are not getting detected in an infoset in code

    Hi All,
    I am developing an infoset query using logical database 'PNPCE'. I am facing problem while writing a validation on selection screen fields on an infoset query at infoset code level.
    The fields that are under program specific selection are determined at runtime with variables viz. SP$00001, SP$00002 etc. There are actually select options on selection screen of an infoset query.
    So I cannot write a direct  code on these fields as they do not exist at infoset level and hence cannot be detected.
    I want to put down a validation that if user does not select anything on selection-screen and executes the query, then he should get a pop-up message 'Narrow down your search...' and he should go back to selection screen again.
    Is there any alternative way to achieve this?

    hi,
    Your Screen resolution is more in the system that's why while creating it was fine and while executing it was gone after the next field.
    so you better create a frame and place that inside it or you can change cols size  in the properties about the columns you want

  • Selection-screen fields validation for dialog

    Hello ABAP Gurus
    Requirements: this is a report wherein , depending upon the correct select-options , user will pick some field values from table and some will be entered by the user in the next se51 custom screen for creation of a record in a ztable .
    the problem is :without validating select-options values , it calls the se51 screen 100.
    How to keep the cursor at the selection-screen field until & unless user enters the correct i/p s .if i/p are correct then only it should call screen 100 otherwise remain in the selection screen only .
    *& Report ZSD_REP_QUOT_BANK_CREATE *
    REPORT ZSD_REP_QUOT_BANK_CREATE NO STANDARD PAGE HEADING LINE-SIZE 255.
    TABLES: VBAK,VBAP,VBRK,ZSD_TABL_QOTBANK,MARA,KONV.
    DATA: OK_CODE LIKE SY-UCOMM,
    SAVE_OK_CODE LIKE SY-UCOMM,
    WA_ITAB LIKE ZSD_TABL_QOTBANK,
    ANSWER TYPE C,
    COPIED ,
    STS TYPE N,
    EMGRP LIKE MARA-EXTWG,
    QTY LIKE ZSD_TABL_QOTBANK-QTY,
    UPRICE LIKE ZSD_TABL_QOTBANK-UPRICE,
    TOT LIKE ZSD_TABL_QOTBANK-TOT,
    INO LIKE VBAP-POSNR.
    SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-000.
    SELECT-OPTIONS: S_QTNO FOR ZSD_TABL_QOTBANK-QTNO
    NO INTERVALS NO-EXTENSION OBLIGATORY,
    S_ITNO FOR ZSD_TABL_QOTBANK-ITNO
    NO INTERVALS NO-EXTENSION OBLIGATORY.
    S_MATNO FOR ZSD_TABL_QOTBANK-MATNO
    NO INTERVALS NO-EXTENSION. "
    SELECTION-SCREEN END OF BLOCK b1.
    AT SELECTION-SCREEN.
    SELECT SINGLE VBTYP
    INTO VBAK-VBTYP
    FROM VBAK
    WHERE VBELN IN S_QTNO.
    IF SY-SUBRC EQ 0 AND VBAK-VBTYP NE 'B'.
    MESSAGE I005(ZQOTBANK).
    SET CURSOR FIELD S_QTNO-LOW.
    SUBMIT (SY-REPID) VIA SELECTION-SCREEN.
    ENDIF.
    CLEAR WA_ITAB.
    SELECT SINGLE QTNO ITNO
    INTO WA_ITAB
    FROM ZSD_TABL_QOTBANK
    WHERE QTNO IN S_QTNO
    AND ITNO IN S_ITNO.
    IF SY-SUBRC EQ 0.
    MESSAGE I001(ZQOTBANK).
    SET CURSOR FIELD S_QTNO-LOW.
    SET CURSOR FIELD S_ITNO-LOW.
    SUBMIT (SY-REPID) VIA SELECTION-SCREEN.
    ENDIF.
    *START-OF-SELECTION.
    END-OF-SELECTION.
    CALL SCREEN 0100.
    *& Module STATUS_0100 OUTPUT
    text
    MODULE STATUS_0100 OUTPUT.
    SET PF-STATUS '0100'.
    SET TITLEBAR '0100'.
    ZSD_TABL_QOTBANK-QTNO = S_QTNO-LOW.
    SELECT SINGLE BUKRS_VF VKORG VTWEG SPART KUNNR ERDAT BNDDT
    KNUMV
    INTO (ZSD_TABL_QOTBANK-CCODE,
    ZSD_TABL_QOTBANK-SORG,
    ZSD_TABL_QOTBANK-DISTCHAN,
    ZSD_TABL_QOTBANK-DIV,
    ZSD_TABL_QOTBANK-CUSTNO,
    ZSD_TABL_QOTBANK-QTDAT,
    ZSD_TABL_QOTBANK-QTVALDAT,
    VBAK-KNUMV)
    FROM VBAK
    WHERE VBELN IN S_QTNO
    AND VBTYP = 'B'.
    IF SY-SUBRC EQ 0.
    SELECT SINGLE KWMENG POSNR MATNR
    INTO (QTY , INO , ZSD_TABL_QOTBANK-MATNO)
    FROM VBAP
    WHERE VBELN IN S_QTNO.
    SELECT SINGLE EXTWG
    INTO EMGRP
    FROM MARA
    WHERE MATNR EQ ZSD_TABL_QOTBANK-MATNO.
    ZSD_TABL_QOTBANK-ITNO = INO.
    ZSD_TABL_QOTBANK-EMATGRP = EMGRP.
    ZSD_TABL_QOTBANK-QTY = QTY.
    SELECT SINGLE KBETR
    INTO UPRICE
    FROM KONV
    WHERE KNUMV = VBAK-KNUMV
    AND KPOSN = INO
    AND KSCHL = 'PR00'.
    ENDIF.
    ZSD_TABL_QOTBANK-UPRICE = UPRICE.
    TOT = QTY * UPRICE .
    ZSD_TABL_QOTBANK-TOT = TOT .
    CLEAR: QTY, UPRICE, TOT.
    QTY = ZSD_TABL_QOTBANK-CGL_QTY.
    UPRICE = ZSD_TABL_QOTBANK-CGL_UPRICE .
    TOT = QTY * UPRICE .
    ZSD_TABL_QOTBANK-CGL_TOT = TOT .
    CLEAR: QTY, UPRICE, TOT.
    QTY = ZSD_TABL_QOTBANK-BHEL_QTY.
    UPRICE = ZSD_TABL_QOTBANK-BHEL_UPRICE .
    TOT = QTY * UPRICE .
    ZSD_TABL_QOTBANK-BHEL_TOT = TOT .
    CLEAR: QTY, UPRICE, TOT.
    QTY = ZSD_TABL_QOTBANK-BHEL_QTY.
    UPRICE = ZSD_TABL_QOTBANK-BHEL_UPRICE .
    TOT = QTY * UPRICE .
    ZSD_TABL_QOTBANK-BHEL_TOT = TOT .
    CLEAR: QTY, UPRICE, TOT.
    QTY = ZSD_TABL_QOTBANK-ALSTOM_QTY.
    UPRICE = ZSD_TABL_QOTBANK-ALSTOM_UPRICE .
    TOT = QTY * UPRICE .
    ZSD_TABL_QOTBANK-ALSTOM_TOT = TOT .
    CLEAR: QTY, UPRICE, TOT.
    QTY = ZSD_TABL_QOTBANK-SIEMENS_QTY.
    UPRICE = ZSD_TABL_QOTBANK-SIEMENS_UPRICE .
    TOT = QTY * UPRICE .
    ZSD_TABL_QOTBANK-SIEMENS_TOT = TOT .
    CLEAR: QTY, UPRICE, TOT.
    QTY = ZSD_TABL_QOTBANK-TELK_QTY.
    UPRICE = ZSD_TABL_QOTBANK-TELK_UPRICE .
    TOT = QTY * UPRICE .
    ZSD_TABL_QOTBANK-TELK_TOT = TOT .
    CLEAR: QTY, UPRICE, TOT.
    QTY = ZSD_TABL_QOTBANK-OTH_QTY.
    UPRICE = ZSD_TABL_QOTBANK-OTH_UPRICE .
    TOT = QTY * UPRICE .
    ZSD_TABL_QOTBANK-OTH_TOT = TOT .
    CLEAR: QTY, UPRICE, TOT.
    ENDMODULE. " STATUS_0100 OUTPUT
    *& Module USER_COMMAND_0100 INPUT
    text
    MODULE USER_COMMAND_0100 INPUT.
    CASE OK_CODE.
    WHEN 'SAVE'.
    INSERT ZSD_TABL_QOTBANK.
    IF SY-SUBRC EQ 0.
    MESSAGE I000(ZQOTBANK).
    COMMIT WORK.
    CALL SELECTION-SCREEN 1000.
    ELSE.
    MESSAGE E001(ZQOTBANK).
    CALL SELECTION-SCREEN 1000.
    ENDIF.
    ENDCASE.
    ENDMODULE. " USER_COMMAND_0100 INPUT
    *& Module EXIT_COMMAND INPUT
    text
    MODULE EXIT_COMAND INPUT.
    SAVE_OK_CODE = OK_CODE.
    CLEAR OK_CODE.
    CASE SAVE_OK_CODE.
    WHEN 'CANCEL'.
    CALL FUNCTION 'POPUP_TO_CONFIRM'
    EXPORTING
    TITLEBAR = 'Quotation Bank Entry'
    TEXT_QUESTION = 'Do you want to Cancel ?'
    TEXT_BUTTON_1 = 'Yes'
    TEXT_BUTTON_2 = 'No'
    DEFAULT_BUTTON = '2'
    IMPORTING
    ANSWER = ANSWER.
    IF ANSWER = '1'.
    LEAVE PROGRAM.
    ELSE.
    CALL SELECTION-SCREEN 1000.
    ENDIF.
    WHEN 'EXIT'.
    CALL FUNCTION 'POPUP_TO_CONFIRM'
    EXPORTING
    TITLEBAR = 'Quotation Bank Entry'
    TEXT_QUESTION = 'Do you want to Exit ?'
    TEXT_BUTTON_1 = 'Yes'
    TEXT_BUTTON_2 = 'No'
    DEFAULT_BUTTON = '2'
    IMPORTING
    ANSWER = ANSWER.
    IF ANSWER = '1'.
    LEAVE PROGRAM.
    ELSE.
    CALL SELECTION-SCREEN 1000.
    ENDIF.
    ENDCASE.
    ENDMODULE. " EXIT_COMMAND INPUT
    Thnx in Advance

    Put the statement
    CALL SCREEN 100
    in the event <b>AT SELECTION-SCREEN</b> and NOT in <b>END-OF-SELECTION</b>.
    Regards,
    Subramanian V.

  • Validations on the screen fields in a module pool program

    Hi all
    i am creating a sales order against a purchase order ,i am selecting a PO click on a button to call another screen which has all the mandatory fields of the SO i want validations on the screen fields or the input fields as when i enter the header data and the items data and the partner data from the input serach help that is already enabled on the screen fields ,if there is any mismatch among the fileds and an error message is displayed for example:-" material no 100-100 does not exist for  sales area" then only that field where this message is present should be field enabled and the rest of the fields should be field disabled.
    also the error message i m displaying is in short text form and not in long text i clicked on it (long text) however how to use it was not known to me .
    thanks
    varun
    Moderator message: please do more research before asking, try solving problems yourself first, look for previous discussions of similar issues, post texts in more readable format, you have been warned several times before.
    Edited by: Thomas Zloch on Feb 7, 2012

    i want to have input search help as if i select sales document type then corresponding sales organizations should appear
    This would be quite opposite of what h_vakz does. h_vakz gives Sales document based on Sales org..and you want vice versa. Create a simple SH with
    selection method : TVAKZ
    AUART as importing only
    VKORG as exporting only. So when you enter an AUART you get all VKORG it is defined in. I'm not aware of a standard search help which matches the requirement. If anybody does please help me.
    i have header data (only mandatory fields),items data,partner data(all mandatory fields)
    and when i select all the header data the search help that is on the material number and partners role and number should appear corresponding to that header data
    You will have to be more specific sir..
    not able to apply please guide someone
    As for that just mention them in SCREEN->ELEMENT LIST->REFERENCES

  • Validating a selection screen filed

    Hi Experts,
    I need to to validate a selection screen field .The field is mentioned as selection parameter and it is obligatory.
    To validate this i have written the logic as follows:
    AT SELECTON SCREEN ON <FIELD-NAME>.
    SELECT STATEMENT.
    IF SY-SUBRC NE 0.
    ERROR MESSAGE.
    endif.
    But here my question is select-options acts like an intenal table,Inthis case do we need to loop to the select-options fields or else do we have any other alternative solution.
    Edited by: vinay raj on Aug 31, 2010 10:51 AM

    Hi,
    Looping is not required for this validation.  And as you have said select statement using IN oerator does not throw any error message if the value is not present in select-options.
    AT SELECTON SCREEN ON <FIELD-NAME>.
    SELECT STATEMENT .... where field in s_field.
    IF SY-SUBRC NE 0.
    ERROR MESSAGE.
    endif.
    But if you want to check whether the value entered in select-options is invalid then you can refer the below sample code
    which can be used to check for the validity of the value  of valuation class entered in the selection screen where valuation class is used as select-options. In the below code table T025 has all the values of valuation class. If the entered value does not exist in this then it indicates that the value entered in selection screen is invalid. 
    AT SELECTON SCREEN ON <FIELD-NAME>.
    PERFORM check_valuation_class.
    FORM check_valuation_class.
      DATA : lv_bklas TYPE bklas.
      IF NOT p_bklas-low IS INITIAL.
        SELECT SINGLE COUNT(*) FROM t025
        INTO (lv_bklas) WHERE bklas EQ p_bklas-low.
        IF sy-subrc NE 0.
          MESSAGE e021(zfm001).
        ENDIF.
      ENDIF.
      IF NOT p_bklas-high IS INITIAL.
        SELECT SINGLE COUNT(*) FROM t025
        INTO (lv_bklas) WHERE bklas EQ p_bklas-high.
        IF sy-subrc NE 0.
          MESSAGE e021(zfm001).
        ENDIF.
      ENDIF.
    ENDFORM.                    " check_valuation_class

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

  • Truncation of selection screen field in reports

    Hi,
    Is there any way to avoid truncation of selection screen fields in ABAP reports? For eg, I declare:
    SELECT-OPTIONS: s_test FOR ztest-test_field NO INTERVALS
    The length of this field in the table is 30 chars. However, on displaying the field via selection screen, this gets truncated to around 18 or so. How do I avoid this as I need to display the full length of the field?

    Hi,
    Try this
    Tables : makt.
    select-options maknr for makt-maktx.
    now go to the screen painter of your program in change mode and move the Help buttons first to the Right each. now increasethe length of the Matnr Field length so that they are equal to 40 Char. in your program you have handle the length now if you want to restrict to 18 otherwise it will be ok
    if they don't fit you need incease the Size of the Screen Visible area both in the Screen Painter as well as in the
    Screen Attributes
    You also get an Information Message just ignore that.
    Just open your program in SE80 if you can't go to the screen painter in SE38. the other way just keep this program in Display mode and execute then take F1 help , take Technical Information and double click on the Screen number now go to the Screen Layout and go to Change mode here.
    Regards,
    Shirisha

  • Regarding Search help on selection-screen field

    Hi there,
    I am working on custom tables.
    I have a requirement to maintain search pattern on a selection-screen field.
    selection-screen parameter: p_name which is company name filed from Z table.
    By giving a string like Holl* and by  pressing F4 on the field p_name it has to popup a dialogbox having list of company names starting with Holl.
    Thanks in advance.
    -Tulasi

    Hi
    Go through the link given below :
    How to create a search help for my own fields in selection screen
    F4 search help on report selection screen
    also try :
    CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
    EXPORTING
    DDIC_STRUCTURE = ' '
    RETFIELD = 'VKORG'
    PVALKEY = ' '
    DYNPPROG = SY-REPID
    DYNPNR = SY-DYNNR
    DYNPROFIELD = 'P_VKORG'
    STEPL = 0
    WINDOW_TITLE =
    VALUE = ' '
    VALUE_ORG = 'C'
    TABLES
    VALUE_TAB = T_TABLE1
    FIELD_TAB = field_tab
    RETURN_TAB = RET_TAB
    DYNPFLD_MAPPING = DYN_TAB
    EXCEPTIONS
    PARAMETER_ERROR = 1
    NO_VALUES_FOUND = 2
    OTHERS = 3
    With Regards
    Nikunj shah

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

  • Regarding Selection-Screen Field Display

    Hi All,
    I have issues with Selection-Screen field display.
    The Actual issue is i had declared a selection screen field as: <b>s_exgen FOR embk-exgen</b>.
    <b>EMBK-EXGEN</b> is actually <b>20</b> Char length field.
    But in output display it is being shown as <b>18</b> Char field though i can type in all <b>20</b> characters.
    But <b>display</b> restricted to <b>18</b> Characters only.
    Can anybody give me the solution for the same!
    Thanks in advance.
    Thanks & Regards,
    Prasad.

    Hi,
    You can decrease the visible length of the field but you can not increase more than database field length. check SAP help on this :
    select-options: s_exgen FOR embk-exgen VISIBLE LENGTH 5.
    ... VISIBLE LENGTH vlen
    Effect
    This addition allows you to shorten the visible length of the corresponding screen field on the selection screen to vlen.
    Variant 2
    SELECT-OPTIONS sel FOR (f).
    Additions as in variant 1.
    Effect
    In this variant, (f) must be a field containing the name of the actual reference field at runtime. The system creates the LOW and HIGH fields as character fields with length 45. However, their appearance on the selection <b>screen is inherited from the reference field whose name is contained in field f at runtime.</b>
    Regards
    Appana

  • Selection screen fields

    Hi,
    I want to group the selection screen fields. where should i group.
    I want to group using the modif Id
    T Y P E S
    TYPES:
    BEGIN OF TYVBAK,
    VBELN TYPE VBAK-VBELN,
    AUART TYPE VBAK-AUART,
    AUDAT TYPE VBAK-AUDAT,
    KUNNR TYPE VBAK-KUNNR,
    NETWR TYPE VBAK-NETWR,
    END OF TYVBAK.
    D A T A      D E C L A R A T I O N S
    DATA:
    STVBAK TYPE TYVBAK,
    ITVBAK TYPE TABLE OF TYVBAK.
    S E L E C T I O N    S C R E E N
    SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
    SELECT-OPTIONS:
    SKUNNR FOR STVBAK-KUNNR.
    SELECTION-SCREEN END OF BLOCK B1.
    SELECTION-SCREEN BEGIN OF BLOCK B2 WITH FRAME TITLE TEXT-002.
    SELECT-OPTIONS:
    SVBELN FOR STVBAK-VBELN,
    SAUDAT FOR STVBAK-AUDAT.
    SELECTION-SCREEN END OF BLOCK B2.
    I N I T I A L I Z A T I O N
    *INITIALIZATION.
    FILLING SELECT OPTIONS WITH DEFAULTS
    SKUNNR-SIGN = 'I'.
    SKUNNR-OPTION = 'BT'.
    SKUNNR-LOW    = '1'.
    SKUNNR-HIGH   = '4000000'.
    APPEND SKUNNR.
    T O P   O F  P A G E
    TOP-OF-PAGE.
    WRITE:/1'SALES DOC',12 'DOC TYPE',20 'SALES DATE',32 'NETWORTH',60 'CUSTOMER'.
    *A T   S E L E C T I O N    S C R E E N    O U T P U T .
    AT SELECTION-SCREEN OUTPUT.
    LOOP AT SCREEN.
    IF SCREEN-NAME = 'SVBELN-LOW'.
    SCREEN-INPUT = 0.
    MODIFY SCREEN.
    ENDIF.
    IF SCREEN-NAME = 'SVBELN-HIGH'.
    SCREEN-INPUT = 0.
    MODIFY SCREEN.
    ENDIF.
    ENDLOOP.
    where should i group SBVELN and SAUDAT

    Hi
    Instead of SCREEN-NAME use SCREEN-GROUP1 and for your select options give MODIF ID.
    As follows
    SELECTION-OPTIONS: selcrt for dobj MODIF ID MOD1.
    AT SELECTION-SCREEN OUTPUT.
    LOOP AT SCREEN.
    CHECK SCREEN-GROUP1 = 'MOD1.
    SCREEN-REQUIRED = 1.
    MODIFY SCREEN.
    ENDLOOP.
    This is COZ when you use select-options you get TWO fileds on the INPUT screen LOW and HIGH so you have to check for selcrit-low and selctri-high you can avoid all this my assigning a MODIF ID.
    See this sample programs for this
    SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
    PARAMETERS: pa_file TYPE rlgrap-filename MODIF ID abc,
    pa_lifnr TYPE lfa1-lifnr MODIF ID abc,
    pa_vkorg TYPE vbak-vkorg MODIF ID abc.
    SELECTION-SCREEN END OF BLOCK b1.
    SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE text-002.
    PARAMETERS: pa_kunnr TYPE vbak-kunnr MODIF ID def.
    SELECT-OPTIONS: s_lifnr FOR gs_lfa1-lifnr MODIF ID def,
    s_date FOR gs_lfa1-erdat MODIF ID def,
    s_augru FOR gs_vbak-augru MODIF ID def,
    s_vbeln FOR gs_vbak-vbeln MODIF ID def.
    SELECTION-SCREEN END OF BLOCK b2.
    SELECTION-SCREEN BEGIN OF BLOCK b3 WITH FRAME TITLE text-003.
    SELECTION-SCREEN BEGIN OF LINE.
    PARAMETERS: pa_upd RADIOBUTTON GROUP g1 USER-COMMAND uc01 DEFAULT 'X'."#EC *
    SELECTION-SCREEN COMMENT 3(60) text-004 FOR FIELD pa_upd.
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN BEGIN OF LINE.
    PARAMETERS: pa_rep RADIOBUTTON GROUP g1 ."#EC *
    SELECTION-SCREEN COMMENT 3(60) text-005 FOR FIELD pa_rep.
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN END OF BLOCK b3.
    IF pa_rep EQ gc_x.
    LOOP AT SCREEN.
    IF screen-group1 = gc_abc.
    screen-input = gc_zero_num.
    ELSEIF screen-group1 = gc_def.
    screen-active = gc_one_num.
    ENDIF.
    MODIFY SCREEN.
    ENDLOOP.
    ELSEIF pa_upd EQ gc_x.
    *For Reprocessing
    LOOP AT SCREEN.
    IF screen-group1 = gc_def.
    screen-input = gc_zero_num.
    ELSEIF screen-group1 = gc_abc.
    screen-active = gc_one_num.
    ENDIF.
    MODIFY SCREEN.
    CLEAR pa_upd.
    ENDLOOP.
    ENDIF.
    REPORT zrich_001.
    PARAMETERS: p_rad1 RADIOBUTTON GROUP grp1 DEFAULT 'X'
    user-command chk,
    p_rad2 RADIOBUTTON GROUP grp1.
    SELECT-OPTIONS: s_datum1 FOR sy-datum MODIF ID d1,
    s_datum2 FOR sy-datum MODIF ID d2.
    AT SELECTION-SCREEN OUTPUT.
    LOOP AT SCREEN.
    IF p_rad1 = 'X'
    AND screen-group1 = 'D2'.
    screen-active = '0'.
    ENDIF.
    IF p_rad2 = 'X'
    AND screen-group1 = 'D1'.
    screen-active = '0'.
    ENDIF.
    MODIFY SCREEN.
    ENDLOOP

  • 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 schedule the background job using current selection screen field val

    Hello Friends,
    How to schedule the background job using current selection screen field values.
    after completion of the job the spool should be sent as a mail to SAP Inbox.
    Is there any way to create the variant dynamically by reading the current selection screen values.
    Thanks,
    Ravi

    Hi,
    To get the variant details you can use teh following FM.
    'RS_VARIANT_CONTENTS'.
    Regards,
    Ankur Parab

  • F4 Help for the selection screen field

    Hi Gurus,
    I have to display F4 help for a selection screen field. i am using following code:
        CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
             EXPORTING
                  retfield        = 'CODE'
                  dynpprog        = lw_repid
                  dynpnr          = sy-dynnr
                  VALUE_ORG       = 'S'
             TABLES
                  value_tab       = gi_text
                 field_tab       = li_fields_tab
                  return_tab      = pi_return_tab
             EXCEPTIONS
                  parameter_error = 1
                  no_values_found = 2
                  OTHERS          = 3.
    My internal table gi_emp has two fields CODE & TEXT. When i select 1 particular value, it returns the CODE value in the pi_return_tab table.
    But my requirement is i have to capture the corresponding TEXT value for the Returned CODE. Ex: following is the F4 help being displayed: -
    001    test
    001    test1
    but is i select code 001(First Value), i also need to capture it's corresponding Text value. In return table pi_return_tab i have only Code value.
    Please help me out.
    Note: Based on return code i can't search into the internal table gi_code, because as shown in the example, code has multiple text.

    Sachin,
    I think this is what you need. The following code will return the key and the text (OR any other columns), if both columns are in the selection screen the selected values (both columns) will also be passed to the corresponding parameters. If you only need the text to be in the return table and not passed to the selection screen then set the parameter for text with NO-DISPLAY option.
    REPORT zktest01 .
    DATA :
      BEGIN OF value_tab OCCURS 0,
        field  LIKE e070-trkorr,
        text   LIKE e07t-as4text,
      END OF value_tab.
    DATA: t_fldtab LIKE dfies OCCURS 0 WITH HEADER LINE,
          t_rettab LIKE ddshretval OCCURS 0 WITH HEADER LINE,
          t_dynmap LIKE dselc OCCURS 0 WITH HEADER LINE.
    PARAMETERS : p_field  LIKE value_tab-field,
                 p_text   LIKE value_tab-text. "NO-DISPLAY.
    INITIALIZATION.
      t_fldtab-tabname   = 'VALUE_TAB'.
      t_fldtab-fieldname = 'FIELD'.
      t_fldtab-langu     = 'E'.
      t_fldtab-position  = 1.
      t_fldtab-offset    = 0.
      t_fldtab-fieldtext = 'Key'.
      t_fldtab-reptext   = 'Key'.
      t_fldtab-leng      = 20.
      t_fldtab-intlen    = 20.
      t_fldtab-outputlen = 20.
      t_fldtab-datatype  = 'CHAR'.
      t_fldtab-inttype   = 'C'.
      t_fldtab-headlen   = 20.
      t_fldtab-keyflag   = 'X'.
      t_fldtab-lowercase = ' '.
      APPEND t_fldtab.
      t_fldtab-tabname   = 'VALUE_TAB'.
      t_fldtab-fieldname = 'TEXT'.
      t_fldtab-position  = 2.
      t_fldtab-offset    = 20.
      t_fldtab-fieldtext = 'Text'.
      t_fldtab-reptext   = 'Text'.
      t_fldtab-leng      = 60.
      t_fldtab-intlen    = 60.
      t_fldtab-outputlen = 60.
      t_fldtab-headlen   = 60.
      t_fldtab-keyflag   = ' '.
      t_fldtab-lowercase = ' '.
      APPEND t_fldtab.
      value_tab-field = '101'.
      value_tab-text = 'dddd'.
      APPEND value_tab.
      value_tab-field = '202'.
      value_tab-text = 'aaaa'.
      APPEND value_tab.
      t_dynmap-fldname = 'FIELD'.
      t_dynmap-dyfldname = 'P_FIELD'.
      APPEND t_dynmap.
      t_dynmap-fldname = 'TEXT'.
      t_dynmap-dyfldname = 'P_TEXT'.
      APPEND t_dynmap.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_field.
      CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
           EXPORTING
                retfield        = 'FIELD'
                dynpprog        = 'ZKTEST01'
                dynpnr          = '1000'
                dynprofield     = 'P_FIELD'
                value_org       = 'S'
           TABLES
                field_tab       = t_fldtab
                value_tab       = value_tab
                return_tab      = t_rettab
                dynpfld_mapping = t_dynmap
           EXCEPTIONS
                parameter_error = 1
                no_values_found = 2
                OTHERS          = 3.
      IF sy-subrc EQ 0.
      ENDIF.
    START-OF-SELECTION.
    Jeffrey Satriadi

  • Displaying error message while entering selection screen fields

    Moderator message: don't offer points
    hi experts...
    i generated a report.
    in that report, the selection screen fields are plant and material type..
    now my rqmt  is like this :
    if user enters any plant except '8210' in  the selection screen, then a pop up should appear like.. enter 8210 plant only, and the cursor should remain in the same screen allowing user to enter correct plant.
    and then same with the case of material type also..user should enter 'mcfe' material type only..
    im using message classes like this:
    if so_bwkey-low ne '8210' or so_bwkey-high ne '8210'.
      message i000(zts).
      endif.
    if so_mtart-low is not initial and so_mtart-high is not initial and so_mtart-low ne 'mcfe'
       or so_mtart-high ne 'mcfe'.
      message i001(zts).
      endif.
    with this logic, when i enter plant..it is prompting
    1) enter plant 8210 only..
    and then when i press enter key it is again prompting
    2)enter material type mcfe only..
    but iam not entering material type here..
    i want to get 2nd error message if and only if i enter material type..
    help me regarding this issue..
    <<text removed>>
    thanks in advance,
    harini.
    Edited by: Matt on Feb 9, 2009 10:14 AM

    Hi,
    Use Error type message in SELECTION SCREEN EVENT.It will place the cursor in the relevant Field.
    At SELECTION-SCREEN ON SO_BWKEY-Low.
    if so_bwkey-low ne '8210' .
    message E000(zts).
    endif.
    At SELECTION-SCREEN ON SO_BWKEY-HIGH.
    if  so_bwkey-high ne '8210'.
    message E000(zts).
    endif.
    At SELECTION-SCREEN ON so_mtart-LOW.
    if so_mtart-low is not initial and  so_mtart-low ne 'mcfe' .
    message E001(zts).
    endif.
    At SELECTION-SCREEN ON so_mtart-HIGH.
    if so_mtart-high is not initial 
    and so_mtart-high ne 'mcfe'.
    message E001(zts).
    endif.
    This will resolve the issue..
    Regards,
    Gurpreet

Maybe you are looking for