2013 Jan 14 1:54 PM
Hi Experts,
Can any one suggest me the better alternative performance for fallowing code.
Taking too much time for execution.
types: BEGIN OF y_afru,
rueck TYPE co_rueck, "confirmation number for the operation
rmzhl TYPE co_rmzhl, "Confirmation counter
budat TYPE buchdatum, "Posting date
arbid TYPE objektid, "Object ID
werks TYPE werks_d, "Plant
gmnga TYPE ru_gmnga, "Previously confirmed yield in order unit of measure
lmnga TYPE ru_lmnga, "Yield to Be Confirmed
xmnga TYPE ru_xmnga, "Scrap to Be Confirmed
aufnr TYPE aufnr, "Order number
stzhl TYPE co_stzhl, "Confirmation counter of cancelled confirmation
END OF y_afru,
data: wt_afru TYPE HASHED TABLE of y_afru
with unique key RUECK RMZHL,
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-011.
PARAMETERS: p_werks TYPE werks_d OBLIGATORY.
SELECTION-SCREEN END OF BLOCK b1.
Oldcode:
SELECT DISTINCT
afru~rueck "confirmation number for the operation
afru~rmzhl "Confirmation counter
budat "Posting date
arbid "Object ID
werks "Plant
gmnga "Previously confirmed yield in order unit of measure
lmnga "Yield to Be Confirmed
xmnga "Scrap to Be Confirmed
afru~aufnr "Order number
stzhl "Cancellled confrimation counter
FROM afru
INNER JOIN afko
on afru~AUFNR = AFKO~AUFNR
INTO TABLE wt_afru
WHERE WERKS EQ P_WERKS.
Newcode:Where i have improved some performance still need to improve performance
SELECT
afru~rueck "confirmation number for the operation
afru~rmzhl "Confirmation counter
budat "Posting date
arbid "Object ID
werks "Plant
gmnga "Previously confirmed yield in order unit of measure
lmnga "Yield to Be Confirmed
xmnga "Scrap to Be Confirmed
afru~aufnr "Order number
stzhl "Cancellled confrimation counter
FROM afru
INTO TABLE wt_afru
WHERE EXISTS ( SELECT * FROM AFKO WHERE AUFNR = AFKO~AUFNR )
and WERKS EQ P_WERKS
%_HINTS ORACLE 'INDEX("AFRU" "AFRU~004")'.
IF sy-subrc EQ 0.
SORT p_wt_afru[] BY aufnr rmzhl.
delete adjacent duplicates from p_wt_afru.
ENDIF.
Still i need to improve the performance of my program for this block of code.
any help from anyone.
Thanks
Raviteja
2013 Jan 14 2:02 PM
2013 Jan 14 2:02 PM
Hi
take 2 internal tables and use for all entries, it will work.
Thanks