<?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: Making parameter obligatory based on condition. in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/making-parameter-obligatory-based-on-condition/m-p/5631263#M1282109</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Suwardi Nursalim ,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;make use of the below code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
 
At selection-screen.

LOOP AT SCREEN.
if p_offcy = 'x'.

   if screen-name = 'p_offdt ' or screen-name = 'p_offkdt'  .
         SCREEN-REQUIRED = 'X'.
   endif.
elseif p_year = 'X'.
    if screen-name = 'P_LOWDT' or screen-name =  'P_updt'  or screen-name =  'P_keydt .
         SCREEN-REQUIRED = 'X'.
    endif.
endif.
  MODIFY SCREEN.
ENDLOOP.

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 19 May 2009 10:40:08 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2009-05-19T10:40:08Z</dc:date>
    <item>
      <title>Making parameter obligatory based on condition.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/making-parameter-obligatory-based-on-condition/m-p/5631254#M1282100</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Experts,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is it possible to make a parameter obligatory based on a certain condition on the selection screen. &lt;/P&gt;&lt;P&gt;Here's my code:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
SELECTION-SCREEN BEGIN OF BLOCK prg_selection WITH FRAME TITLE text-001.
  PARAMETERS: p_offcy RADIOBUTTON GROUP g1 DEFAULT 'X',
              p_year RADIOBUTTON GROUP g1,
              p_leave RADIOBUTTON GROUP g1.


  SELECTION-SCREEN BEGIN OF BLOCK thr WITH FRAME TITLE text-002.
    PARAMETERS: p_offdt TYPE sy-datum MODIF ID thr,
                p_offkdt TYPE sy-datum MODIF ID thr.
    SELECT-OPTIONS: s_konfe FOR p0002-konfe MODIF ID thr.
  SELECTION-SCREEN END OF BLOCK thr.

  SELECTION-SCREEN BEGIN OF BLOCK year_alw WITH FRAME TITLE text-003.
    SELECTION-SCREEN: BEGIN OF LINE,
                       COMMENT 1(20) text-005 MODIF ID yea
                        FOR FIELD p_lowdt,
                        POSITION POS_LOW.
      PARAMETERS: p_lowdt TYPE dats MODIF ID yea,
                  p_updt TYPE dats MODIF ID yea.
    SELECTION-SCREEN: END OF LINE.
  PARAMETERS: p_keydt TYPE dats MODIF ID yea.
  SELECTION-SCREEN END OF BLOCK year_alw.

  SELECTION-SCREEN BEGIN OF BLOCK  out_leave WITH FRAME TITLE text-004.
    PARAMETERS: p_lvdat TYPE dats MODIF ID lv.
  SELECTION-SCREEN END OF BLOCK out_leave.

SELECTION-SCREEN END OF BLOCK prg_selection.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What I would like to have is when  p_offcy is selected then the parameter p_offdt and p_offkdt should be obligatory. Or when the field P_YEAR is selected then the field P_LOWDT, P_updt and P_keydt is the one which should be obligatory.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is there any solution for my condition?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Many Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 19 May 2009 10:27:14 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/making-parameter-obligatory-based-on-condition/m-p/5631254#M1282100</guid>
      <dc:creator>snursalim</dc:creator>
      <dc:date>2009-05-19T10:27:14Z</dc:date>
    </item>
    <item>
      <title>Re: Making parameter obligatory based on condition.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/making-parameter-obligatory-based-on-condition/m-p/5631255#M1282101</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;this can be checked by the following logic,&lt;/P&gt;&lt;P&gt;1.by using the MODIF ID you can make the required PARAMETERS to be visible or not visible as per your requirement.&lt;/P&gt;&lt;P&gt;  this can be done by &lt;/P&gt;&lt;P&gt;LOOP AT SCREEN.&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;P&gt;2.then once a raio button is selected&lt;/P&gt;&lt;P&gt;you can write the logic as&lt;/P&gt;&lt;P&gt;if p_oofcy EQ 'X'.&lt;/P&gt;&lt;P&gt;   check the parameter is entered or not,if not raise a message saying &lt;/P&gt;&lt;P&gt;Please enter the value for that paramter.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;same way you can validate by using the &lt;/P&gt;&lt;P&gt;if p_year EQ 'X'.&lt;/P&gt;&lt;P&gt;  check the parameters are entered or not.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 19 May 2009 10:31:52 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/making-parameter-obligatory-based-on-condition/m-p/5631255#M1282101</guid>
      <dc:creator>former_member242255</dc:creator>
      <dc:date>2009-05-19T10:31:52Z</dc:date>
    </item>
    <item>
      <title>Re: Making parameter obligatory based on condition.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/making-parameter-obligatory-based-on-condition/m-p/5631256#M1282102</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi , &lt;/P&gt;&lt;P&gt;   You will have to use the event AT SELECTION SCREEN OUTPUT , in that loop at screen and check your condition and set the REQUIRED fields as X .&lt;/P&gt;&lt;P&gt;but i think you will have a problem , because once you make a field obligatory , you can reset it and make it optional.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;so the code will look some thing like tis&lt;/P&gt;&lt;P&gt;AT SELECTION-SCREEN OUTPUT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOOP AT SCREEN.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF &amp;lt;CONDITION&amp;gt;&lt;/P&gt;&lt;P&gt; IF SCREEN-NAME = &amp;lt;    &amp;gt;&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;ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A better option will be not make it obligatory and check in the at selection screen event if the value is enetred and give the required maeesage .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Arun&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 19 May 2009 10:32:51 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/making-parameter-obligatory-based-on-condition/m-p/5631256#M1282102</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-05-19T10:32:51Z</dc:date>
    </item>
    <item>
      <title>Re: Making parameter obligatory based on condition.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/making-parameter-obligatory-based-on-condition/m-p/5631257#M1282103</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;You cannot make the fields obkigatory so you need to handle them in AT SELECTION-SCREEN ON &amp;lt;Field&amp;gt; Event . If you make the field as obligatory using  LOOP AT SCREEN then you cannot shuffle between the radio buttons with entering the obligatory fields.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Check this code..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;AT SELECTION-SCREEN ON p_offdt.
