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

Selection Screen related Problem - Remove Mandatory Option

Former Member
0 Likes
916

Dear all,

i have created on selection screen.

which have two input screen.

One field is mandatory and another is optional.

But requirement is that if user fill the second field for input the first field mandatiry option removed.

Example.

SELECT-OPTIONS: S_ARTNO FOR DRAP-DOKNR OBLIGATORY.

PARAMETERS: S_MATNR like MARA-MATNR.

if user not fill S_ARTNO and fill S_MATNR . Then remove mandatory option from S_ARTNO.

And not error dispaly.

and report displayed on the base of second field.

Please help me as soon as possible.

Regards & Thanx

1 ACCEPTED SOLUTION
Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
657

AFAIK once you have set the mandatory flag for a field you cannot revert it back. Instead of making the field OBLIGATORY, you can write a simple code to do the job for you:

AT SELECTION-SCREEN.

IF SY-UCOMM = 'ONLI' "Execute Button
OR SY-UCOMM = 'PRIN'. "Schedule Background Button

IF S_MATNR IS INITIAL AND S_ARTNO IS INITIAL.
  MESSAGE 'Input required for S_ARTNO' TYPE 'E'.
ENDIF.

ENDIF.

START-OF-SELECTION.

IF S_MATNR IS INITIAL AND S_ARTNO IS INITIAL.
  MESSAGE 'Input required for S_ARTNO' TYPE 'I'.
  LEAVE LIST-PROCESSING.
ENDIF.

Hope this helps.

BR,

Suhas

Dear all,

i have created on selection screen.

which have two input screen.

One field is mandatory and another is optional.

But requirement is that if user fill the second field for input the first field mandatiry option removed.

Example.

SELECT-OPTIONS: S_ARTNO FOR DRAP-DOKNR OBLIGATORY.

PARAMETERS: S_MATNR like MARA-MATNR.

if user not fill S_ARTNO and fill S_MATNR . Then remove mandatory option from S_ARTNO.

And not error dispaly.

and report displayed on the base of second field.

Please help me as soon as possible.

Regards & Thanx

2 REPLIES 2
Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
658

AFAIK once you have set the mandatory flag for a field you cannot revert it back. Instead of making the field OBLIGATORY, you can write a simple code to do the job for you:

AT SELECTION-SCREEN.

IF SY-UCOMM = 'ONLI' "Execute Button
OR SY-UCOMM = 'PRIN'. "Schedule Background Button

IF S_MATNR IS INITIAL AND S_ARTNO IS INITIAL.
  MESSAGE 'Input required for S_ARTNO' TYPE 'E'.
ENDIF.

ENDIF.

START-OF-SELECTION.

IF S_MATNR IS INITIAL AND S_ARTNO IS INITIAL.
  MESSAGE 'Input required for S_ARTNO' TYPE 'I'.
  LEAVE LIST-PROCESSING.
ENDIF.

Hope this helps.

BR,

Suhas

Read only

Former Member
0 Likes
657

Hi,

Try like this,


Here just remove obligatory.
SELECT-OPTIONS: S_ARTNO FOR DRAP-DOKNR.
PARAMETERS: S_MATNR like MARA-MATNR.

At selection-screen.

if s_artno-low eq space and s_matnr eq space.
stop.
endif.

Here it will not show any error message but it is compulsory to enter

either one of the specified fields.