Application Development 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: 

How to fill third internal table

Former Member
0 Kudos

Sir.

I am selecting data from two tables into two internal table but i want to creat third internal table

with LINE ITEMS.

please, tell me...

select * from vbsegs into corresponding fields of table itab_docdet where belnr in docnum and gjahr = year.

select * from vbsegk into corresponding fields of table itab_docdet1 where belnr in docnum and gjahr = year.

Manoj..

1 ACCEPTED SOLUTION

Former Member
0 Kudos

see the following example.

APPEND LINES OF itab1 TO ITAB_FINAL.

APPEND LINES OF itab2 TO ITAB_FINAL.

APPEND LINES OF itab3 TO ITAB_FINAL.

8 REPLIES 8

Former Member
0 Kudos

Hi,

would you please be more clear on your requirement ... is it the same question you are asking which you had asked before... how to create the third internal table or is it different..

Regards,

Siddarth

0 Kudos

sir,

i want to creat third internal table but with line items of first two internal table.

Last time question was how to create third internal table with single line item.

thanks...

Manoj..

0 Kudos

Loop at <Headertable>.

loop at <itemtable> where <itemtable>-belnr = <Headertable>-belnr.

move-corresponding <Headertable> to it3.

move-corresponding <itemtable> to it3.

append it3.

endloop.

endloop.

0 Kudos

Hi,

if you want to create the third internal table dynamically,

then you can use the following class

CL_ABAP_TABLEDESCR

and the method create of this class can create internal table dynamically ... you will have to use field symbols for acessing records of this internal table...

else... if you dont want to create it dynamically, you just directly want to declare it...

then use the declaration statement in this way,

DATA : fs1 LIKE LINE OF itab1,
       fs2 LIKE LINE OF itab2.


DATA :
      BEGIN OF itab3.
        INCLUDE STRUCTURE fs1.
        INCLUDE STRUCTURE fs2.
DATA :
      END OF itab3.

Regards,

Siddarth

0 Kudos

hi

Try this..

create a struc for itab3 based on the line item

loop at itab1 into wa1

read table itab2 with key field1 = itab1-field

itab3-lineitem = itab1-lineitem

itab3-lineitem = itab2-lineitem

delete adjacent deuplicate

append itab3 .

Thanks

Dharma

Former Member
0 Kudos

see the following example.

APPEND LINES OF itab1 TO ITAB_FINAL.

APPEND LINES OF itab2 TO ITAB_FINAL.

APPEND LINES OF itab3 TO ITAB_FINAL.

Former Member
0 Kudos

Hi,

loop at itab_docdet.

move the values to the work area.

then append wa toitab_docdat and clear the clear wa.

In the same way do for 2nd internal table .

loop at itab_docdat1.

move the values to the work area.

append wa to itab_docdat1.clear wa

then close the loop.

Regards,

jaya.

Former Member
0 Kudos

Hi manoj,

The thord int table should be of the same structure as of the 1st and the 2nd int tables to accomodate the values.

loop at itab3

move the values of the int_tab1 and int_tab1 to the int_tab3.

or go in with append itab1 and append itab2 to itab3 as our friend suggeated,

Revert for further clarification

Thanks and Regards

Srikanth.P