‎2006 Sep 01 3:35 AM
Can any one suggest how to make this below statement efficient? It is taking quite a long time to run, wht could be the reasons.
SELECT pbimbedae pbimversb pbimpbdnr pbimmatnr pbim~werks
pbedpdatu pbedplnmg pbed~meins
pbed~aenam
FROM pbim
INNER JOIN pbed ON pbedbdzei = pbimbdzei
INTO TABLE I_IDEMAND
WHERE pbim~werks IN wa_plantsel
AND EXISTS ( SELECT matnr FROM mara
WHERE matnr = pbim~matnr
AND lvorm = '' )
AND EXISTS ( SELECT matnr FROM marc
WHERE marcmatnr = pbimmatnr
AND marcwerks = pbimwerks
AND marc~lvorm = '' )
AND pbim~vervs = 'X'
AND pbed~plnmg > 0 .
‎2006 Sep 01 5:57 AM
Hi,
1. First of all the sequence of fields in select query for PBIM & PBED table should be same as database table.
2. First select the data from mara & marc the fetch data from pbim.
This should solve ur performnace problem .
Regards
Kapil
‎2006 Sep 01 5:24 AM
first break the Join ,
first get MATNR from MARA+MARC , then go for Planning data.
Regards
Prabhu
‎2006 Sep 01 5:57 AM
Hi,
1. First of all the sequence of fields in select query for PBIM & PBED table should be same as database table.
2. First select the data from mara & marc the fetch data from pbim.
This should solve ur performnace problem .
Regards
Kapil
‎2006 Sep 01 6:24 AM
hi
good
use CORRESPONDIG FIELDS OF TABLE statement and see the difference.
thanks
mrutyun