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

I need get value from two internal table.

Former Member
0 Likes
691

Hi

I have two internal table.one itab1 and itab2 is other one.now i need to ALV report with fields of matnr ,ersda and mtart.

data:begin of itab1 occurs 0,

matnr type mara-matnr,

ersda type mara-ersda,

end of itab1.

data:begin of itab2 occurs0,

matnr type mara-matnr,

mtart type mara-mtart,

end of itab2.

please help me.

Thanks.

Jay

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
665

Hello,

Declare one more table itab3.


data:begin of itab3occurs 0,
matnr type mara-matnr,
ersda type mara-ersda,
mtart type mara-mtart,
end of itab3.

loop at itab1.
read table itab2 with key matnr = itab1-matnr.
if sy-subrc = 0.
itab3-matnr  = itab1-matnbr.
itab3-ersda = itab1-ersda.
itab3-mtart = itab2-mtart.
append itab3.
endif.
endloop.
Pass the table itab3 to the ALV.

If useful reward.

Vasanth

Hi

I have two internal table.one itab1 and itab2 is other one.now i need to ALV report with fields of matnr ,ersda and mtart.

data:begin of itab1 occurs 0,

matnr type mara-matnr,

ersda type mara-ersda,

end of itab1.

data:begin of itab2 occurs0,

matnr type mara-matnr,

mtart type mara-mtart,

end of itab2.

please help me.

Thanks.

Jay

5 REPLIES 5
Read only

Former Member
0 Likes
666

Hello,

Declare one more table itab3.


data:begin of itab3occurs 0,
matnr type mara-matnr,
ersda type mara-ersda,
mtart type mara-mtart,
end of itab3.

loop at itab1.
read table itab2 with key matnr = itab1-matnr.
if sy-subrc = 0.
itab3-matnr  = itab1-matnbr.
itab3-ersda = itab1-ersda.
itab3-mtart = itab2-mtart.
append itab3.
endif.
endloop.
Pass the table itab3 to the ALV.

If useful reward.

Vasanth

Read only

Former Member
0 Likes
665

data : begin of ifinal occurs 0,

matnr type mara-matnr,

ersda type mara-ersda,

mtart type mara-mtart,

end of ifinal.

loop at itab1.

ifinal-matnr = itab1-matnr.

ifinal-ersda = itab1-ersda.

read table itab2 with key matnr = itab1-matnr.

ifinal-mtart = itab2-mtart.

append ifinal.

clear : itab2.

endloop.

now pass the ifinal to alv display fm.

regards

shiba dutta

Read only

Former Member
0 Likes
665

HI,

y dont u select all the three fields in one shot in this case...

any how

try this

declare another tabel withe all the three records.

select matnr ersda from mara into table itab1.

if not itab1 is initial.

select matnr mtart from mara for all entries in itab1

where matnr = itab1-matnr.

endif.

sort itab2.

loop at itab1.

read table itab2 with key matnr = itab1-matnr binary search.

if sy-subrc eq 0.

itab3-matnr = itab1-matnr

itab3-ersda = itab1-matnr

itab3-mtart= itab1-mtart.

append itab3.

endif.

endloop.

now display the itab3.

reward points if helpful

regards,

venkatesh

Read only

Former Member
0 Likes
665

u can create itab3 internal table with these fileds (matnr ,ersda and mtart).

finally move these fileds to itab3 based on matnr.

Read only

jayanthi_jayaraman
Active Contributor
0 Likes
665

Hi,

As suggested,declare third internal table with fields matnr,ersda and mtart.

Once the two internal table asre populated,put a loop to populate itab3.

loop at itab1.

move-corresponding itab1 to itab3.

loop at itab2 where matnr = itab1-matnr.

move-corresponding itab2 to itab3.

append itab3.

endloop.

endloop.