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

performance issue

Former Member
0 Likes
368

hi all,

i am facing a with a performance issue with below logic.

LOOP AT tcust.

SELECT SINGLE * FROM kna1

WHERE kunnr EQ tcust-kunnr.

LOOP AT t_materials.

PERFORM f1000_get_price.

ENDLOOP.

ENDLOOP.

here tcust having one row & t_materials is having 250 rows so that perform is calling 250- times can u pls help me out in this issue.

3 REPLIES 3
Read only

JozsefSzikszai
Active Contributor
0 Likes
348

hi,

what happens in FORM f1000_get_price?

ec

Read only

Former Member
0 Likes
348

Hi,

You can change the code as below :

Instead using the code below :

LOOP AT tcust.

SELECT SINGLE * FROM kna1

WHERE kunnr EQ tcust-kunnr.

You can use as

select <fieldanames> from kna1 into ito tbale itab for all entries of tcust.

Now you will have the itab with data(250) line items.

Loop at itab.

PERFORM f1000_get_price.

endloop.

Now also it has to go for 250 iterations. We cannot avoid this.

Thanks,

Sriram POnna.

Read only

Former Member
0 Likes
348

Krishna,

If you want to get the price for 250 materials for each of the customers in TCUST, then the code is doing what it is supposed to.

The only thing you can improve is to change the subroutine f1000_get_price so that it can take a table as input (T_MATERIALS), and process them all in one shot. This involves significant changes to the subroutine.

Another thing you can improve upon is to replace LOOP and SELECT SINGLE * with FOR ALL ENTRIES option. Again, this will also involve significant changes to the code and it looks like you are new to ABAP.