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

merging internal tables.

Hi,

I have an internal table it1 with field f1

it-f1.The value gets filled in one loop.

it-f1 = 10.

I have another internal table it1 with fields f1 and f2.

say it1-f2 = 20 , it1-f3=30.

I want everything in one internal table in the format

it1-f1= 10

it1-f2 =20

it1-f3 =30

How to do it...it1 consists of the field declaration f1 also...

Thanks.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

7 Answers

  • Posted on Nov 21, 2007 at 06:39 AM

    Hi,

    Loop on one internal table read another internal table n append it in different internal table.

    Ex.

    &----


    *& Form SUB_COLLECT_DATA

    &----


    • text

    ----


    FORM sub_collect_data.

    *--Local variables

    DATA : lv_count(3) TYPE c.

    IF NOT it_fpltc[] IS INITIAL.

    LOOP AT it_fpltc INTO wa_fpltc.

    lv_count = wa_fpltc-fpltr+3(3).

    wa_final-ccnum = wa_fpltc-ccnum.

    wa_final-rfzei = lv_count.

    CLEAR : wa_vbrk.

    READ TABLE it_vbrk INTO wa_vbrk WITH KEY rplnr = wa_fpltc-fplnr

    BINARY SEARCH.

    IF sy-subrc EQ 0.

    wa_final-vbeln = wa_vbrk-vbeln.

    wa_final-bukrs = wa_vbrk-bukrs.

    ENDIF.

    APPEND wa_final TO it_final.

    CLEAR : wa_vbrk,

    wa_fpltc,

    lv_count.

    ENDLOOP.

    ENDIF.

    ENDFORM. " SUB_COLLECT_DATA

    Reward Points

    Reagrds,

    Prashant

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Nov 21, 2007 at 06:41 AM

    hi

    declare a int table 3 which consists os 3 fields.

    then assign the fields of it1 and it2 to it3.

    ie

    it3-f1 = it1-f1.

    it3-f2 = it2-f2.

    it3-f3 = it2-f3.

    append it3.

    <b>this will help u</b>

    regards'

    karthik

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Nov 21, 2007 at 06:46 AM

    Hi Renu,

    U can use the following code.

    Loop at it1.

    read table it.

    if sy-subrc = 0.

    it1-f1 = it-f1.

    modify it1.

    endif.

    endloop.

    OR

    u can use

    move-corresponding it to it1.

    If it is helpfull do reward.

    Regards

    Srimanta

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Nov 21, 2007 at 07:22 AM

    declare another table t3.

    loop at t1.

    t3-f1 = t1-f1.

    read table t2 .

    if sy-subrc = 0.

    t3-f2 = t2-f2.

    t3-f3 = t2-f3.

    endif.

    append t3.

    endloop.

    PS.reward points if helps.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Nov 21, 2007 at 07:27 AM

    hi

    You can use <b>APPEND LINES OF itab1 TO itab2</b>, when there is no condition and the structure of the 2 internal tables are the same.

    If you have to join 2 internal tables upon some condition, then Loop is necessary.without looping it is not possible.

    <b>Reward if usefull</b>

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Nov 21, 2007 at 10:14 AM

    Hi Renu,

    I have develoed a code for u.

    If this helpful for u plz give me REWARD POINTS..

    COPY THIS CODE AND EXECUTE IT.

    CODE:

    DATA: begin of it occurs 0,

    f1 type i,

    f2 type i,

    f3 type i,

    end of it.

    it-f1 = 10.

    append it.

    it-f2 = 20.

    append it.

    it-f3 = 30.

    append it.

    write: / it-f1,

    it-f2,

    it-f3.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Nov 21, 2007 at 10:47 AM

    hi,

    u has to declare three internal tables, f1 , f2, f3,

    fill first two internl tables and collect data into theird table.

    loop at the internal tables,

    append the data into new table.

    using the fields symbols:

    using the dynamic internal tables .

    Farooq

    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.