10-31-2007 3:08 PM
Hi
i have 2 internal table with records. The 1st one called it_pbim it have MATNR and BDZEI . The 2nd internal table called it_pbhi and it have BDZEI and PLNMG. Now i need one internal table with above four fields and its respective records.
ie i need internal table with matnr bdzei plnmg in one table .
plz any one give soln.
Mohana
10-31-2007 3:17 PM
Sort ITAB2 by BDZEI.
Loop at ITAB1.
ITAB3-MATNR = ITAB1-MATNR.
ITAB3-BDZEI = ITAB1- BDZEI.
Read ITAB2 with key BDZEI = ITAB1-BDZEI
binary search.
If sy-subrc = 0.
ITAB3-PLNMG = ITAB2-PLNMG.
endif.
endloop.
Shreekant
10-31-2007 3:12 PM
Hi,
Here is sample code -
SORT IT_PBIM BY MATNR.
SORT IT_PBHI NY BDZEI.
LOOP AT IT_PBIM.
L_tABIX = SY-TABIX.
READ TABLE IT_PBHI WITH KEY BDZEI = IT_PBIM-BDZEI.
IF SY-SUBRC EQ 0.
IT_PBIM-QTY = IT_PBHI-QTY.
MODIFY IT_PBIM INDEX L_TABIX TRANSPORTING QTY.
ENDIF.
ENDLOOP.
Hope this helps.
ashish
PS: I think you asked same question some time back and thread is still open.
10-31-2007 3:12 PM
Hi Mohana,
declare an internal table it_final with fields Matnr, bdzei, PLNMG.
loop at itab1 into wa1.
wa_final-matnr = wa1-matnr.
wa_final-bezei = wa1-bezei.
read table itab2 into wa2 with key bezei = wa1-bezei.
if sy-subrc = 0.
move wa2-PLNMG to wa_final-PLNMG.
endif.
append wa_final to it_final.
clear wa_final.
endloop.
<b><REMOVED BY MODERATOR></b>
Satish
Message was edited by:
Alvaro Tejada Galindo
10-31-2007 3:17 PM
Sort ITAB2 by BDZEI.
Loop at ITAB1.
ITAB3-MATNR = ITAB1-MATNR.
ITAB3-BDZEI = ITAB1- BDZEI.
Read ITAB2 with key BDZEI = ITAB1-BDZEI
binary search.
If sy-subrc = 0.
ITAB3-PLNMG = ITAB2-PLNMG.
endif.
endloop.
Shreekant
10-31-2007 3:18 PM
DOnt forget for Sorting on ITAB2 and always use Binary search for read statements.
Shreekant