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

or keyword

Former Member
0 Likes
1,024

Hi All,

Is there a keyword OR in abap. i want to check whether a variable A has a value 01 or 02 then i need to do one thing, if its value is 03 or 04 i need to do one thing

? what is the statement for it?

data: A(2) type n.

if A = '01' or '02' then .....

else A = '03' or '04' then ...

will it work.

1 ACCEPTED SOLUTION
Read only

athavanraja
Active Contributor
0 Likes
1,005

if a = '01' or

a = '02' .

then .........

elseif a = '03' or

a = '04' .

then .......

endif .

Regards

Raja

4 REPLIES 4
Read only

athavanraja
Active Contributor
0 Likes
1,006

if a = '01' or

a = '02' .

then .........

elseif a = '03' or

a = '04' .

then .......

endif .

Regards

Raja

Read only

0 Likes
1,003

Hi Raja,

I am getting the foll. error: The statement "THEN" is not expected. A correct similar statement is WHEN.

REPORT ZTEST.

data: qtr type n.

data: a(2) type n.

if a = '01'

or a = '02'.

then

qtr = 1.

elseif a = '04'

then

qtr = 2.

end if.

Read only

0 Likes
1,003

then is not a key word, it is the place where you can write code for the logic if a = '01' or a = '02'

for e.g

REPORT ZTEST.

data: qtr type n.

data: a(2) type n.

if a = '01'

or a = '02'.

write:/ 'a is either 01 or 02' .

qtr = 1.

elseif a = '04'

write:/ 'a is 04' .

qtr = 2.

end if.

Regards

Raja

Read only

0 Likes
1,003

thanks raja. u solved it.