2005 Sep 17 8:00 AM
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.
2005 Sep 17 8:10 AM
if a = '01' or
a = '02' .
then .........
elseif a = '03' or
a = '04' .
then .......
endif .
Regards
Raja
2005 Sep 17 8:10 AM
if a = '01' or
a = '02' .
then .........
elseif a = '03' or
a = '04' .
then .......
endif .
Regards
Raja
2005 Sep 17 8:28 AM
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.
2005 Sep 17 8:32 AM
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
2005 Sep 17 8:40 AM