‎2006 Aug 05 8:35 AM
Hii
I need to print a very simple list of materials & there corresponding latest movement date for a specified period of say '365 Days'.
Now for this i have written a join on MSEG & MKPF tables .but the issue is,this join gives me a very large number of records as all the material documents for that material in that period are fetched ,then i sort this table descending on date & delete other records.
I just need to get that record of latest date (material document with latest date).How could that be done without fetching the other records ?
Regards
Ajitabh
‎2006 Aug 05 8:40 AM
1. try to create/ use secondary indexes on MSEG and MKPF.
2. Dont use For all Entries in this Join .
it should be like this.
if s_matnr[] is not initial.
select a~mblnr
a~mjahr
a~vgart
a~budat
a~xblnr
b~zeile
b~bwart
b~matnr
b~werks
b~kunnr
b~shkzg
b~menge
b~meins
from ( mkpf as a join mseg as b
on a~mblnr = b~mblnr and
a~mjahr = b~mjahr )
into table t_mseg
where a~budat ge s_date-low and
a~vgart in ('WA' ,'WL') and
b~matnr in s_matnr and
b~werks in s_werks1 and
b~sobkz eq 'V' and
b~kunnr eq w_cust .endif.
Regards
Prabhu
‎2006 Aug 05 8:40 AM
1. try to create/ use secondary indexes on MSEG and MKPF.
2. Dont use For all Entries in this Join .
it should be like this.
if s_matnr[] is not initial.
select a~mblnr
a~mjahr
a~vgart
a~budat
a~xblnr
b~zeile
b~bwart
b~matnr
b~werks
b~kunnr
b~shkzg
b~menge
b~meins
from ( mkpf as a join mseg as b
on a~mblnr = b~mblnr and
a~mjahr = b~mjahr )
into table t_mseg
where a~budat ge s_date-low and
a~vgart in ('WA' ,'WL') and
b~matnr in s_matnr and
b~werks in s_werks1 and
b~sobkz eq 'V' and
b~kunnr eq w_cust .endif.
Regards
Prabhu
‎2006 Aug 05 11:58 AM
hi
good
write the select statement like this
use the CORRESPONDING FIELDS OF TABLE in select statement
while joining between two tables give some condition that ll make your join more close to the field value and it ll reduce the time period of accessing the data.
thanks
mrutyun