‎2008 Jul 23 3:16 AM
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.
‎2008 Jul 23 3: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.
‎2008 Jul 23 3: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.
‎2008 Jul 23 3: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.