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

loop at ITAB where condition

Former Member
0 Likes
30,085

Hi,

here i want to use Loop at itab where fkart eq 'YRE' and fkart eq 'YPR'.

LOOP AT ITAB WHERE ?

l_stk2 = l_stk2 + ITAB2-FKLMG.

ENDLOOP.

here in the itab if any(YRE,YPR) one of the condition matches then populate the data.How to write the statement.

Thanks,

Rajendra.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
10,373

LOOP AT ITAB WHERE FKART = 'YRE' OR FKART = 'YPR'.
l_stk2 = l_stk2 + ITAB2-FKLMG.
ENDLOOP.
6 REPLIES 6
Read only

Former Member
0 Likes
10,373

hi ,

try this

LOOP AT ITAB WHERE YRE = 'value' or YPR = 'value'.

l_stk2 = l_stk2 + ITAB2-FKLMG.

ENDLOOP.

Read only

Former Member
0 Likes
10,374

LOOP AT ITAB WHERE FKART = 'YRE' OR FKART = 'YPR'.
l_stk2 = l_stk2 + ITAB2-FKLMG.
ENDLOOP.
Read only

Former Member
0 Likes
10,373

Hello,

Use this code:

LOOP AT itab WHERE fkart EQ 'YRE' OR fkart EQ 'YPR'.

....

ENDLOOP.

Read only

Former Member
0 Likes
10,373

Hi ,

I dint think the condition you have said will ever come a varaible can never have 2 values at the same time.

My understanding is your requiremetn is when fkart eq 'YRE' or fkart eq 'YPR'.

the code for this is as given below

LOOP AT ITAB WHERE fkart eq 'YRE' or 
                                    fkart eq 'YPR'.


ENDLOOP.

Regards

Arun

Read only

Former Member
0 Likes
10,373

LOOP AT ITAB WHERE FKART = 'YRE OR FKART = 'YPR'.

ENDLOOP.

Regards,

Ravi

Read only

p291102
Active Contributor
0 Likes
10,373

Hi,

LOOP AT ITAB WHERE FKART = 'YRE AND FKART = 'YPR'.

ENDLOOP.

Regards,

Star Shankar