2008 Jun 25 11:21 AM
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.
2008 Jun 25 11:23 AM
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.
2008 Jun 25 11:45 AM
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
2008 Jun 25 11:51 AM
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