Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

unable to remove mandatory fields

Former Member
0 Likes
582

hi all,

i have 2 parameters here,

param 1

param 2

in my scenario, when param 2 is choosen, i have to set few fields to mandatory, the problem now is when these

2 are choosen, the mandatory fields remains, the case should be when these two are choosen the fields will be cleared

from anything.

do you have any idea?

thanks AUD

1 ACCEPTED SOLUTION
Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
542

Hello Aud,

Unfortunately this is how SAP is designed. Once the mandatory attribute of a field is turned on, you can't turn it off

But there are alternatives which you can employ to resolve this situation:

AT SELECTION-SCREEN. 

IF SY-UCOMM = 'ONLI' OR 'PRIN'. "ONLI --> Online Run, 'PRIN' --> BG mode
  IF PARAM2 = <some value>.
    "Check the fields are not INITIAL. If INITIAL, give error message
  ENDIF.
ENDIF.

BR,

Suhas

PS: Do not turn the MANDATORY attribute for the field

3 REPLIES 3
Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
543

Hello Aud,

Unfortunately this is how SAP is designed. Once the mandatory attribute of a field is turned on, you can't turn it off

But there are alternatives which you can employ to resolve this situation:

AT SELECTION-SCREEN. 

IF SY-UCOMM = 'ONLI' OR 'PRIN'. "ONLI --> Online Run, 'PRIN' --> BG mode
  IF PARAM2 = <some value>.
    "Check the fields are not INITIAL. If INITIAL, give error message
  ENDIF.
ENDIF.

BR,

Suhas

PS: Do not turn the MANDATORY attribute for the field

Read only

Former Member
0 Likes
542

Hi,

You can set the fields as mandatory in at selection screen output by using modify screen concept.

You can check if the fields is selected param 2 in your case and then for the field you want to set as mandatory pass these

fields to the screen-name parameter of the screen structue

Let say you have to make param 3 as mandtory if param2 is selected.

At selection-screen output.

if param 2 = 'X' .

loop at screen.

if screen-name = 'param 3'.

screen-required = 1.

modify screen.

endif.

endloop.

endif.

Thanks.

Read only

Former Member
0 Likes
542

Hi Aud,

I think you want either Param1 or Param2 should be selected but not both.

So you can use Radio Button option.

At selection-screen depending on Param1 or param2 you can clear the unneccessary fields.

Hope this helps.

Regards

Sajid