IF p_offcy EQ 'X' AND p_offdt IS INITIAL.
 " Error Message.
ENDIF.

AT SELECTION-SCREEN ON p_offkdt .
IF p_offcy EQ 'X' AND  p_offkdt IS INITIAL.
 " Error Message.
ENDIF.

AT SELECTION-SCREEN ON p_lowdt .
IF p_year EQ 'X' AND p_lowdt IS INITIAL.
 " Error Message.
ENDIF.

AT SELECTION-SCREEN ON p_updt .
IF p_year EQ 'X' AND  p_updt IS INITIAL.
 " Error Message.
ENDIF.

and so on..&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 19 May 2009 10:33:39 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/making-parameter-obligatory-based-on-condition/m-p/5631257#M1282103</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-05-19T10:33:39Z</dc:date>
    </item>
    <item>
      <title>Re: Making parameter obligatory based on condition.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/making-parameter-obligatory-based-on-condition/m-p/5631258#M1282104</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;In this way we can make the field obligatory.The error message should be in understandable formate for filling the values.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In AT SELECTION-SCREEN ON p_offdt.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;check the condition of the  p_offcy.&lt;/P&gt;&lt;P&gt;if  p_offcy is initial.&lt;/P&gt;&lt;P&gt;then give the error message.&lt;/P&gt;&lt;P&gt;leave list-processing.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In AT SELECTION-SCREEN ON p_offkdt .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;check the condition of the  p_offcy.&lt;/P&gt;&lt;P&gt;if  p_offcy is initial.&lt;/P&gt;&lt;P&gt;then give the error message.&lt;/P&gt;&lt;P&gt;leave list-processing.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 19 May 2009 10:33:47 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/making-parameter-obligatory-based-on-condition/m-p/5631258#M1282104</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-05-19T10:33:47Z</dc:date>
    </item>
    <item>
      <title>Re: Making parameter obligatory based on condition.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/making-parameter-obligatory-based-on-condition/m-p/5631259#M1282105</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You need to capture it by error messages in AT SELECTION-SCREEN event.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Alternatively, you can handle it in AT SELECTION-SCREEN output event, by looping at screen and based on particular radio-button selected, making the field manatory or not.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 19 May 2009 10:35:11 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/making-parameter-obligatory-based-on-condition/m-p/5631259#M1282105</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-05-19T10:35:11Z</dc:date>
    </item>
    <item>
      <title>Re: Making parameter obligatory based on condition.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/making-parameter-obligatory-based-on-condition/m-p/5631260#M1282106</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Use the following logic&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
at selection-screen.

if p_offcy is not initial.
loop at screen.
if screen-name = p_offdt.
screen-required = 'X'.
endif. 
if screen-name = p_offkdt .
screen-required = 'X'.
endif. 
modify screen.
endloop.
endif.

