Skip to Content
author's profile photo Former Member
Former Member

How to make selection screen field mandatory at runtime

How to selection screen field mandatory at runtime

Add a comment
10|10000 characters needed characters exceeded

Related questions

5 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Nov 18, 2004 at 08:24 AM

    You can use the addition 'OBLIGATORY' to make a selection screen field mandatory while declaring the same.

    Eg.

    PARAMETERS: p_carr TYPE spfli-carrid OBLIGATORY.

    SELECT-OPTIONS : s_carr for spfli-carrid OBLIGATORY.

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Using slection screen output enables the programmer to control the properties of screen field dynamically.

      Let us say that we do not want to display a field in the screen if a particular checkbox is marked. This can be accomplished only via at slection screen output.

  • Posted on Nov 18, 2004 at 08:03 AM

    On selection screen output .

    Loop at screen .

    set the scree-required field to '1' .

    modify screen.

    endloop .

    Regards

    Raja

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      To avoid making all the fields as mandaory it is a good practice to use screen groups for all the fields which needs to be made as mandatory and check for this group when we are looping.

      Regards,

      Saji.

  • author's profile photo Former Member
    Former Member
    Posted on Nov 18, 2004 at 08:14 AM

    HiKaushik,

    Yes you can:

    PARAMETERS:

    pa_check TYPE c.

    AT SELECTION-SCREEN OUTPUT.

    LOOP AT SCREEN.

    CASE screen-name.

    WHEN 'PA_CHECK'.

    screen-required = '1'.

    MODIFY SCREEN.

    ENDCASE.

    ENDLOOP.

    Regards,

    John.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Nov 18, 2004 at 08:17 AM
    LOOP AT SCREEN.
    CASE SCREEN-NAME.
    WHEN 'FIELDNAME'.
    SCREEN-REQUIRED = 'X'. " or probably '1'
    ENDCASE.
    MODIFY SCREEN.
    ENDLOOP.
    

    For more help, you can refer PARAMETERS --> MODIF-ID

    Regards,

    Subramanian V.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Nov 24, 2004 at 04:28 PM

    Hi,

    If you make it mandatory during runtime using

    screen-required = '1'.

    Then you may not be able to make it not mandatory later(If the user takes some other option).

    So better try with user-command option with select-option

    and give message(Status) forcing the user to enter the field.

    Regards,

    Bejoy

    Add a comment
    10|10000 characters needed characters exceeded

    • Hi

      To compile;

      "OBLIGATORY" addition sets the parameter's or select-option's attribute staticaly, however it can be overwritten at

      standard event 'AT SELECTION-SCREEN OUTPUT' .

      Using 'AT SELECTION-SCREEN OUTPUT' event you can dynamically set selection screen field properties.

      That is; it is like PBO of the selection screen. It is triggered before whenever the screen is displayed.

      To change a screen field attribute, you can use 'LOOP AT SCREEN'. (no WHERE clause available)

      <u><b>e.g.</b></u>

      PARAMETERS p_par1 LIKE sy-datum .
      ....
      AT SELECTION-SCREEN OUTPUT .
      LOOP AT SCREEN .
        IF screen-name = 'P_PAR1' . "always use uppercase"
          screen-required = '1' .
          MODIFY SCREEN . "do not forget to commit your change with this line"
        ENDIF .
      ENDLOOP .

      To group some fields which will be treated similar at this manner, you can group them.

      For example, the code snippet below will make <i>p_par1</i> and <i>p_par2</i> obligatory at runtime.

      PARAMETERS: p_par1 LIKE sy-datum MODIF ID m01 ,
                  p_par2 LIKE mara-matnr MODIF ID m01 ,
                  p_par3 LIKE p0001-pernr .
      AT SELECTION-SCREEN OUTPUT .
      LOOP AT SCREEN .
        IF screen-group1 = 'M01' . "always use uppercase"
          screen-required = '1' .
          MODIFY SCREEN . "do not forget to commit your change with this line"
        ENDIF .
      ENDLOOP .

      For more information;

      You can refer to Horst Keller's ABAP book, standard SAP courses and http://help.sap.com">online SAP Help.

      *--Serdar

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.