Hi
This report came for optimization
There are four inner joins tables used in the report..
Few codes i am attaching for ur ref.--
SELECT AUFKAUART AUFKAUFNR AUFKOBJNR AFKOAUFNR AFKO~FEVOR
AFKORSNUM AFKOSTLAL AFKOSTLNR AFKOSTLTY RESB~BDMNG
RESBENMNG RESBENWRT RESBMATNR RESBMEINS RESB~RSNUM
RESBWERKS RESBLGORT RESB~POSNR
RESBSTLKN RESBSTLNR RESBSTLTY RESBSTPOZ RESB~WAERS
AFPOAMEIN AFPOAUFNR AFPOLGORT AFPOMATNR AFPO~PSMNG
AFPO~WEMNG
INTO (AUFK-AUART , AUFK-AUFNR , AUFK-OBJNR , AFKO-AUFNR , AFKO-FEVOR
, AFKO-RSNUM , AFKO-STLAL , AFKO-STLNR , AFKO-STLTY , RESB-BDMNG
, RESB-ENMNG , RESB-ENWRT , RESB-MATNR , RESB-MEINS , RESB-RSNUM
, RESB-WERKS , RESB-LGORT, RESB-POSNR
, RESB-STLKN , RESB-STLNR , RESB-STLTY , RESB-STPOZ , RESB-WAERS
, AFPO-AMEIN , AFPO-AUFNR , AFPO-LGORT , AFPO-MATNR , AFPO-PSMNG
, AFPO-WEMNG )
FROM ( AUFK
INNER JOIN AFKO
ON AFKOAUFNR = AUFKAUFNR
INNER JOIN RESB
ON RESBRSNUM = AFKORSNUM
INNER JOIN AFPO
ON AFPOAUFNR = AUFKAUFNR )
WHERE AUFK~AUART IN S_AUART
AND AUFK~AUFNR IN S_AUFNR
AND AFKO~FEVOR IN S_FEVOR
AND AFPO~LGORT IN S_LGORT
AND RESB~MATNR IN S_MATNRC
AND RESB~DUMPS IN S_DUMPS
AND RESB~XLOEK EQ SPACE
AND AFPO~MATNR IN S_MATNRP.
SELECT SINGLE * FROM MARA CLIENT SPECIFIED
WHERE MANDT = SY-MANDT
AND MATNR = RESB-MATNR
AND MATKL IN S_MATKL.
In the run time analysis AUFK having 39% and mara having 20%.
Please advice.
Thanks and regards
Arunachalam S
Request clarification before answering.
You are doing the SELECT from MARA every time you get a hit on the outer SELECT. This means that you are probably selecting the same material many many times. Put the results of the first select into an internal table and then delete adjacent duplicates from it (comparing MARA). Then SELECT from MARA using FOR ALL ENTRIES of this table.
Rob
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
1. Define a interanl table with same structure as you output fileds.
data: begin of ITAb occurs 0,
AUART like AUFK-AUART ,
AUFNR like AUFK-AUFNR ,
OBJNR like AUFK-OBJNR ,
AUFNR like AFKO-AUFNR ,
FEVOR like AFKO-FEVOR,
RSNUM like AFKO-RSNUM ,
STLAL like AFKO-STLAL ,
STLNR like AFKO-STLNR ,
STLTY like AFKO-STLTY ,
BDMNG like RESB-BDMNG,
ENMNG like RESB-ENMNG ,
ENWRT like RESB-ENWRT ,
MATNR like RESB-MATNR ,
MEINS like RESB-MEINS ,
RSNUM like RESB-RSNUM,
WERKS like RESB-WERKS ,
LGORT like RESB-LGORT,
POSNR like RESB-POSNR,
STLKN like RESB-STLKN ,
STLNR like RESB-STLNR ,
STLTY like RESB-STLTY ,
STPOZ like RESB-STPOZ ,
WAERS like RESB-WAERS,
AMEIN like AFPO-AMEIN ,
AUFNR like AFPO-AUFNR ,
LGORT like AFPO-LGORT ,
MATNR like AFPO-MATNR ,
PSMNG like AFPO-PSMNG,
WEMNG like AFPO-WEMNG ,
end of ITAB.
2. Use into table.
select AUFKAUART AUFKAUFNR AUFKOBJNR AFKOAUFNR AFKO~FEVOR
AFKORSNUM AFKOSTLAL AFKOSTLNR AFKOSTLTY RESB~BDMNG
RESBENMNG RESBENWRT RESBMATNR RESBMEINS RESB~RSNUM
RESBWERKS RESBLGORT RESB~POSNR
RESBSTLKN RESBSTLNR RESBSTLTY RESBSTPOZ RESB~WAERS
AFPOAMEIN AFPOAUFNR AFPOLGORT AFPOMATNR AFPO~PSMNG
AFPO~WEMNG
into table ITAB
from AUSK
inner join AFKO
on AFKOAUFNR = AUFKAUFNR
INNER JOIN RESB
ON RESBRSNUM = AFKORSNUM
WHERE AUFK~AUART IN S_AUART
AND AUFK~AUFNR IN S_AUFNR
AND AFKO~FEVOR IN S_FEVOR
AND AFPO~LGORT IN S_LGORT
AND RESB~MATNR IN S_MATNRC
AND RESB~DUMPS IN S_DUMPS
AND RESB~XLOEK EQ SPACE
AND AFPO~MATNR IN S_MATNRP.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello,
I would suggest u to look for a view with all these tables or some of them atleast and use them in ur select. The main advantage is the database itself takes care of performance related issue and optimise the data extraction.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi
Use forall entries instead of inner joins.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 14 | |
| 12 | |
| 7 | |
| 6 | |
| 5 | |
| 4 | |
| 3 | |
| 2 | |
| 2 | |
| 1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.