2006 Dec 14 3:11 PM
hi All,
I am having three itabs. itab1 and itab2 have common field prctr. And prctr can be same for many records in both itab1 and itab2. i want to check that if records for a particular prctr are not in itab1 but are in itab2 then those records be moved to itab3. can anyone give me some suggestion?
thanks and regards,
Reena
2006 Dec 14 3:15 PM
HI,
Loop at itab2.
read table itab1 with key prctr = itab2-prctr.
if sy-subrc NE 0.
move-correspondings itab2 to itab3.
endif.
endloop.
Regs
Manas
Hi Reena,
How could it work without APPEND ITAB3?
Your ITAB3 will be empty.
Let me know ...
Regards,
Ferry Lianto
2006 Dec 14 3:15 PM
HI,
Loop at itab2.
read table itab1 with key prctr = itab2-prctr.
if sy-subrc NE 0.
move-correspondings itab2 to itab3.
endif.
endloop.
Regs
Manas
2006 Dec 14 3:18 PM
Hi,
Please try this.
LOOP AT ITAB2.
READ TABLE ITAB1 WITH KEY PRCTR = ITAB2-PRCTR
BINARY SEARCH.
IF SY-SUBRC <> 0.
MOVE-CORRESPONDING ITAB2 TO ITAB3.
APPEND ITAB3.
ENDIF.
ENDLOOP.Regards,
Ferry Lianto
2006 Dec 14 3:20 PM
Hi Reena,
SORT ITAB1 BY PRCTR.
SORT ITAB2 BY PRCTR.
LOOP AT ITAB1.
READ TABLE ITAB2 WITH KEY PRCTR = ITAB1-PRCTR BINARY SEARCH.
IF SY-SUBRC <> 0.
MOVE-CORRESPONDING ITAB1 TO ITAB3.
APPEND ITAB3.
CLEAR ITAB3.
ENDIF.
CLEAR ITAB1.
ENDLOOP.
Thanks,
Vinay
2006 Dec 14 3:21 PM
loop at itab1.
read table itab2 with key
prctr = itab1-prctr.
if sy-subrc ne 0.
move itab2 to itab3.
enif.
endloop.
Warren.
2006 Dec 14 3:25 PM
Hi Reena,
If you want to append itab3 based on internal table is ITAB2.
Use this:
LOOP AT ITAB2.
READ TABLE ITAB1 WITH KEY PRCTR = ITAB2-PRCTR.
IF SY-SUBRC <> 0.
MOVE CORRESPONDING ITAB2 TO ITAB3.
APPEND ITAB3.
CLEAR ITAB2.
ENDIF.
ENDLOOP.
else If you want to append itab3 based on internal table is ITAB1
Use this:
LOOP AT ITAB1.
READ TABLE ITAB2 WITH KEY PRCTR = ITAB1-PRCTR.
IF SY-SUBRC <> 0.
MOVE CORRESPONDING ITAB1 TO ITAB3.
APPEND ITAB3.
CLEAR ITAB1.
ENDIF.
ENDLOOP.
Regards,
Vinod.
2006 Dec 14 3:27 PM
Hi Reena,
How could it work without APPEND ITAB3?
Your ITAB3 will be empty.
Let me know ...
Regards,
Ferry Lianto
2006 Dec 14 3:36 PM
i have used append statement. thanks for ur answer. Actually everyone suggested the same answer so i figured out more or less a mixed solution.
| User | Count |
|---|---|
| 6 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |