<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Problem with mandatory fields in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-mandatory-fields/m-p/4301776#M1025768</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;try this code.&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
At selection-screen output.
if w_flag eq 'x'.
loop at screen.
if screen-name eq 'xyz'.
 screen-input = 0.
modify screen.
endloop.
endif.
clear w_flag.

at selection-screen.
if rad_1 ne 'x'.
w_flag = 'x'.
endif.
  if w_flag ne 'x'.
 if s_xyz is initial.
  ur eror message.
endif.
endif.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;hope it will help you.&lt;/P&gt;&lt;P&gt;regards&lt;/P&gt;&lt;P&gt;Manjari.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 11 Aug 2008 09:40:52 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-08-11T09:40:52Z</dc:date>
    <item>
      <title>Problem with mandatory fields</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-mandatory-fields/m-p/4301771#M1025763</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i have 3 radio buttons, and 2 select-options. In first term, the 2 select-options are mandatory, but i need that when the radio buttons change, the first select-option set up to not mandatory.&lt;/P&gt;&lt;P&gt;I have some code but when i change the radio button, SAP gives me an error and tell me to fill all mandatory fields.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any suggestion?&lt;/P&gt;&lt;P&gt;Thank you!!!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 11 Aug 2008 08:03:31 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-mandatory-fields/m-p/4301771#M1025763</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-08-11T08:03:31Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with mandatory fields</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-mandatory-fields/m-p/4301772#M1025764</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Whenever you dont want to fill the Select Option on Radio Button Change...Screen-Input for that field.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 11 Aug 2008 08:06:29 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-mandatory-fields/m-p/4301772#M1025764</guid>
      <dc:creator>piyush_mathur</dc:creator>
      <dc:date>2008-08-11T08:06:29Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with mandatory fields</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-mandatory-fields/m-p/4301773#M1025765</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi  ,&lt;/P&gt;&lt;P&gt;        Initailly donot include the  obligatory keyword . Instead you can use this code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; at selection-screen output.&lt;/P&gt;&lt;P&gt;   &amp;lt;Your Condition&amp;gt;&lt;/P&gt;&lt;P&gt;  Loop at screen .&lt;/P&gt;&lt;P&gt;  if screen-name = 'S_MAR' " name of the selection-option.&lt;/P&gt;&lt;P&gt;  screen-required = '1'.&lt;/P&gt;&lt;P&gt;  modify screen.&lt;/P&gt;&lt;P&gt;  endif.&lt;/P&gt;&lt;P&gt; endloop.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 11 Aug 2008 09:26:54 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-mandatory-fields/m-p/4301773#M1025765</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-08-11T09:26:54Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with mandatory fields</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-mandatory-fields/m-p/4301774#M1025766</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I suggest you not to mark the fields as mandatory. Each time you change the radio button a error message is issued since Mandatory field check is performed automatically by the system.  Instead you can check the fields in AT SELECTION-SCREEN event and issue an error message if they are initial (only when the user clicks on execute button, by checking sy-ucomm).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I had a similar requirement, Please check the following code snippets.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
* Selection screen elements.............................................
SELECTION-SCREEN BEGIN OF BLOCK rbg WITH FRAME TITLE tit.

PARAMETERS:
  r_vendor RADIOBUTTON GROUP rad USER-COMMAND vendor,
  r_ship   RADIOBUTTON GROUP rad DEFAULT 'X'.

SELECTION-SCREEN END OF BLOCK rbg.

SELECTION-SCREEN BEGIN OF BLOCK blk WITH FRAME TITLE tit1.

SELECT-OPTIONS:
  s_matnr FOR lips-matnr NO INTERVALS,
  s_vsbed FOR likp-vsbed MODIF ID so1 NO INTERVALS,
  s_wadat FOR likp-wadat_ist NO-EXTENSION.

SELECTION-SCREEN END OF BLOCK blk.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The following are the selection screen Events.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
*----------------------------------------------------------------------*
*                  AT SELECTION-SCREEN OUTPUT EVENT                    *
*----------------------------------------------------------------------*

AT SELECTION-SCREEN OUTPUT.

* To set the selection screen attributes.
  PERFORM set_screen_attributes.

*----------------------------------------------------------------------*
*                      AT SELECTION-SCREEN EVENT                       *
*----------------------------------------------------------------------*

AT SELECTION-SCREEN.

  MOVE sy-ucomm TO sscrfields-ucomm.
  CHECK sscrfields-ucomm EQ 'ONLI'.

* To validate the selection screen fields.
  PERFORM validate_sel_screen_fields.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the following code, I am writing the logic for hiding or displaying select-options based on the radio-button selected.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
