Mandatory to selection screen field

Hi experts ,
I need one help , i have on check box and one select option filed .  my requirement is  when check box is checked my  selectoption fields should be mandatory .
please let me know how to solve this issue .
Regards
Ajay pandey

Hi Ajay,
The following is the code that works as per your requirement:
parameters: p_flag type flag as CHECKBOX
                                                USER-COMMAND TEST.
data: lv_matnr type mara-matnr.
SELECT-OPTIONS: s_matnr for lv_matnr.
the following commented lines don't work after making the
S_MATNR_LOW as a required field once. All subsequent    * attempts to uncheck the checkbox result in SAP's
mandatory field checks that include required-field check and
it never goes to the event block AT SELECTION-SCREEN.
at SELECTION-SCREEN OUTPUT.
loop at SCREEN.
   if screen-name = 'S_MATNR-LOW'.
     if not p_flag is INITIAL.
       screen-required = '1'.
     else.
       screen-required = '0'.
     endif.
   endif.
   MODIFY SCREEN.
ENDLOOP.
+
at SELECTION-SCREEN.
  IF sy-ucomm eq 'TEST'.
    if not p_flag is INITIAL and
      s_matnr-low is INITIAL. "no need to check S_MATNR-HIGH
      MESSAGE e000(SU) with 'Enter the material.'.
    endif.
  ENDIF.
Hope this helps.
Thanks
Sanjeev

Similar Messages

  • MAKING A FIELD MANDATORY IN SELECTION SCREEN

    HOW TO MAKE THE SELECTION SCREEN FIELDS MANDATORY USING LOOP AT SCREEN STATEMENT.I TRIED USING IT WITH AT SELECTION SCREEN EVENT.BUT IT WAS NOT WORKING.SO CAN ANY OF U PROVIDE SAMPLE CODE FOR THIS.
    THANKS.

    Hi,
    You can do it simple:
    AT SELECTION-SCREEN ON s_matnr.
    IF s_matnr IS INITIAL.
        MESSAGE e055(00).
    Make an entry in all required fields
    ENDIF.
    (s_matnr: is a field on the selection screen)
    Good luck.
    Gilad Hubara.

  • How to put Mandatory option for selection screen fields in ABAP Queries

    Hi Experts
    Can anyone tell me how to put mandatory option for the selection screen fields in ABAP Queries.
    Manually I had written code in the At Selection Screen  option in infoset to display error message if that field is blank.
    But I need to display the selection fields with the tick mark (obligatory mark).
    How to do this?
    Appropriate answers will be awarded

    Hi
    For parameter option
    parameters : p_kunnr type kna1-kunnr  obligatory.
    For select option
    select-options: s_date for vbak-erdat obligatory.
    Plz rewards points ,
    Regards ,
    Ganesh.

  • Query views - selection screen fields double

    Hi expects,
    BW 3.5 SP13.
    Do you know why I have double fields in WEB report selection screen ? example Month/year ?
    In WEB properties I flag 'Display same variables only once'.
    I have a WEB report with one table based on a query and with two charts based on query views from the query. Some fields are mandatory in selection screen Month/year.
    Br,
    Ole Paludan

    Hi,
    It's query views based on same query also use in WEB report, so variables are the same.
    Query view Purpose: to get fewer key figures to charts - but still by query show all key figures in table.
    BR,
    Ole

  • Selection screen fields in SAP Query

    HI friends,
    I have to make the seletion screen field as mandatory in SAP-Query.
    Please let me know the procedure to make field as mandatory or Let me know how to validate the selection-screen field in Query.
    Thanks in Advance,
    Ravi

    Go to SQ02
    Select your Infoset-->Change
    On next Screen.
    Select GoTo->Code->Initialization.
    Write there code
    LOOP AT SCREEN.
      IF screen-name EQ 'SP$00004'.
           screen-required = 1.
           MODIFY SCREEN.
      ENDIF.
    ENDLOOP.

  • 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

  • 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

  • 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

  • How to populate f4 values to standard pnp selection screen fields

    Hi Experts,
    my question is how to populate f4 values to standard pnp selection screen field. i am using LDB PNP for a report , it displays several fields with f4 values, i need to remove all the stadard f4 values and want to place my  f4 values in the selection screen

    Hi Venkat,
    To put ur own values in the F4 help of any field...all u have to do is.
    1st fetch all the records that u need to display in F4 help list...in one internal table.
    and then use the function module  'F4IF_INT_TABLE_VALUE_REQUEST'
    call function 'F4IF_INT_TABLE_VALUE_REQUEST'
    exporting
    retfield =
    value_org =
    tables
    value_tab =
    return_tab =
    exceptions
    parameter_error = 1
    no_values_found = 2
    others = 3.
    where retfield is the field for which u need to give the F4 help.
    and valu_tab is the internal table in which u have the list of records to be displayed.
    this would do the work...
    I dont have the system in front of me...as soon as i have...will try to send a piece of code, to make ur work easy.
    Till then hope this helps u...all the best
    Regards,
    Radhika

Maybe you are looking for