Skip to Content
author's profile photo Former Member
Former Member

Move data from three internal table into another internal table

hai all ,

I have three internal tables , How can i move these three internal tables data into another internal table.

thanks regards

aumprakash

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

6 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Aug 29, 2008 at 12:07 PM

    Hello,

    You can use the APPEND command.

    ... LINES OF jtab [FROM idx1] [TO idx2]

    Effect

    The rows of an internal table jtab are appended according to the same rules that apply for appending a workarea, in the sequence in which they exist in jtab. If jtab is an index table, you can restrict the rows to be appended by specifying FROM idx1 and TO idx2. In this case, only the table rows starting at table index idx1 or ending at table index idx2 from jtab are appended. For idx1 and idx2, data objects of type i are expected. If the value idx1 or idx2 is less than 0, an untreatable exception occurs. If idx1 is greater than idx2 or greater than the number of table rows, no rows are appended. If idx2 is greater than the number of table rows, it is set to the number of table rows.

    Regards.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Aug 29, 2008 at 01:25 PM

    HI,

    You can use APPEND LINES ... to do that.Take one table as base table and append the lines of the second & third tables into the first table.

    Best of luck,

    Bhumika

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Aug 29, 2008 at 12:06 PM

    loop at itab1.

    read table itab2 with key <field> = itab1-<field>.

    if sy-subrc = 0.

    move data to itab4 from itab2.

    endif.

    read table itab3 with key <field> = itab1-<field>.

    if sy-subrc = 0.

    move data to itab4 from itab3.

    endif.

    move data to itab4 from itab1.

    append itab4.

    endloop.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Aug 29, 2008 at 12:22 PM

    Hi,

    Check the code below.

    LOOP AT it_ekko INTO wa_ekko.

    READ TABLE it_ekpo INTO wa_ekpo WITH KEY ebeln = wa_ekko-ebeln.

    IF sy-subrc EQ 0.

    READ TABLE it_ekkn INTO wa_ekkn WITH KEY ebeln = wa_ekpo-ebeln ebelp = wa_ekpo-ebelp.

    IF sy-subrc EQ 0.

    READ TABLE it_eket INTO wa_eket WITH KEY ebeln = wa_ekkn-ebeln ebelp = wa_ekkn-ebelp etenr = wa_ekkn-veten.

    IF sy-subrc EQ 0.

    wa_final-ebeln = wa_ekko-ebeln.

    wa_final-date = wa_ekko-date.

    wa_final-ebelp = wa_ekpo-ebelp.

    wa_final-matnr = wa_ekpo-matnr.

    wa_final-menge = wa_ekpo-menge.

    wa_final-meins = wa_ekpo-meins.

    wa_final-eindt = wa_eket-eindt.

    wa_final-netpr = wa_ekpo-netpr.

    wa_final-werks = wa_ekpo-werks.

    wa_final-bukrs = wa_ekko-bukrs.

    wa_final-zekkn = wa_ekkn-zekkn.

    APPEND wa_final TO it_final.

    ENDIF.

    ENDIF.

    ENDIF.

    ENDLOOP.

    Regards,

    Rama.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Aug 29, 2008 at 01:16 PM

    Hi .,

    It depends on the requirement .,

    if you some common key fieds ,

    loop on first table read second based on common field and is key field in the second table , if it is not a key field ( there will be multiple records with the field value ) use again loop on the second table with where condition .

    Simmilarly you can get data from the third and create single record and append to combined table .

    loop at itab .

    Read table Jtab with key f1 = Itab-f1 ( if there is single record )

    or

    loop at jtab where f1= itab-f1 . ( Multiple records )

    Read table Ktab with key F2 = itab-f2

    or

    loop at ktab where f2= itab-f2 . ( Multiple records )

    create ltab with itab,jtab,ktab .

    append ltab .

    thanks

    Sreenivas Reddy

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Apr 25, 2011 at 11:40 AM

    Hi all thank very much i have got answer.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.