*----------------------------------------------------------------------*
*  FORM SET_SCREEN_ATTRIBUTES                                          *
*----------------------------------------------------------------------*
*  Subroutine for setting the selection screen display attributes      *
*----------------------------------------------------------------------*
*  There are no interface parameters to be passed to this subroutine.  *
*----------------------------------------------------------------------*
FORM set_screen_attributes .

  IF r_vendor EQ c_flag_x.
    w_check_group = c_flag_x.
  ENDIF.                               " IF R_VENDOR EQ C_FLAG_X

  IF w_check_group EQ c_flag_x.
    CLEAR w_check_group.
    LOOP AT SCREEN.
      IF screen-group1 = 'SO1'.
        screen-active = '0'.
        screen-invisible = '1'.
        MODIFY SCREEN.
      ENDIF.                           " IF SCREEN-GROUP1 = 'SO1'
    ENDLOOP.                           " LOOP AT SCREEN
  ELSE.
    LOOP AT SCREEN.
      IF screen-group1 = 'SO1'.
        screen-active = '1'.
        screen-invisible = '0'.
        MODIFY SCREEN.
      ENDIF.                           " IF SCREEN-GROUP1 = 'SO1'
    ENDLOOP.                           " LOOP AT SCREEN
  ENDIF.                               " IF W_CHECK_GROUP EQ C_FLAG_X

ENDFORM.                               " SET_SCREEN_ATTRIBUTES
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Instead of marking select-options as mandatory (which are infact mandatory), i am issuing an error message if they are left blank and executed.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
*----------------------------------------------------------------------*
*  FORM VALIDATE_SEL_SCREEN_FIELDS                                     *
*----------------------------------------------------------------------*
*  Subroutine for validating selection screen fields                   *
*----------------------------------------------------------------------*
*  There are no interface parameters to be passed to this subroutine.  *
*----------------------------------------------------------------------*
FORM validate_sel_screen_fields .

  IF s_wadat IS INITIAL.
    MESSAGE e888(sabapdocu)
       WITH text-dat.
  ELSEIF s_matnr IS INITIAL.
    MESSAGE e888(sabapdocu)
       WITH text-mti.
  ENDIF.                               " IF S_WADAT IS INITIAL

ENDFORM.                               " VALIDATE_SEL_SCREEN_FIELDS
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 11 Aug 2008 09:38:07 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-mandatory-fields/m-p/4301774#M1025766</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-08-11T09:38:07Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with mandatory fields</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-mandatory-fields/m-p/4301775#M1025767</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Try like this..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;

if radio_b1 eq 'X'.
  if p_filed1 is initial.
    message e(xxx).
  endif.
 if p_filed2 is initial.
   message e(xxx).
 endif.
else if radio_b2 eq 'X'.
" check what ever fields u want to keep as mandatory.
endif.

continue with u r logic...

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Sunil Kumar M........&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 11 Aug 2008 09:38:19 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-mandatory-fields/m-p/4301775#M1025767</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-08-11T09:38:19Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with mandatory fields</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-mandatory-fields/m-p/4301776#M1025768</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;try this code.&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
At selection-screen output.
if w_flag eq 'x'.
loop at screen.
if screen-name eq 'xyz'.
 screen-input = 0.
modify screen.
endloop.
endif.
clear w_flag.

at selection-screen.
if rad_1 ne 'x'.
w_flag = 'x'.
endif.
  if w_flag ne 'x'.
 if s_xyz is initial.
  ur eror message.
endif.
endif.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;hope it will help you.&lt;/P&gt;&lt;P&gt;regards&lt;/P&gt;&lt;P&gt;Manjari.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 11 Aug 2008 09:40:52 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-mandatory-fields/m-p/4301776#M1025768</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-08-11T09:40:52Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with mandatory fields</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-mandatory-fields/m-p/4301777#M1025769</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Instead of that you can do this..&lt;/P&gt;&lt;P&gt;Based on the radio button check the values and Raise the error message.&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;REPORT  ztest_radio.

TABLES: sflight.

SELECT-OPTIONS: carrid FOR sflight-carrid,
                             fldate FOR sflight-fldate.
PARAMETERS: rcar RADIOBUTTON GROUP g1 DEFAULT 'X' USER-COMMAND aaa,
            rdat RADIOBUTTON GROUP g1.

AT SELECTION-SCREEN.
  IF sy-ucomm = 'ONLI'.
    IF rcar = 'X' AND
     carrid-low IS INITIAL.
      MESSAGE 'enter carrid ' TYPE 'E'.
    ENDIF.
    IF rdat = 'X' AND
     fldate-low IS INITIAL.
      MESSAGE 'enter Fldate' TYPE 'E'.
    ENDIF.
  ENDIF.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Vijay Babu Dudla&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 11 Aug 2008 09:55:45 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-mandatory-fields/m-p/4301777#M1025769</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-08-11T09:55:45Z</dc:date>
    </item>
  </channel>
</rss>

