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

Logical expression OR not working

Former Member
0 Likes
861

Hello Experts,

I am using logical expression 'OR' but the current statement does not seems to work.

Is my statement correct ?? Is there something else which I can use in place of 'OR'??

if R1_NO EQ 'X'

DELETE itab_abapcode from n3 to row_end_event

or R2_NO EQ 'X'

delete itab_abapcode from n1 to row_end_perform

or R3_NO EQ 'X'

delete itab_abapcode from n2 to row_end_call.

endif.

6 REPLIES 6
Read only

Former Member
0 Likes
825

Hi Priya,

Do like this.

if R1_NO EQ 'X'.

DELETE itab_abapcode from n3 to row_end_event.

elseif R2_NO EQ 'X'.

delete itab_abapcode from n1 to row_end_perform.

elseif R3_NO EQ 'X'.

delete itab_abapcode from n2 to row_end_call.

endif.

Thanks

Nitesh

Edited by: Nitesh Kumar on Nov 25, 2008 11:46 AM

Read only

0 Likes
825

Hi

I think you should learn more about if statement.

Usually we use

if <condition>

         statement

  elseif <condition>

         statement

   ...
   ...
 
   else.
 
         satement

   endif.

The condition is the whole part, after judge the condition statement, program will process the statement.

so just change your 'OR' statement into if else.

if R1_NO EQ 'X'.

DELETE itab_abapcode from n3 to row_end_event

elseif R2_NO EQ 'X'

delete itab_abapcode from n1 to row_end_perform

elseif R3_NO EQ 'X'

delete itab_abapcode from n2 to row_end_call.

endif.

Read only

Former Member
0 Likes
825

try

If .....

elseif ......

endif.

regards

Prabhu

Read only

Former Member
0 Likes
825

Hi ,

No need of using or herhe,,,try this

if R1_NO EQ 'X'

DELETE itab_abapcode from n3 to row_end_event

elseif R2_NO EQ 'X'

delete itab_abapcode from n1 to row_end_perform

elseif R3_NO EQ 'X'

delete itab_abapcode from n2 to row_end_call.

endif.

Read only

Former Member
0 Likes
825

hi

u can use or only in if condition

u may also use if else if condition or a case one

eg:

data check type c.

case check.

when R1_NO.

when R2_NO.

when R3_NO.

endcase.

Read only

Former Member
0 Likes
825

Hi,

Instead of using OR try using Elseif. It will serve the same purpose in this case.

Thanks & Regards