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 in report programming..

former_member192432
Participant
0 Likes
925

Hi,

I am using one customized Function Module whithin a loop of internal table containing fields of PROJ table for about 200 records . And in the source code of function module there is set of select queries for different tables like COSS COSP , AUFK , PRPS , BPJA PRHI , AFPO , AFKO etc . so due to that my performance of a report is very low , So how can i improve it .

Is there any other way to change a code.

regards

Chetan

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
889

I am going to repeat what Karthik has already said. You have 8 SELECT statements in the FM and you are calling the FM 200 times. That means, a total of 1600 SELECT statements are executed.

Instead, you call the FM once, but send all the 200 records in an internal table. In the FM, you should use FOR ALL ENTRIES option of the SELECT statement and make 8 calls.

I am pretty sure there are other things that are causing the performance issues, but we can't help without looking at the code.

8 REPLIES 8
Read only

Former Member
0 Likes
889

Hi,

Why not you modify the FM code so as to accept multiple entries and return results in a single go?

Regards

Karthik D

Read only

Former Member
0 Likes
889

Hi Chetan ,

When you are calling a function module in loop , this means there will be some common logic that you can find in this FM.

Like if there is select on a particular table in loop it hits database number of time , there can be posibility that you put one select on this table and later read data by Read statement.

In all , you need to replace that FM with some common logic and some specific to each record in loop.

Hope you understand the concept.

Read only

Former Member
0 Likes
889

Could you provide snipepts of your code (including the function module)? It is hard to give you more detailed advice without more detailed information.

What version of SAP are you on?

Why are you calling the function module?

Are you after all of that data provided by the function module?

Cheers

John

Read only

0 Likes
889

Hi John ,

I am using SAP ECC 6.0 .

The report is used to update a ztable which is already created for Project System plan data .

So i am calling function module which will return a internal table , I am appending this to other internal table and refreshing it , like this I am doing for each project within a loop of PROJ internal table , finaly by using the final itab I am modifying the ztable fields.

Code is as below..

select pspid from proj client specified into corresponding fields of

table t_itab1 where mandt = sy-mandt

and pspnr in s_pspnr

and vbukr = p_vbukr

and prctr in s_prctr.

loop at t_itab1.

l_pspid = t_itab1-pspid.

CALL FUNCTION 'ZPS_FUN_BUDGETS'

EXPORTING

L_PSPID = l_pspid

L_VBUKR = p_vbukr

TABLES

T_DATA = t_itab2 .

loop at t_itab2.

append t_itab2 to t_itab.

endloop.

clear : t_itab2.

refresh : t_itab2.

endloop.

LOOP AT t_itab.

***MODIFY ZTABLE.*****

ENDLOOP.

Regards

Chetan

Read only

0 Likes
889

Hi Chetan .

Try to figure out alternate logic for FM ZPS_FUN_BUDGETS . It should be in such a way that there should be minimum select statements and the READ from the respective internal table.

Hope you got it.

Read only

0 Likes
889

How is the function module coded? What do those selects look like? If you use the function module you are stuck with it performance unless you change the function module just remember where it is used. Changing it coule impact other programs.

One option is to actually code the selects in your code. Another is the change the fucntion module or copy it. Are you using all of the data from all of the tables in the function module?

Are you taking into account that your internal table (t_itab1) might have duplicate pspid and vbukr combinations in it?

Cheers

John

Read only

Former Member
0 Likes
890

I am going to repeat what Karthik has already said. You have 8 SELECT statements in the FM and you are calling the FM 200 times. That means, a total of 1600 SELECT statements are executed.

Instead, you call the FM once, but send all the 200 records in an internal table. In the FM, you should use FOR ALL ENTRIES option of the SELECT statement and make 8 calls.

I am pretty sure there are other things that are causing the performance issues, but we can't help without looking at the code.

Read only

former_member192432
Participant
0 Likes
889

thanks for reply..