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

solution for a small syntactical error

Former Member
0 Likes
707

Hi all,

i wrote a statement as below.

LOOP AT itab_vkorg.

if itab_vkorg-vkorg IN ( 'ARO','SRO','WRO','NRO','ERO','SROB' ).

endif.

endloop.

But its giving error -- >Comma without preceding colon (after IF ?).

Can anyone tell whats the correct suntax for this.

Thanks in advance

Nitin

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
670

Hi,

You cannot use IN operator for the IF statement..Instead

Create a ranges and then use otherwise use OR condition..

IF ITAB_VKORG-VKORG = 'ARO' OR

ITAB_VKORG-VKORG = 'SRO' OR

ITAB_VKORG-VKORG = 'WRO' OR

ITAB_VKORG-VKORG = 'NRO' OR

ITAB_VKORG-VKORG = 'ERO' OR

ITAB_VKORG-VKORG ='SROB'.

ENDIF.

Thanks

Naren

Hi,

You cannot use IN operator for the IF statement..Instead

Create a ranges and then use otherwise use OR condition..

IF ITAB_VKORG-VKORG = 'ARO' OR

ITAB_VKORG-VKORG = 'SRO' OR

ITAB_VKORG-VKORG = 'WRO' OR

ITAB_VKORG-VKORG = 'NRO' OR

ITAB_VKORG-VKORG = 'ERO' OR

ITAB_VKORG-VKORG ='SROB'.

ENDIF.

Thanks

Naren

5 REPLIES 5
Read only

Former Member
0 Likes
671

Hi,

You cannot use IN operator for the IF statement..Instead

Create a ranges and then use otherwise use OR condition..

IF ITAB_VKORG-VKORG = 'ARO' OR

ITAB_VKORG-VKORG = 'SRO' OR

ITAB_VKORG-VKORG = 'WRO' OR

ITAB_VKORG-VKORG = 'NRO' OR

ITAB_VKORG-VKORG = 'ERO' OR

ITAB_VKORG-VKORG ='SROB'.

ENDIF.

Thanks

Naren

Read only

0 Likes
670

Hi Naren

Thanks a lot......In WHERE condition only we can use the IN stmt..right.

Anyway thank u very much

Nitin

Read only

Former Member
0 Likes
670

data: itab like LFA1 OCCURS 0 with header line.

select * from LFA1 into table ITAB up to 3 rows.

loop at itab.

if itab-LIFNR = 'AB45'

OR ITAB-LIFNR = 'AB46'

OR ITAB-LIFNR = 'AB47'.

ENDIF.

endloop.

Try this

regards,

venkatesh

Read only

Former Member
0 Likes
670

Hi,

Yes..If you are giving fixed values in the IN...

Thanks

Naren

Read only

Former Member
0 Likes
670

Hi

Use IN paramter for a Range or select-options or in Where condn of select statement

Better put all these values 'ARO','SRO','WRO','NRO','ERO','SROB' in Ranges table and use the statement

if itab_vkorg-vkorg IN r_vkorg

endif.

Reward points for useful Answers

Regards

Anji