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

If statement

Former Member
0 Likes
538

Hi gurus,

I need to use if statement like the following:

If it_temp-status = 'A' or 'B', check it_temp-status not equal to 'B' and if check fails, move message 'Incorrect Program" to it_temp-reason.

can you please tell me hoe to do it.

Thanks

Rajeev Gupta

1 ACCEPTED SOLUTION
Read only

alejandro_bindi
Active Contributor
0 Likes
489

IF it_temp-status = 'B'.
	it_temp-reason = 'Incorrect Program'.
ENDIF.

I don't get the need for the A or B condition.

What you ask for would be to do


IF it_temp-status = 'A' OR it_temp-status = 'B'.
	IF it_temp-status = 'B'.
		it_temp-reason = 'Incorrect Program'.
	ENDIF.
ENDIF.

Regards

4 REPLIES 4
Read only

Former Member
0 Likes
489

See the below code :

if it_temp-status = 'A' or it_temp-status = 'B'.

if it_temp-status ne 'B'.

do whatever you want.

endif.

endif.

Thanks

Seshu

Read only

alejandro_bindi
Active Contributor
0 Likes
490

IF it_temp-status = 'B'.
	it_temp-reason = 'Incorrect Program'.
ENDIF.

I don't get the need for the A or B condition.

What you ask for would be to do


IF it_temp-status = 'A' OR it_temp-status = 'B'.
	IF it_temp-status = 'B'.
		it_temp-reason = 'Incorrect Program'.
	ENDIF.
ENDIF.

Regards

Read only

Former Member
0 Likes
489

Hi,

You can use just this much.

IF it_temp-status NE 'B'

<b>if check fails,</b> Write here whatever check you want.

it_temp-reason = 'Incorrect Program" .

ENDIF.

Regards,

Atish

Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
489
if it_temp-status = 'A'
    or it_temp-status = 'B'.

* if <> then ok, if 'B', then give error.
if it_temp-status = 'B'.
  it_temp-reason = 'Incorrect Program'.
endif.


endif.

Regards,

RIch Heilman