‎2008 Jul 25 7:51 AM
I have two fields on select options say FIELD1 & FIELD2
Now I need to check the following condition.
BOTH should NOT BE BLANK
AND
BOTH should not be FILLED
AND
EITHER of them MUST BE FILLED.
HOW can I write the logic for this.
Thanks.
‎2008 Jul 25 7:55 AM
hi,
You can use the radio buttons for it.Based on radio-button you can give the selection-screen field.
Regards,
Veeresh
‎2008 Jul 25 7:56 AM
Hi,
Write this way-
If field1 is initial and field2 is initial .
message 'Check the input' type 'I'.
elseif field1 is not initial and field2 is not initial .
message 'Check input' type 'I'.
Endif.
First one for Both the field is blank and second one for both the fields is filled.
Hope it will help you.
Regards,
Sujit
‎2008 Jul 25 7:56 AM
write the following check in AT SELECTION-SCREEN and issue error message .
if ( FIELD1 is initial and FIELD2 is initial ) OR ( FIELD1 is not initial and FIELD2 is not initial )
Message 'XXXXXXXXXXXXXXXXXXXX type 'E'.
endif.
‎2008 Jul 25 7:57 AM
MN,
just search in SDN with term loop at screen you will get your answer.dont expect spoon feeding.
Amit.
‎2008 Jul 25 7:58 AM
Hi,
maybe like this:
TABLES mara.
SELECT-OPTIONS:
so1 FOR mara-matnr,
so2 FOR mara-matnr.
AT SELECTION-SCREEN.
IF ( so1[] IS INITIAL AND
so2[] IS INITIAL ) OR
( NOT so1[] IS INITIAL AND
NOT so2[] IS INITIAL ).
MESSAGE 'Invalid input' TYPE 'E'.
ENDIF.
START-OF-SELECTION.
MESSAGE 'Input is valid' TYPE 'S'.
Regards Rudi
‎2008 Jul 25 8:00 AM
Hi M N,
you can try with a IF condition like;
IF field1 IS INITIAL AND field2 IS INITIAL.
.................
ELSEIF field1 IS NOT INITIAL AND field2 IS NOT INITIAL.
..................
ELSEIF field1 IS NOT INITIAL OR field2 IS NOT INITIAL.
........................
ENDIF.
With luck,
Pritam.
‎2008 Jul 25 8:06 AM
Hi,
You can use logic like this....
define two parameters....p_var1 & p_var2.
give condition like
if p_var1 is initial and p_var2 is initial.
message 'stop' type 'E'.
elseif p_var1 is not initial and p_var2 is not initial. message 'stop' type 'E'.
ENDIF.
Reward point if usefull....
Regards,
Smit
‎2008 Jul 25 8:07 AM
Hi
There are 2 approaches to do this :-
1) REPORT ztesgggg.
DATA : matnr TYPE mara-matnr.
SELECT-OPTIONS : field1 FOR matnr obligatory,
field2 FOR matnr obligatory.
2) REPORT ztesgggg.
DATA : matnr TYPE mara-matnr.
SELECT-OPTIONS : field1 FOR matnr ,
field2 FOR matnr.
At selection-screen on field1.
Check condition.
At selection-screen on field2.
check condition.
reward if its ok.
‎2008 Jul 25 8:09 AM
Hi MN,
Try the following:
IF (field1 is initial and field2 is initial)
OR ( not field1 is initial and not field1 is initial ).
Message 'Enter any one Field only' TYPE 'I'.
ELSE.
<Process>
ENDIF.
Hope this helps you.
Regards,
Chandra Sekhar
‎2008 Jul 25 8:10 AM
Hi,
Check out this sample code.
REPORT z_sdn.
TABLES:
scarr,
spfli.
SELECT-OPTIONS:
s_carrid FOR scarr-carrid,
s_connid FOR spfli-connid.
AT SELECTION-SCREEN.
IF s_carrid IS NOT INITIAL AND s_connid IS NOT INITIAL.
MESSAGE 'ENTER ONLY 1 VALUE' TYPE 'E'.
ELSEIF s_carrid IS NOT INITIAL AND s_connid IS INITIAL.
MESSAGE 'GOTO LIST DISPLAY' TYPE 'I'.
ELSEIF s_connid IS NOT INITIAL AND s_carrid IS INITIAL.
MESSAGE 'GOTO LIST DISPLAY' TYPE 'I'.
ELSEIF s_carrid IS INITIAL AND s_connid IS INITIAL.
MESSAGE 'You cannot proceed further without entering any value' TYPE
'E'.
ENDIF.
START-OF-SELECTION.
IF s_carrid IS NOT INITIAL AND s_connid IS INITIAL.
WRITE: / s_carrid-low,
s_carrid-high.
ELSEIF s_connid IS NOT INITIAL AND s_carrid IS INITIAL.
WRITE: / s_connid-low,
s_connid-high.
ENDIF.
Regards
Abhijeet