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

Loop at internal table

Hello Freinds,

I have an internal table which has some fields,prctr(Profit Center) is one of them.

In other internal table I have fields of prctr(Profit Center) and ktext(profit Center descrition).

how can i combine two tables so that the first internal tables will have profit center description againts each profit center.

Please suggest some code besides Join as some other constraints are present.

points will be rewarded definately.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Jul 23, 2008 at 02:25 AM

    Hi,

    As per your requirement you want to have the profit center description for each profit center in the first internal table also.

    first of all add a field for profit center description (say PRCTR_TXT) in the first internal table.Considering first itnernal table as ITAB1.

    sort the second internal table with profit center.Considering second internal table as ITAB2.

    below is the code:

    loop at the ITAB1.

    read table ITAB2 with key PRCTR = ITAB1-PRCTR

    binary search.

    if sy-subrc eq 0.

    move ITAB2-PRCTR_TXT to ITAB1-PRCTR_TXT.

    MODIFY ITAB1 transporting PRCTR_TXT.

    endif.

    endloop.

    Thanks.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jul 23, 2008 at 02:36 AM

    consider first intertabl ltab1, second itab2 then

    select the records into itab1,

    then use, for all entries select profit description into itab2 based on profit center.

    then read the table itab1 with key profit center

    if sy-subrc eq 0.

    pass the profit description. itab1-pdec = itab2-pdec. (pdec = profit desc)

    after modify the itab1.

    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.