2007 Apr 01 7:20 AM
how to get the data into one int table from 3 int tables with any common fields?
2007 Apr 01 7:26 AM
loop at itab1.
move-correponding itab1 to itabfinal.
read table itab2 with key f1 = itab1-f1.
if sy-subrc = 0.
move-correponding itab2 to itabfinal.
endif.
read table itab3 with key f1 = itab1-f1.
if sy-subrc = 0.
move-correponding itab3 to itabfinal.
endif.
append itabfinal.
clear : itab1,itab2,itab3,itabfinal.
endloop.
regards
shiba dutta
how to get the data into one int table from 3 int tables with any common fields?
2007 Apr 01 7:26 AM
loop at itab1.
move-correponding itab1 to itabfinal.
read table itab2 with key f1 = itab1-f1.
if sy-subrc = 0.
move-correponding itab2 to itabfinal.
endif.
read table itab3 with key f1 = itab1-f1.
if sy-subrc = 0.
move-correponding itab3 to itabfinal.
endif.
append itabfinal.
clear : itab1,itab2,itab3,itabfinal.
endloop.
regards
shiba dutta
2007 Apr 01 2:52 PM
Hi,
Please use LOOP, READ and COLLECT (if you want to sum) statements.
Try this ...
...
SORT ITAB1 BY FIELD1 FIELD2 ASCENDING.
SORT ITAB2 BY FIELD1 FIELD2 ASCENDING.
SORT ITAB3 BY FIELD1 FIELD2 ASCENDING.
LOOP AT ITAB1.
MOVE-CORRESPONDING ITAB1 TO ITAB4.
READ ITAB2 WITH KEY FIELD1 = ITAB1-FIELD1
FIELD2 = ITAB1-FIELD2.
IF SY-SUBRC = 0.
MOVE-CORRESPONDING ITAB2 TO ITAB4.
ENDIF.
READ ITAB3 WITH KEY FIELD1 = ITAB1-FIELD1
FIELD2 = ITAB1-FIELD2.
IF SY-SUBRC = 0.
MOVE-CORRESPONDING ITAB3 TO ITAB4.
ENDIF.
*Insert record to internal table ITAB4
APPEND ITAB4.
*Sum record to internal table ITAB4
* COLLECT ITAB4.
ENDLOOP.
...
Regards,
Ferry Lianto
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |