Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

reports

Former Member
0 Likes
674

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

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
654

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

4 REPLIES 4
Read only

Former Member
0 Likes
654

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.

Read only

0 Likes
654

yah santosh,

that's ok but give me some conditions with entire code.pls.if use full full points...

thanx

lokanadhan.k

Read only

Former Member
0 Likes
654

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

Read only

Former Member
0 Likes
655

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