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 help

Former Member
0 Likes
293

hi all

i buield this rfc to portal and when i run it it takes like 4,206,413 Microseconds

how i can decrease the time of runnig.

thankes

this is all my code

i reward.

CONCATENATE sy-datum(4) '01' INTO l_stperiod.

tmp_stperiod = l_stperiod.

l_enperiod = sy-datum .

bet_period = l_enperiod - l_stperiod.

LOOP AT costcenters ASSIGNING <fs_cost>.

l_stperiod = tmp_stperiod.

DO bet_period TIMES.

CALL FUNCTION 'ZEMP_MISS_DAYS'

EXPORTING

kostl = <fs_cost>-kostl

period = l_stperiod

TABLES

emp_miss_days = emp_miss_days.

l_stperiod = l_stperiod + 1.

ENDDO.

ENDLOOP.

l_stperiod = tmp_stperiod.

SORT emp_miss_days BY kostl period.

LOOP AT emp_miss_days .

MOVE-CORRESPONDING emp_miss_days TO col_miss_tab.

COLLECT col_miss_tab .

ENDLOOP.

*creating the data

IF costcenters[] IS NOT INITIAL.

SELECT kostl period miss_days

INTO TABLE gt_miss_data

FROM zaverageh_data

FOR ALL ENTRIES IN costcenters

WHERE kostl EQ costcenters-kostl

AND period BETWEEN l_stperiod

AND l_enperiod.

ENDIF.

ENDFUNCTION.

1 REPLY 1
Read only

Former Member
0 Likes
275

hi

you can definetly optimize your code:

Step 1.

"CONCATENATE sy-datum(4) '01' INTO l_stperiod.

tmp_stperiod = l_stperiod.

l_enperiod = sy-datum .

bet_period = l_enperiod - l_stperiod."

I assume you are trying to compute a date range period. This is better done with a function module like "PERIOD_BETWEEN_DATES".

Step2.

Avoid move-corresponding by specifying the fields.

Step 3.

Since you are reading from a ztable, It will help if you can create index for the table

zaverageh_data

Thanking you.