2007 Dec 21 4:00 PM
hi friends,
i met with a situation, where i have to join 3 tables using the common fields using inner join.
i wrote 2 select statements and added contents to two different internal tables.
F
hi friends,
i met with a situation, where i have to join 3 tables using the common fields using inner join.
i wrote 2 select statements and added contents to two different internal tables.
F
2007 Dec 21 4:07 PM
I dint find a question in ur post..
but if you are looking to append that two internal table.. if the structures are same then say
> append lines of itab1 to itab2 ( structure of both need to be >same)
2007 Dec 21 4:07 PM
loop at one internal table and append it to the other.
or use INTO APPENDING TABLE T_XXXX in the second select statement.
Thnaks
Sayak
2007 Dec 21 4:09 PM
if 2 internal fields are same then
appending lines of i_tab1 to i_tab2.
if fields are not same
loop at i_tab1
v_tabix = sy-tabix.
read table i_tab3 with key <key fields of i_tab1>
if sy-subrc eq 0.
move corresponding fields i_tab1 to i_tab3.
modify i_tab3 index v_tabix..
else.
move corresponding fields i_tab1 to i_tab3.
append i_tab3.
endif.
endloop.
loop at i_tab2
v_tabix = sy-tabix.
read table i_tab3 with key <key fields of i_tab2>
if sy-subrc eq 0.
move corresponding fields i_tab2 to i_tab3.
modify i_tab3 index v_tabix..
else.
move corresponding fields i_tab2 to i_tab3.
append i_tab3.
endif.
endloop.
After this I_tab3 cotnains the combined results of i_tab1 & I_tab2
a®
2007 Dec 28 6:11 AM
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |