Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Performance tunning required..

Former Member
0 Kudos
76

Hi all,

please do tell me what is the best alternative of writing the below select queries.

r_matnr is a range having 30,000 entries in it.

R_LGNUM is a range having 10,000 entries in it.

1) DELETE FROM s031 WHERE werks = p_werks AND matnr IN r_matnr.

2)TABLES: LTAP.

select distinct tanum from LTAP into ltap-tanum

WHERE LGNUM IN R_LGNUM AND

MATNR IN R_MATNR.

3)

select * from ekko where ekorg in r_ekorg.

select single * from ekpo where ebeln = ekko-ebeln

and matnr in r_matnr.

check sy-subrc eq 0.

add 1 to count_pu.

check p_test ne 'X'.

PERFORM DELETE_PURCHASING_DOCS.

PERFORM COMMIT_CHECK USING count_pu.

endselect.

2 REPLIES 2

Former Member
0 Kudos
46

Hi,

You can do the performance tuning in transaction SE30.

There go to Tips and Tricks.

There you can compare the time taken by diffrerent queries and you can select the best one.

Thank you,

Regards,

Renjith Michael.

Former Member
0 Kudos
46

Dear Syed Husain,

Please try following

(Assuming all your entries in r_matnr and r_lgnum as inclusive equal I EQ )

1.

data : begin of itab occurs 0,

<all key fields of S031>

end of itab.

select <key_fields> from s031

into table itab

for all entries in r_matnr

where werks = p_werks AND matnr = r_matnr-low.

delete s031 from table itab.

2.

data : begin of itab.

tanum type S031-tanum,

lgnum type S031-lgnum,

end of itab.

data : itab_final like table of itab with header line.

field-symbols : <f_tab> like line of itab.

select tanum lgnum

into table itab.

for all entries in r_matnr

from LTAP

WHERE MATNR = R_MATNR-low.

loop at itab assiging <f_tab>.

if <f_tab>-lgnum in r_lgnum.

itab_final = <f_tab.>

append itab_final

endif.

endloop.

sort itab_final tanum.

delete adjacent duplicates from itab_final comparing tanum.

3.

data : l_ekko type table of ekko with header line,

l_ekpo type table of ekpo with header line,

final_ekpo type table of ekpo with header line.

field-symbols : <f_ekpo> like line of l_ekpo.

check p_test <> 'X'.

select *

into l_ekko

from ekko where ekorg in r_ekorg.

select *

into table l_ekpo

for all entries in l_ekko

where ebeln = l_ekko-ebeln.

loop at l_ekpo assigning <f_ekpo>.

if <f_ekpo>-matnr in r_matnr.

final_ekpo = <f_ekpo>.

append final_ekpo.

endif.

endloop.

clear l_ekpo[], l_ekpo.

free l_ekpo.

loop at final_ekpo assigning <f_ekpo>.

on change of <f_ekpo>-ebeln.

clear count_pu

endon.

add 1 to count_pu.

PERFORM DELETE_PURCHASING_DOCS.

PERFORM COMMIT_CHECK USING count_pu.

endselect.

Regards,

Mohaiyuddin