Application Development 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: 

replace into corresponding

Former Member
0 Kudos
155

Hi all,

following is my code, I want to remove into corresponding fields . but it should work same.. wat should i do

types : begin of zpart,

KAPPL type KAPPL,

KSCHL type KSCHA,

VKORG type VKORG,

MATNR type MATNR,

DATBI type KODATBI,

DATAB type KODATAB,

KNUMH type KNUMH,

matkl type matkl,

KOPOS type KOPOS,

KRECH type KRECH,

KBETR type KBETR_KOND,

KONWA type KONWA,

KPEIN type KPEIN,

KMEIN type KMEIN,

VALTG type VALTG,

VALDT type VALDT,

ZTERM type DZTERM,

KZNEP type KZNEP,

pickey type pichd,

end of zpart.

data : it_a902 type standard table of a902,

it_final type standard table of zpart.

select *

from A902

into it_a902

where KAPPL = 'V' and

KSCHL = 'ZLST' and

datab between sydatum and sydatum - 30.

it_final = it_a902.

select imatn

from mara

into corresponding fields of it_final

for all entries in it_a902

where matnr = it_a902-matnr.

select PICKEY

from PICHD

into corresponding fields of it_final

for all entries in it_a902

where PICNUM = it_final-imatn.

Thanks in advance,

Amruta.

3 REPLIES 3

Former Member
0 Kudos
75

In the Select query select all those which are there in the structure of it_final i.e. of zpart.In your case you have to pick the records from different tables.Make sure that all those internal table have some key field common.Consolidate them into the final internal table.

Former Member
0 Kudos
75

Hi Amruta,

if the sequence of fields declaration is same in you query and internal table you can remove the 'into corresponding fields of'.but if you use corresponding fields of there will be some performance constraints.

select PICKEY

from PICHD

into corresponding fields of it_final

for all entries in it_a902

where PICNUM = it_final-imatn.

This query is wrong.the internal table in the for all entries and where condition should be the same.you should write.

select PICKEY

from PICHD

into corresponding fields of it_final

for all entries in it_a902

where PICNUM = it_a902-matnr.

you can declare two more internal tables and fetch data into that internal tables and you can later combine using loop.

Regards,

Charumathi.B

former_member182485
Active Contributor
0 Kudos
75

Make 4 internal table

one for each table you are hitting with only the fields you have to select in the same sequance

then use statment like

Select

matnr

from mara

into table it_mara

where mara = p_matnr.

when u get data in all three tables just consolidate them to one final table this will be performance wise much better then your curren program.

Hope this help

Regards

Bikas