Application Development and Automation 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: 
Read only

Problem in selection data from database APO

Former Member
0 Likes
527

Hi

I need to have improvement in below program but not sure if there is any major issue in performance of this program.

as the date being selected is huge ,but need to know how much we can imrove this program as far as performance is concerned.

below is the code for which I have done the analysis ALREADY and need suggestion to improve on the code further since the amount of database selection is huge in APO and its close to 10 GB..but now sure if any performance improvemetn suggestion here will help on the same..

pelase suggest how to maximize the code this is based on the final reduction in code done to below code

select 1

SELECT matnr INTO (lt_zmatloc-/bic/zcmatloc)

FROM /sapapo/matkey

WHERE matnr IN prod_sel.

itotal-mat_no = lt_zmatloc-/bic/zcmatloc.

APPEND itotal.

ENDSELECT.

SORT itotal ASCENDING.

DELETE ADJACENT DUPLICATES FROM itotal COMPARING mat_no.

select 2

LOOP AT itotal into lw_itotal.

SELECT SINGLE * INTO lw_matkey FROM /sapapo/matkey WHERE matnr = lw_itotal.

PERFORM get_lanes.

PERFORM compute_attr.

ENDLOOP.

form get lanes is as below

SELECT locfr locto matid INTO (lt_trprod-locfr, lt_trprod-locto, lt_trprod-matid)

FROM /sapapo/trprod

WHERE matid = lw_matkey-matid AND estkz = 'S'.

ilanes-locfr = lt_trprod-locfr.

ilanes-locto = lt_trprod-locto.

ilanes-matid = lt_trprod-matid.

APPEND ilanes.

ENDSELECT.

FORM compute_attr is as below

LOOP AT ilanes.

SELECT locno INTO lw_locparent FROM /sapapo/loc WHERE locid = ilanes-locfr.

ENDSELECT.

SELECT SINGLE matnr INTO lw_matnr FROM /sapapo/matkey WHERE matid = ilanes-matid.

SELECT locno INTO lw_locchild FROM /sapapo/loc WHERE locid = ilanes-locto.

ENDSELECT.

iattr-version = '000'.

iattr-zclocno = lw_locchild.

iattr-zcmatnr = lw_matnr.

iattr-zbod_lvl = low_lvl.

iattr-zbod_prnt = lw_locparent.

APPEND iattr.

MODIFY /lgc/ssbod_attr FROM iattr.

iattr-version = '000'.

iattr-zclocno = lw_locparent.

iattr-zcmatnr = lw_matnr.

iattr-zbod_lvl = high_lvl.

APPEND iattr.

ENDLOOP.

SORT iattr ASCENDING.

DELETE ADJACENT DUPLICATES FROM iattr COMPARING ALL FIELDS.

MODIFY /lgc/ssbod_attr FROM iattr.

please suggest what more performance impr can be done on this and how much will it can improve the selection or fetching from database.. by %wise

regards

Arora

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
461

Hi!

in select 2 you loop for all records in ilanes, not for current matid only.

Change SELECT ENDSELECT statement to

SELECT INTO ilanes...FOR ALL ENTRIES in itotal...

then

PERFORM get_lanes.

PERFORM compute_attr.

OR add WHERE in LOOP AT ilanes...

Regards!

2 REPLIES 2
Read only

Former Member
0 Likes
462

Hi!

in select 2 you loop for all records in ilanes, not for current matid only.

Change SELECT ENDSELECT statement to

SELECT INTO ilanes...FOR ALL ENTRIES in itotal...

then

PERFORM get_lanes.

PERFORM compute_attr.

OR add WHERE in LOOP AT ilanes...

Regards!

Read only

0 Likes
461

Hi Andreay

Thanks for hte reply can u pleae eloborate a bit more and provide some more suggestion also we need to consider that the data fetched should not be chagned by the change in code

regards

Arora