‎2007 Jul 02 2:52 PM
Hi Experts,
Program is exeuting syntatically fine, but, when executing its show, time exceed error in ECC 6.0 , initially it is developed in 4.6c. Please, can any one suggest this same code to incorporate in Forall entries.
SELECT abukrs aebeln bebelp aaedat alifnr aernam
bknttp bbednr b~banfn
cbelnr cwrbtr cgjahr cshkzg clfbnr clfgja
dbldat dbudat d~kursf
e~dir_indir
INTO CORRESPONDING FIELDS OF TABLE it_output
FROM ekko AS a
JOIN ekpo AS b ON bebeln = aebeln
JOIN rseg AS c ON cebeln = bebeln
AND cebelp = bebelp
AND cbukrs = abukrs
JOIN rbkp AS d ON dbelnr = cbelnr
AND dgjahr = cgjahr
LEFT JOIN zpo_dirindir AS e ON eknttp = bknttp
WHERE a~bukrs = p_bukrs
AND a~lifnr IN s_vendor
AND a~ebeln IN s_purcdo
AND a~bsart IN s_doctyp
AND a~ekorg IN s_purorg
AND a~aedat IN s_credat
AND b~knttp IN s_knttp
AND b~werks IN s_plant
AND b~bednr IN s_trcnum.
‎2007 Jul 02 3:01 PM
well even in SAP documentation it says that joins over more than 3 tables are tending to be NOT performant.
so why dop you wonder that a JOIN like that with 5 tables runs into a timeout.
‎2007 Jul 02 3:03 PM
I can suggest you to create one or two views. This would enhace the performance.
This is what I did also.
Thanks
Kiran
‎2007 Jul 02 3:12 PM
‎2007 Jul 02 3:45 PM
Hi Venu,
Let us have different internal tables,
1) T_PURC (with fields BUKRS, EBELN, AEDAT, LIFNR, ERNAM, EBELP, BELNR, BEDNR, BANFN in the same order).
2) T_RSEG (with fields EBELN, EBELP, BUKRS, BELNR, WRBTR, GJAHR, SHKZG, LFBNR, LFGJA).
3) T_RBKP (with fields BELNR, GJAHR, BLDAT, BUDAT, KURSF)
3) T_ZPO_DIRINDIR (with fields KNTTP, DIR_INDIR)
SELECT abukrs aebeln bebelp aaedat alifnr aernam
bknttp bbednr b~banfn
INTO TABLE T_PURC
FROM ekko AS a
JOIN ekpo AS b ON bebeln = aebeln
WHERE a~bukrs = p_bukrs
AND a~lifnr IN s_vendor
AND a~ebeln IN s_purcdo
AND a~bsart IN s_doctyp
AND a~ekorg IN s_purorg
AND a~aedat IN s_credat
AND b~knttp IN s_knttp
AND b~werks IN s_plant
AND b~bednr IN s_trcnum.
IF NOT T_PURC IS INITIAL.
SELECT ebeln ebelp bukrs belnr wrbtr gjahr shkzg lfbnr lfgja
INTO TABLE T_RSEG
FROM RSEG
FOR ALL ENTRIES OF T_PURC
WHERE ebeln in T_PURC-ebeln
AND ebelp in T_PURC-ebelp
AND bukrs in T_PURC-bukrs.
IF NOT T_RSEG IS INITIAL.
SELECT belnr gjahr bldat budat kursf
INTO TABLE T_RBKP
FROM RBKP
FOR ALL ENTRIES OF T_RSEG
WHERE belnr in T_RSEG-belnr
AND gjahr in T_RSEG-gjahr.
ENDIF.
SELECT knttp dir_indir
INTO TABLE T_ZPO_DIRINDIR
FROM ZPO_DIRINDIR
FOR ALL ENTRIES OF T_PURC
WHERE knttp in T_PURC-knttp.
ENDIF.
Now if you require you can move all the fields of all these tables by reading them into a single internal table or else you can use them seperately.
<b>Saying thanks in SDN is by awarding points.</b>
Kiran
‎2007 Jul 02 3:50 PM
Hi Venu,
there is a small correction needed to be made,
I have wrongly typed FOR ALL ENTRIES <b>OF</b>,
Plz change that to FOR ALL ENTRIES <b>IN</b>
Plz do not forget to reward with points.
Kiran
‎2007 Jul 02 3:53 PM
hi kiran,
i will try to use this logic in my code and will let u know for any clarifications required
regards
venu
‎2007 Jul 03 2:29 PM
hi kiran, could u give me ur personal mail id , so that i can approach u clearly about my issue