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 insert data from itab to another itab ?

Former Member
0 Kudos

Hi.

Now, I have one PR which generates a lot of PO.

Each PR number has one or more PO number.

ITAB_EBAN has field BANFN, EBELN.

ITAB_EKPO had fields EBELN, EBELP, BANFN.

How do i insert the ekpo-ebelp into the itab_eban from itab_ekpo for each eban-banfn? One line of eban-banfn record maybe have a lot of ekpo-ebeln and ekpo-ebelp. So what should i do in order to make sure the record is displayed correctly? By duplicate the row of data inside itab_eban, so that each eban-banfn can have many ekpo-ebeln or ekpo-ebelp?

Thanks in advance.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi ,

Do the following...............

ITAB_EBAN has field BANFN, EBELN.

ITAB_EKPO had fields EBELN, EBELP, BANFN.

loop at ITAB_EKPO.

ITAB_EBAN-BANFN = ITAB_EKPO-BANFN .

ITAB_EBAN-EBELN = ITAB_EKPO-EBELN .

Append ITAB_EBAN.

endloop.

  • delete duplicates

Sort ITAB_EBAN by banfn descending ebeln descending.

Delete adjacent duplicates from itab_eban comparing banfn ebeln.

We will now have unique values for banfn/ebeln in itab_eban

Regards

Byju

4 REPLIES 4

Former Member
0 Kudos

U can instead copy the data to item table from header table....because ulitmately you will require ebeln ebelp combination....

One more option u can declare a third internal table ....loop at item table .....loop at header table where ebeln.....append the required fields to the third table..

data : itab3 ............

loop at itab_ekpo.

loop at itab_ebafn where ebeln = itAb_ekpo-ebeln.

move -


append itab3.

endloop.

endloop.

Edited by: kashyap joshi on Nov 22, 2008 9:31 AM

former_member181995
Active Contributor
0 Kudos

Press F1 on Appends line of..

Former Member
0 Kudos

LOOP AT ITAB.

move-corresponding itab to itab1.

append itab1.

ENDLOOP..

Former Member
0 Kudos

Hi ,

Do the following...............

ITAB_EBAN has field BANFN, EBELN.

ITAB_EKPO had fields EBELN, EBELP, BANFN.

loop at ITAB_EKPO.

ITAB_EBAN-BANFN = ITAB_EKPO-BANFN .

ITAB_EBAN-EBELN = ITAB_EKPO-EBELN .

Append ITAB_EBAN.

endloop.

  • delete duplicates

Sort ITAB_EBAN by banfn descending ebeln descending.

Delete adjacent duplicates from itab_eban comparing banfn ebeln.

We will now have unique values for banfn/ebeln in itab_eban

Regards

Byju