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

Select-option

Former Member
0 Likes
955

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.

10 REPLIES 10
Read only

former_member673464
Active Contributor
0 Likes
935

hi,

You can use the radio buttons for it.Based on radio-button you can give the selection-screen field.

Regards,

Veeresh

Read only

Former Member
0 Likes
935

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

Read only

Former Member
0 Likes
935

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.

Read only

Former Member
0 Likes
935

MN,

just search in SDN with term loop at screen you will get your answer.dont expect spoon feeding.

Amit.

Read only

Former Member
0 Likes
935

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

Read only

Former Member
0 Likes
935

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.

Read only

Former Member
0 Likes
935

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

Read only

Former Member
0 Likes
935

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.

Read only

Former Member
0 Likes
935

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

Read only

Former Member
0 Likes
935

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