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

Problem For Adding values in Internal table

Former Member
0 Likes
700

Hi all ,

I have two internal tables like IT1 and IT2. Fields of this tables r,

IT1 : matnr posnr maktx ....... ( upto 10fields )

IT2 : matnr posnr (2 fieds).

Issue is IT1 have set of values and it2 have some values. I want to add corresponding IT2 values in IT1 at linewise .Since no relationship between this two internal tables.

I used move-corresponding and read table concepts, but item wise it's not working .Kindly suggest any ideas.

Thankx advance

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
684

Hi,

Do like this

Types: Begin of ty_it3,

matnr type matnr.

posnr type posnr.

maktx type maktx.

End of ty_it3.

Data: it3 type table of ty_it3,

wa3 type ty_it3.

Loop at IT1 into wa1.

Move: wa1-matnr to wa3-matnr,

wa1-posnr to wa3-posnr.

Read table it2 into wa2 with key matnr = wa1-matnr posnr = wa1-posnr.

if sy-subrc = 0.

move wa2-maktx to wa3-maktx.

append wa3 to it3.

clear wa3.

endif.

Endloop.

are you expecting this....????

Reward if this helps,

Satish

7 REPLIES 7
Read only

prabhu_s2
Active Contributor
0 Likes
684

not clear with ur post. can u be more clear on ur requirement?

Read only

Former Member
0 Likes
685

Hi,

Do like this

Types: Begin of ty_it3,

matnr type matnr.

posnr type posnr.

maktx type maktx.

End of ty_it3.

Data: it3 type table of ty_it3,

wa3 type ty_it3.

Loop at IT1 into wa1.

Move: wa1-matnr to wa3-matnr,

wa1-posnr to wa3-posnr.

Read table it2 into wa2 with key matnr = wa1-matnr posnr = wa1-posnr.

if sy-subrc = 0.

move wa2-maktx to wa3-maktx.

append wa3 to it3.

clear wa3.

endif.

Endloop.

are you expecting this....????

Reward if this helps,

Satish

Read only

Former Member
0 Likes
684

hi prabhu,

thankx for ur reply ,

Issue is Internal table-1 consist of

S.No maktx matnr posnr netwr

-


1 . xxx novalue novalue xxxx

2. xxx novalue novalue xxxx

3. xxx novalue novalue xxxx

-


Internal table - 2 consist of ,

S.no matnr posnr

-


1. xxxx xxxxx

2. xxxx xxxxx

3. xxxxx xxxxx

-


I want add this two fields values (like matnr and posnr) in first internaltable as S.No wise. since maktx is not same for this two tables ,

Also no other relationship between this two tables.plz tell me right solutiion for this issue.

Thankx advance.

Read only

0 Likes
684

if u just need to append the internal table2 to internal table1 then follow this code...



DESCRIBE TABLE itab1 LINES lin.
read table itab into witab index lin.

SINDEX = WITAB-SNO.

loop at itab2 into witab2.

SINDEX = SINDEX + 1.

WITAB1-SNO = SINDEX.
witab1-matnr = witab2-matnr.
witab1-posnr = witab2-posnr.
append witab1 to itab1.

endloop.

is this u r lookin for?

Read only

0 Likes
684

hie...

do u require that the First record of IT2 should be the Matnr & Posnr of the First record in IT1 ??

similarly the 2nd record of IT2 should be the Matnr & Posnr of the 2nd record in IT1 ??

is this what is expected ??

Read only

0 Likes
684

hi pranali,

Yes,,,, exactly .

Read only

0 Likes
684

if any solution for solveing this probelm,,,, kindly help me,,,