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

IF ELSE statement error

Former Member
0 Likes
1,463

I am writting an IF ESLE statement. But getting an error in the following statement.

ELSEIF tbl_zmdemain_unres-kunwe = tbl_openreg-kunwe AND

tbl_zmdemain_unres-lgort <> ('0003' and tbl_openreg-lgort).

Can you please suggest how to write the above statement in correct fashion.

Thanks,

AP

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,348

Hello,

Make the change like this.


ELSEIF tbl_zmdemain_unres-kunwe = tbl_openreg-kunwe AND
( tbl_zmdemain_unres-lgort EQ   '0003' and 
  tbl_zmdemain_unres-lgort EQ   tbl_openreg-lgort).

Cheers,

Vasanth

9 REPLIES 9
Read only

Former Member
0 Likes
1,349

Hello,

Make the change like this.


ELSEIF tbl_zmdemain_unres-kunwe = tbl_openreg-kunwe AND
( tbl_zmdemain_unres-lgort EQ   '0003' and 
  tbl_zmdemain_unres-lgort EQ   tbl_openreg-lgort).

Cheers,

Vasanth

Read only

0 Likes
1,348

Hello AP,

If you don't want the LGORT as 0003, then this is the easy way.


data: ra_lgort type range of lgort_d with header line.

ra_lgort-sign = 'E'.
ra_lgort-option = 'I'.
ra_lgort-low = '0003'.
append ra_lgort.
ra_lgort-low = tbl_openreg-lgort.
append ra_lgort.

" In the if statement.

ELSEIF tbl_zmdemain_unres-kunwe = tbl_openreg-kunwe AND
 tbl_zmdemain_unres-lgort IN RA_LGORT.

Hope this will helps you.

Cheers,

Vasanth

Read only

0 Likes
1,348

Vasanth-

It is not working. It is not going in?

Thanks,

AP

Read only

JozsefSzikszai
Active Contributor
0 Likes
1,348

hi AP,

do you mean tbl_zmdemain_unres-lgort should be 0003 OR tbl_openreg-lgort?

then do like:

ELSEIF tbl_zmdemain_unres-kunwe = tbl_openreg-kunwe AND

( tbl_zmdemain_unres-lgort EQ '0003' OR

tbl_zmdemain_unres-lgort EQ tbl_openreg-lgort).

hope this helps

ec

Read only

0 Likes
1,348

Hello Eric,

I mean tbl_zmdemain_unres-lgort should NOT BE 0003 OR tbl_openreg-lgort?

Thanks,

AP

Read only

0 Likes
1,348

change like this:

ELSEIF tbl_zmdemain_unres-kunwe = tbl_openreg-kunwe AND

( tbl_zmdemain_unres-lgort NE '0003' AND

tbl_zmdemain_unres-lgort NE tbl_openreg-lgort).

Read only

0 Likes
1,348

Change the logic a bit.



* Your ELSEIF condition.
case  tbl_zmdemain_unres-lgort .
  WHEN '0003'
  WHEN OTHERS.
     IF tbl_zmdemain_unres-kunwe = tbl_openreg-kunwe 
       AND tbl_zmdemain_unres-lgort NE tbl_openreg-lgort.
*      rest of your logic for this condition..............
    endif.
endcase.

* rest of your code.
endif.

I think this is easier to read in any case.

Cheers

jimbo

Read only

Former Member
0 Likes
1,348

ELSEIF tbl_zmdemain_unres-kunwe = tbl_openreg-kunwe AND

( tbl_zmdemain_unres-lgort EQ '0003' OR

tbl_zmdemain_unres-lgort EQ tbl_openreg-lgort).

Cheers!!

Lokesh

Read only

Former Member
0 Likes
1,348

Hi,

Your statemet:

*ELSEIF tbl_zmdemain_unres-kunwe = tbl_openreg-kunwe AND

tbl_zmdemain_unres-lgort ('0003' and tbl_openreg-lgort).*

I am not sure of what logic you want to achieve, but based on my understanding, find below a suggestion

ELSEIF tbl_zmdemain_unres-kunwe = tbl_openreg-kunwe AND tbl_zmdemain_unres-lgort EQ '0003' AND tbl_zmdemain_unres-lgort EQ tbl_openreg-lgort.

<REMOVED BY MODERATOR>

Regards,

Vivek

Edited by: Alvaro Tejada Galindo on Feb 18, 2008 10:53 AM