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

Reg : Internal table

Former Member
0 Likes
754

Hi,

For example , I have a itab with 6 fields.

1) sending plant

2) sending storage location.

3) receiving plant

4) receiving storage location

5) sending site address number.

6) receiving site address number.

i m filling the first row as folllows .

SELECT bwerks blgort bumwrk bumlgo FROM mkpf AS a INNER JOIN mseg AS b on amblnr = bmblnr

INTO CORRESPONDING FIELDS OF TABLE GT_ITAB_MT

WHERE a~mblnr = GV_MAT_DOC_NO.

Now the itab has 6 rows but last 2 fields left unfilled.

now i have to fill the last 2 rows as

by passing sending plant , storage location to table TWLAD and rec plant , location to the same TWLAD.

Please suggest me the best way.

Regards,

Pinky.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
728

better if u use for all enteries rather than using join...because it causes lots of database load..

first u fetch the fields from MKPF and fill internal table 1.

then fethch records from MSEG and fill internal table 2.

then merge these two internal tables in one final internal table by looping the internal table 1.

reward points if useful....

5 REPLIES 5
Read only

Former Member
0 Likes
729

better if u use for all enteries rather than using join...because it causes lots of database load..

first u fetch the fields from MKPF and fill internal table 1.

then fethch records from MSEG and fill internal table 2.

then merge these two internal tables in one final internal table by looping the internal table 1.

reward points if useful....

Read only

Former Member
0 Likes
728

Hi

Pinky

after getting firts 4 fields then u r getting last two fields so then

write like this

loop at itab (get the two fields based on first four or wht evre way u want)

update itab using fs

endloop

plzz reward if usefull

dont forget to reward if useful

Read only

0 Likes
728

loop at GT_ITAB_MT INTO GS_MT.

select ADRNR from TWLAD into GS_MT-sen_adrnr where werks = GS_MT-werks

and lgort = GS_MT-lgort.

modify GT_ITAB_MT from GS_MT index sy-tabix TRANSPORTING sen_adrnr.

endselect.

select ADRNR from TWLAD into GS_MT-rec_adrnr where werks = GS_MT-umwrk

and lgort = GS_MT-umlgo.

modify GT_ITAB_MT from GS_MT index sy-tabix TRANSPORTING rec_adrnr.

endselect.

ENDLOOP.

this is wat i have written.. but i m sure that this a worst code.. since i m using select st inside the loop..

So expecting the best way..

Read only

0 Likes
728

Hi,

Use selct single so, that u can improve some performance.

Plz reward if it helps.

Read only

Former Member
0 Likes
728

hi Pinky Ram,

This is kiran kumar.G.UR select statement is not correct check it the below SELECT STATEMETN.

If u r satisfy with my answer give me REWARD POINTS.

I notice only five fields and one field is missing u have to add those field in the select stmt..ok..

select a~mblnr

a~werks

a~lgort

a~umwrk

a~umlgo

b~blart "I have to chose this field form second table

"U HAVE TO MENTION UR FILED HERE OK..

from mseg as a

inner join mkpf as b

on amblnr = bmblnr

where mblnr in s_mblnr.

Regards,

Kiran Kumar.G