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

*More time to Execute*

Former Member
0 Likes
400

Hi,

The following code is taking more time to execute...

Kindly assist..

  • check wagetype selection

REFRESH it_p8wage.

CLEAR: it_p8wage, wa_p8wage, p8wage_flag.

LOOP AT p0008.

DO 20 TIMES

VARYING wa_p8wage-lgart FROM p0008-lga01 NEXT p0008-lga02

VARYING wa_p8wage-betrg FROM p0008-bet01 NEXT p0008-bet02.

IF wa_p8wage-lgart IN lgartahm

AND NOT wa_p8wage IS INITIAL.

MOVE: 'X' TO p8wage_flag,

p0008-waers TO wa_p8wage-waers.

INSERT wa_p8wage INTO TABLE it_p8wage.

CLEAR wa_p8wage.

ENDIF.

ENDDO.

ENDLOOP.

  • no wagetype mathing found

IF p8wage_flag IS INITIAL.

READ TABLE lgartahm.

IF sy-subrc EQ 0.

REJECT.

ENDIF.

ENDIF.

2 REPLIES 2
Read only

Former Member
0 Likes
375

set a breakpoint in your code and find out where the bottle neck is.

Read only

Former Member
0 Likes
375

Hi,

For each end every employye there may not be data for all the 20 wage types from lga01 bet01..................lga20 and bet20.

in your code it is better to exit the do loop IF wa_p8wage-lgart IS INITIAL rather than looping 20 times even there is no data.

Because wage types will be assigned to an employee in the same sequence form 1,2......20

if the lga03 is initial there there will not be data for lga04 to lga 20.

This may not be the excat reason for slow response time of ur report but may be usefull.

look at the below code for the chane i suggested

LOOP AT p0008.

DO 20 TIMES

VARYING wa_p8wage-lgart FROM p0008-lga01 NEXT p0008-lga02

VARYING wa_p8wage-betrg FROM p0008-bet01 NEXT p0008-bet02.

IF wa_p8wage-lgart IS INITIAL.

exit. " this will exit the do loop

ENDIF.

IF wa_p8wage-lgart IN lgartahm

AND NOT wa_p8wage IS INITIAL.

MOVE: 'X' TO p8wage_flag,

p0008-waers TO wa_p8wage-waers.

INSERT wa_p8wage INTO TABLE it_p8wage.

CLEAR wa_p8wage.

ENDIF.

ENDDO.

ENDLOOP.