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
192

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
173

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
174

if a = '01' or

a = '02' .

then .........

elseif a = '03' or

a = '04' .

then .......

endif .

Regards

Raja

0 Kudos
171

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
171

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
171

thanks raja. u solved it.