if p_year is not initial.
loop at screen.
if screen-name = P_LOWDT.
screen-required = 'X'.
endif. 
if screen-name = P_updt.
screen-required = 'X'.
endif. 
if screen-name = P_keydt.
screen-required = 'X'.
endif. 
modify screen.
endloop.
endif.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 19 May 2009 10:36:04 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/making-parameter-obligatory-based-on-condition/m-p/5631260#M1282106</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-05-19T10:36:04Z</dc:date>
    </item>
    <item>
      <title>Re: Making parameter obligatory based on condition.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/making-parameter-obligatory-based-on-condition/m-p/5631261#M1282107</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;At selection-screen on p_offcy.&lt;/P&gt;&lt;P&gt;LOOP AT SCREEN.&lt;/P&gt;&lt;P&gt;    IF  screen-group1 = 'THR'.&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;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Bindu.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 19 May 2009 10:36:38 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/making-parameter-obligatory-based-on-condition/m-p/5631261#M1282107</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-05-19T10:36:38Z</dc:date>
    </item>
    <item>
      <title>Re: Making parameter obligatory based on condition.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/making-parameter-obligatory-based-on-condition/m-p/5631262#M1282108</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;You can achieve the following requirment by looping at the screen.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PARAMETER: rb1 TYPE char1 RADIOBUTTON GROUP rb USER-COMMAND f1,&lt;/P&gt;&lt;P&gt;           rb2 TYPE char1 RADIOBUTTON GROUP rb.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PARAMETER: v_matnr TYPE matnr,&lt;/P&gt;&lt;P&gt;           v_bukrs TYPE bukrs.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;AT SELECTION-SCREEN OUTPUT.&lt;/P&gt;&lt;P&gt;  IF rb2 = 'X'.&lt;/P&gt;&lt;P&gt;    LOOP AT SCREEN.&lt;/P&gt;&lt;P&gt;      IF screen-name = 'V_MATNR'.&lt;/P&gt;&lt;P&gt;        screen-required = '1'.&lt;/P&gt;&lt;P&gt;      ENDIF.&lt;/P&gt;&lt;P&gt;      MODIFY SCREEN.&lt;/P&gt;&lt;P&gt;    ENDLOOP.&lt;/P&gt;&lt;P&gt;  ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Nikhil Kayal&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 19 May 2009 10:37:40 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/making-parameter-obligatory-based-on-condition/m-p/5631262#M1282108</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-05-19T10:37:40Z</dc:date>
    </item>
    <item>
      <title>Re: Making parameter obligatory based on condition.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/making-parameter-obligatory-based-on-condition/m-p/5631263#M1282109</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Suwardi Nursalim ,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;make use of the below code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
 
At selection-screen.

LOOP AT SCREEN.
if p_offcy = 'x'.

   if screen-name = 'p_offdt ' or screen-name = 'p_offkdt'  .
         SCREEN-REQUIRED = 'X'.
   endif.
elseif p_year = 'X'.
    if screen-name = 'P_LOWDT' or screen-name =  'P_updt'  or screen-name =  'P_keydt .
         SCREEN-REQUIRED = 'X'.
    endif.
endif.
  MODIFY SCREEN.
ENDLOOP.

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 19 May 2009 10:40:08 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/making-parameter-obligatory-based-on-condition/m-p/5631263#M1282109</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-05-19T10:40:08Z</dc:date>
    </item>
    <item>
      <title>Re: Making parameter obligatory based on condition.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/making-parameter-obligatory-based-on-condition/m-p/5631264#M1282110</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;try it this way:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;AT SELECTION-SCREEN ON p_offdt.
  IF p_offcy eq 'X'.
    IF p_offdt is initial.
      MESSAGE 'enter a value in p_offdt' type 'E'.
    ENDIF.
  ENDIF.

AT SELECTION-SCREEN ON p_offkdt.
  IF p_offcy eq 'X'.
    IF p_offkdt is INITIAL.
      MESSAGE 'enter a value in p_offkdt' type 'E'.
    ENDIF.
  ENDIF.

AT SELECTION-SCREEN ON p_lowdt.
  IF p_year eq 'X'.
    IF p_lowdt is initial.
      MESSAGE 'enter a value in p_lowdt' type 'E'.
    ENDIF.
  ENDIF.

AT SELECTION-SCREEN ON p_updt.
  IF p_year eq 'X'.
    IF p_updt is INITIAL.
      MESSAGE 'enter a value in p_updt' type 'E'.
    ENDIF.
  ENDIF.

AT SELECTION-SCREEN ON p_keydt.
  IF p_year eq 'X'.
    IF p_keydt is INITIAL.
      MESSAGE 'enter a value in p_keydt' type 'E'.
    ENDIF.
  ENDIF.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;With luck,&lt;/P&gt;&lt;P&gt;Pritam.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 19 May 2009 10:58:33 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/making-parameter-obligatory-based-on-condition/m-p/5631264#M1282110</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-05-19T10:58:33Z</dc:date>
    </item>
  </channel>
</rss>

