Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Regarding Performance Tuning of Query

HI All,

I have join already in place which is taking lots of time. Can anybody tell me how can i split the same and functionality doen't changes.

The <b>SELECT</b> Statement is as given below:

<b> SELECT AAUFNR AAUART AERDAT AERNAM BGSTRI AKDAUF A~KDPOS

AKTEXT APSPEL AOBJNR AZZENGINE_MODEL AZZBWTAR AZZNEWMATNR

AZZMATNR AZZQTY AZZQMNUM BGLTRP BGSTRP BGSTRS

B~GLTRS

BAUFPL BRSNUM BLEAD_AUFNR CAPLZL CVORNR CARBID

CBANFN CBNFPO CRUECK DPRIOK

FROM ( ( AUFK AS A INNER JOIN AFKO AS B

ON AAUFNR = BAUFNR ) INNER JOIN AFVC AS C

ON BAUFPL = CAUFPL ) INNER JOIN AFIH AS D

ON AAUFNR = DAUFNR

INTO TABLE I_SMORDER

WHERE A~ZZMATNR IN S_MATNR

AND (I_SELECT)

AND B~GLTRP IN S_ERDAT.</b>

Can anybody tell me how can i improve the query without changing the functionality.

Any help in this regard will be appreciated.

Thanks in advance.

Thanks & Regards,

Prasad.

Tags:
replied

Hai Prasad

Instead of Inner Join you need to use For All Entries

Key word to improve the Performence

Check the following Code Change

Tables : AUFK,

AFKO,

AFVC,

AFIH.

data : begin of it_aufk occurs 0,

AUFNR like aufk-AUFNR,

AUART like aufk-auart,

ERDAT like aufk-erdat,

ERNAM like aufk-ernam,

GSTRI like aufk-gstri,

KDAUF like aufk-kdauf,

KDPOS like aufk-kdpos,

KTEXT like aufk-ktext,

PSPEL like aufk-pspel,

OBJNR like aufk-objnr,

ZZENGINE_MODEL like aufk-ZZENGINE_MODEL,

ZZBWTAR like aufk-ZZBWTAR,

ZZNEWMATNR like aufk-ZZNEWMATNR,

ZZMATNR like aufk-ZZMATNR,

ZZQTY like aufk-zzqty,

ZZQMNUM like aufk-zzqmnum,

end of it_aufk.

data : begin of it_afko occurs 0,

GLTRS like afko-GLTRS,

AUFPL like afko-AUFPL,

RSNUM like afko-rsnum,

LEAD_AUFNR like afko-LEAD_AUFNR,

end of it_afko.

data : begin of it_AFVC occurs 0,

APLZL like AFVC-APLZL

VORNR like AFVC-VORNR,

ARBID like AFVC-ARBID,

BANFN like AFVC-BANFN,

BNFPO like AFVC-BNFPO,

RUECK like AFVC-RUECK,

end of it_AFVC.

data : begin of it_AFIH occurs 0,

PRIOK like AFIH-PRIOK,

end of it_AFIH.

clear : it_aufk.

refresh : it_aufk.

select AUFNR

AUART

ERDAT

ERNAM

GSTRI

KDAUF

KDPOS

KTEXT

PSPEL

OBJNR

ZZENGINE_MODEL

ZZBWTAR

ZZNEWMATNR

ZZMATNR

ZZQTY

ZZQMNUM

from aufk

into table it_aufk

where ZZMATNR IN S_MATNR.

if not it_aufk[] is initial.

clear : it_afko,it_AFIH.

refresh : it_afko,it_AFIH.

select GLTRS

AUFPL

RSNUM

LEAD_AUFNR

from afko

into table it_afko

for all entries in it_aufk

where AUFNR = it_aufk-AUFNR

and GLTRP IN S_ERDAT.

if not it_afko[] is initial.

clear : it_AFVC.

refresh : it_AFVC.

select APLZL

VORNR

ARBID

BANFN

BNFPO

RUECK

from AFVC

into table it_AFVC

for all entries in it_afko

where AUFPL = it_afko-AUFPL

endif.

select PRIOK

from afih

into table it_AFIH

for all entries in it_aufk

where AUFNR = it_aufk-AUFNR.

endif.

Thanks & Regards

Sreenivasulu P

Message was edited by: Sreenivasulu Ponnadi

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question