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

internal table help needed

Former Member
0 Likes
759

Hi ,

I have one problem in report.

I have X table having fields f1, f2...............f10.

data: lt_tab "internal table

ls_tab "WA

for field f1 i got multiple entries in lt_fun by function module.

Now i have condition like

ls_tab-f2 = .....

ls_tab-f3 = ......

append ls_tab to lt_tab.

calling FM

by passing f1 i got multiple entries in lt_fun.

*suppose lt_fun having 2 records.

loop at lt_fun from ls_fun .

lv_tabix = sy-tabix.

gs_tab-f4 = ls_fun-f4.

gs_tab-f5 = ls_fun-f5.

modify lt_tab from ls_tab index lv_tabix transporting f3 f4.

endloop.

Is the above mentioned logic is fine.?

I am assuming output like

X

f1 f2 f3 f4 f5

1 a a1 a2 a3

b2 b3

c3 c3

Pls let me know asap.

5 REPLIES 5
Read only

Former Member
0 Likes
733

Hi NEHA ,

Logic is fine .

But my question is for f1 if you get two entries in table lt_fun .then how do you decide that it will in field F4 and f5 .

Read only

0 Likes
733

No dinesh it is not looking like what i wanted to write.

Actually

X

f1 f2 f3 f4 f5

1 a1 a1 a2 a3

b2 b3

Read only

0 Likes
733

OK, ket me see if this is what you wanted.

loop at itab into wa.

loop at lt_fun into ls_fun where f2 = wa-f2.

move-correspoding wa to ls_final.

ls_final-f2 = ls_fun-f2.

ls_final-f3 = ls_fun-f3.

append ls_final to lt_final.

clear ls_final.

endloop.

endloop.

lt_final will have the final internal table.

Regards,

ravi

Read only

0 Likes
733

Hi,

I am assiuming the output is like this. Due to some setting problem it was changed.

X

f1 f2 f3 f4 f5

1 a a1 a2 a3

o o o b2 b3

o o o c2 c3

Pls assume that o means no value.

Read only

Former Member
0 Likes
733

can u give me the code what u written