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

Combining two internal tables

Hi any body plz send me the code for combining two internal tables( ITAB_vbap and ITAB_vbkd) and filling the final data to final one internal table(ITAB_final)

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Oct 18, 2006 at 06:46 AM

    Sort itab_vbap by vbeln posnr.

    sort itab_vbkd by vbeln posnr.

    Loop at itab_vbap into wa_vbap.

    read table itab_vbkd into wa_vbkd with key vbeln = wa_vbap-vbeln posnr = wa_vbap-posnr binary search.

    if sy-subrc = 0.

    move corresponding wa_vbap to wa_final.

    move corresponding wa_vbkd to wa_final.

    append wa_final to itab_final.

    endif.

    endloop.

    For move corresponding statement the name of the fields should match in both the work areas.

    I hope it helps.

    Best Regards,

    Vibha

    *Please mark all the helpful answers

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Oct 18, 2006 at 06:51 AM

    Hi,

    Loop at itab1 into wa1.

    read table itab2 into wa2 with key f1 = wa1-f1

    f2 = wa1-fa2.

    if sy-subrc eq 0.

    move-corresponding wa1 to wa3.

    move-corresponding wa2 to wa3.

    append wa3 to itab3.

    endif.

    endloop.

    Regards,

    Laxmi.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Oct 18, 2006 at 06:55 AM

    Hi,

    loop at itab_vbap into wa_vbap.

    move-corresponding wa_vbap to wa_final.

    loop at itab_vbkd into wa_vbkd where vbeln = wa_vbap and posnr = wa_posnr.

    move-corresponding wa_vbkd to wa_final.

    append wa_final to itab_final.

    endloop.

    endloop.

    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.