Application Development 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: 

or keyword

Former Member
0 Kudos

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

athavanraja
Active Contributor
0 Kudos

if a = '01' or

a = '02' .

then .........

elseif a = '03' or

a = '04' .

then .......

endif .

Regards

Raja

4 REPLIES 4

athavanraja
Active Contributor
0 Kudos

if a = '01' or

a = '02' .

then .........

elseif a = '03' or

a = '04' .

then .......

endif .

Regards

Raja

0 Kudos

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.

0 Kudos

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

0 Kudos

thanks raja. u solved it.