‎2007 May 25 1:56 PM
hi to all
i want to trasfer the data from 5 tables to 6th internal table.how can i?pls provide me
a sample of code so that i can understand easily...
thanx
lokanadhan.k
‎2007 May 25 2:09 PM
Hi,
Check the following code:
SELECT MBLNR MJAHR BUDAT1 ETIME FROM ZGEXIT INTO TABLE ITAB WHERE
MBLNR = IMBLNR AND MJAHR = IMJAHR.
IF SY-SUBRC = 0.
SELECT MBLNR MJAHR WERKS LGORT FROM MSEG
INTO CORRESPONDING FIELDS OF table ITAB1
for all entries in ITAB
WHERE MBLNR = ITAB-MBLNR AND MJAHR = ITAB-MJAHR.
SELECT MBLNR MJAHR BUDAT OIB_BLTIME FROM MKPF INTO CORRESPONDING
FIELDS OF table ITAB2 for all entries in itab
WHERE MBLNR = ITAB-MBLNR
AND MJAHR = ITAB-MJAHR.
ENDIF.
ENDIF.
sort itab1 by mblnr mjahr.
sort itab2 by mblnr mjahr.
Loop at itab.
read table itab1 with key mblnr = itab-mblnr
mjahr = itab-mjahr binary search.
if sy-subrc = 0.
move-corresponding itab1 to itab.
endif.
read table itab2 with key mblnr = itab-mblnr
mjahr = itab-mjahr binary search.
if sy-subrc = 0.
move-corresponding itab2 to itab.
endif.
modify itab transporting WERKS LGORT BUDAT OIB_BLTIME.
clear: itab, itab1, itab2.
In this <b>I'm moving data of 2 tables to 3rd one</b>.
Hope this helps.
Reward if helpful.
Regards,
Sipra
‎2007 May 25 1:59 PM
hi,
do this way
loop at table1.
read table table2 with key <condtions>.
if sy-subrc = 0.
read table table3 with key <condtions>.
if sy-subrc = 0.
read table table4 with key <condtions>.
if sy-subrc = 0.
read table table5 with key <condtions>.
if sy-subrc = 0.
table6-field1 = table1-field1.
...............
append table6
endif.
endif.
endif.
endif.
endloop.
‎2007 May 25 2:03 PM
yah santosh,
that's ok but give me some conditions with entire code.pls.if use full full points...
thanx
lokanadhan.k
‎2007 May 25 2:00 PM
Hi
What's meant by 6th internal table.
Data of 5 tables to be put into a single internal table,
Yes, you can put it
use table JOINS for them, provided if all of them are linked with keys.
Reward points if useful
Regards
Anji
‎2007 May 25 2:09 PM
Hi,
Check the following code:
SELECT MBLNR MJAHR BUDAT1 ETIME FROM ZGEXIT INTO TABLE ITAB WHERE
MBLNR = IMBLNR AND MJAHR = IMJAHR.
IF SY-SUBRC = 0.
SELECT MBLNR MJAHR WERKS LGORT FROM MSEG
INTO CORRESPONDING FIELDS OF table ITAB1
for all entries in ITAB
WHERE MBLNR = ITAB-MBLNR AND MJAHR = ITAB-MJAHR.
SELECT MBLNR MJAHR BUDAT OIB_BLTIME FROM MKPF INTO CORRESPONDING
FIELDS OF table ITAB2 for all entries in itab
WHERE MBLNR = ITAB-MBLNR
AND MJAHR = ITAB-MJAHR.
ENDIF.
ENDIF.
sort itab1 by mblnr mjahr.
sort itab2 by mblnr mjahr.
Loop at itab.
read table itab1 with key mblnr = itab-mblnr
mjahr = itab-mjahr binary search.
if sy-subrc = 0.
move-corresponding itab1 to itab.
endif.
read table itab2 with key mblnr = itab-mblnr
mjahr = itab-mjahr binary search.
if sy-subrc = 0.
move-corresponding itab2 to itab.
endif.
modify itab transporting WERKS LGORT BUDAT OIB_BLTIME.
clear: itab, itab1, itab2.
In this <b>I'm moving data of 2 tables to 3rd one</b>.
Hope this helps.
Reward if helpful.
Regards,
Sipra