‎2009 Jul 31 9:24 AM
Hi experts,
I search google and sdn forums for solving my following problem but I couldn't find anything.
I have an selection screen with 3 obligatory fields.
And this is what I want to do:
If the first obligatory field is filled then the other 2 obligatory fields shouldn't be obligatory anymore.
Otherwise if the 2 last obligatory are filled the first obligatory shouldn't be obligatory anymore.
But how to implement this?
Thx for any suggestion!
Zaya
‎2009 Jul 31 9:31 AM
HI,
Dont use Obligatory ...u can use At-Selection-Screen and then check which field is INITIAL and display error message of type E ..to enter the next field values
thanks
‎2009 Jul 31 9:28 AM
My tip for searching terms in Google or SCN would be with Loop at screen,Modif ID,at selection-screen....
‎2009 Jul 31 9:31 AM
HI,
Dont use Obligatory ...u can use At-Selection-Screen and then check which field is INITIAL and display error message of type E ..to enter the next field values
thanks
‎2009 Jul 31 9:35 AM
Hi,
I think you need do like this:
SELECTION-SCREEN BEGIN OF SCREEN 500.
SELECT-OPTIONS field1 FOR sflight_wa-connid.
field2 FOR sflight_wa-connid.
field3 FOR sflight_wa-connid.
SELECTION-SCREEN END OF SCREEN 500.
* Handling selection screen events
AT SELECTION-SCREEN ON field1.
IF field1 IS INITIAL.
MESSAGE 'Please enter a value in field 2 & 3 ' TYPE 'E'.
ENDIF
AT SELECTION-SCREEN ON field2 or field3.
IF field2 IS INITIAL.
MESSAGE 'Please enter a value in field 1 ' TYPE 'E'.
ENDIF
‎2009 Jul 31 9:33 AM
Hi,
Try this
parameters: field1(10) type c,
field2(10) type c.
At selection-screen output.
if field1 is initial.
if field1 is initial and field2 is initial.
message e398(00) with 'Enter field2' .
endif.
endif.
if field2 is inital.
if field2 is initial and field1 is initial.
message e398(00) with 'Enter field1' .
endif.
endif.
Regards,
Vik
‎2009 Jul 31 9:33 AM
Hi, Zaya
You can Implement this in AT-SELECTION SCREEN using the relevant conditions.
Please Reply if any need any more help.
Regards,
Faisal
‎2009 Jul 31 9:40 AM
Hello,
You can switch OBLIGATORY to NON-OBLIGATORY at event AT SELECTION-SCREEN.
Check screen field is initial or not if it is initial then make other to fields OBLIGATORY = 1 using LOOP at screen.
Check if this can help.
Thanks,
Augustin.
‎2009 Jul 31 9:48 AM
Hi,
Check this.
PARAMETERS: p_field1 TYPE char10 ,
p_field2 TYPE char10 ,
p_field3 TYPE char10 .
AT SELECTION-SCREEN.
if p_field1 is INITIAL and
p_field2 is INITIAL and
p_field3 is INITIAL.
MESSAGE 'ENter' TYPE 'E'.
ENDIF.
AT SELECTION-SCREEN OUTPUT.
if p_field1 is NOT INITIAL.
LOOP AT SCREEN.
if screen-name eq 'P_FIELD2' or screen-name eq 'P_FIELD3'.
screen-required = '0'.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ENDIF.
if p_field2 is NOT INITIAL.
LOOP AT SCREEN.
if screen-name eq 'P_FIELD1' or screen-name eq 'P_FIELD3'.
screen-required = '0'.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ENDIF.
if p_field3 is NOT INITIAL.
LOOP AT SCREEN.
if screen-name eq 'P_FIELD1' or screen-name eq 'P_FIELD2'.
screen-required = '0'.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ENDIF.
START-OF-SELECTION.
WRITE:/ 'Hi'.
‎2009 Jul 31 10:06 AM
>
> Hi experts,
>
> I search google and sdn forums for solving my following problem but I couldn't find anything.
>
> I have an selection screen with 3 obligatory fields.
> And this is what I want to do:
>
> If the first obligatory field is filled then the other 2 obligatory fields shouldn't be obligatory anymore.
> Otherwise if the 2 last obligatory are filled the first obligatory shouldn't be obligatory anymore.
>
> But how to implement this?
>
> Thx for any suggestion!
>
> Zaya
Hi,
you need to put logic at AT SELECTION-SCREEN .
don't declare field as obligatory.. instead of this
SELECTION-SCREEN BEGIN OF BLOCK blk WITH FRAME TITLE text-001.
PARAMETERS : p_miscpl TYPE t5uba-bplan ,
p_optpl TYPE t74fl-levl1 ,
p_month(2) TYPE c .
SELECTION-SCREEN END OF BLOCK blk.
AT SELECTION-SCREEN .
IF p_miscpl IS INITIAL.
IF p_optpl IS INITIAL AND
p_month IS INITIAL.
MESSAGE ' field2 and field3 are mandatory' TYPE 'E'.
ELSEIF p_optpl IS INITIAL OR
p_month IS INITIAL.
MESSAGE ' field2 and field3 are mandartory' TYPE 'E'.
ENDIF.
ELSE.
IF NOT p_optpl IS INITIAL AND
NOT p_month IS INITIAL.
MESSAGE ' field1 is mandatory' TYPE 'E'. sorry not m andatory
ENDIF.
ENDIF.
its working absolutejy fine......
let me know if u have problem
Thanks
Ashu
Edited by: ashu singh on Jul 31, 2009 11:07 AM
Edited by: ashu singh on Jul 31, 2009 11:08 AM
‎2009 Jul 31 10:08 AM
try this way:
don't use obligatory statements.
and at selection screen event . give proper error messages as required.
‎2009 Jul 31 10:53 AM
Hi,
firstly thank u ALL for your hints!
@Amit, Rimpa, Faisal and Sumanth:
Thanks for these hints!
So, now I know different ways to solve this problem!
@ Vikred and Ashu
Actually, your coding solved my problem!
Especially Ashus code was very useful!
@ Balu
Very nice tip but unfortunately it didn't work for me.
E.g. this line :
AT SELECTION-SCREEN ON field2 or field3.
doesn't work because it says that after field2 there should be a point.
@Augustrian and Nitwick:
Your hint is another way to solve my problem!
In the end I implemented like Vikred and Ashu advised me:
Sorry, Messages are in German..
SELECT-OPTIONS:
so_vbeln FOR likp-vbeln,
so_vstel FOR likp-vstel,
so_lfdat FOR likp-lfdat.
AT SELECTION-SCREEN.
IF so_vbeln IS INITIAL AND
so_vstel IS INITIAL AND
so_lfdat IS INITIAL.
MESSAGE 'Bitte Lieferung ODER Annahmestelle und Liefertermin ausfüllen!' TYPE 'E'.
ELSEIF so_vbeln IS INITIAL.
IF so_vstel OR so_lfdat IS INITIAL.
MESSAGE 'Bitte die Pflichtfelder Annahmestelle und Liefertermin ausfüllen!' TYPE 'E'.
ENDIF.
ELSEIF so_vstel AND so_lfdat IS INITIAL.
IF so_vbeln IS INITIAL.
MESSAGE 'Bitte Lieferung ausfüllen!' TYPE 'E'.
ENDIF.
ELSEIF so_vstel OR so_lfdat IS NOT INITIAL.
IF so_vbeln IS NOT INITIAL.
MESSAGE 'Bitte Lieferung ODER Annahmestelle und Liefertermin ausfüllen!' TYPE 'E'.
ENDIF.
ENDIF.
I appreciate your help!
Best Regards,
Zaya