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

How i can Improve Application server performence with below code

Former Member
0 Likes
314

Can any one suggest me some How i can Improve Application server performence with below code:

Selection like this::

IF delete_flag = lc_y.

DELETE FROM ztobi_gl_revn_ld CLIENT SPECIFIED WHERE mandt = sy-mandt.

ELSEIF delete_flag = lc_n.

IF incremental = lc_n.

*Delete all the records in Z table.

DELETE FROM ztobi_gl_revn_ld CLIENT SPECIFIED WHERE mandt = sy-mandt.

*Select the records from database.

*REVN_LOGIC

SELECT bukrs ktopl FROM t001 INTO TABLE it_itab WHERE ktopl NE ''.

IF sy-subrc = '0'.

SELECT ktopl sakn1 FROM c001 INTO TABLE it_itab1 WHERE kvsl1 = 'ERL'

AND sakn1 NE ''.

SELECT ktopl sakn1 FROM c002 INTO TABLE it_itab2 WHERE kvsl1 = 'ERL'

AND sakn1 NE ''.

LOOping like this::

LOOP AT it_itab1 INTO wa_itab1.

LOOP AT it_itab INTO wa_itab WHERE ktopl = wa_itab1-ktopl.

wa_final-bukrs = wa_itab-bukrs.

wa_final-sakn1 = wa_itab1-sakn1.

LOOP AT it_bsis INTO wa_bsis.

*BSIS fields

wa_revn-mandt = wa_bsis-mandt.

wa_revn-bukrs = wa_bsis-bukrs.

wa_revn-hkont = wa_bsis-hkont.

wa_revn-gjahr = wa_bsis-gjahr.

APPEND wa_final TO it_final.

CLEAR wa_final.

ENDLOOP.

ENDLOOP.

can suggest me some modifications to improve performence..

tks.

Edited by: kumar.p.D on Jan 6, 2010 9:09 AM

Moderator message - Welcome to SCN, but please see before posting. You have posted code where the problem(s) could be in different portions. Please do some research on your own to find out where the problem lies. Then ask the forum how to fix that portion. And use code tags - post locked

Edited by: Rob Burbank on Jan 6, 2010 9:33 AM

1 REPLY 1
Read only

Former Member
0 Likes
289

Hi Kumar,

What I can say is that you have to avoid imbricated loops even though there is a WHERE clause in the second loop (SAP has to check all records in the second loop for this condition...).

On another hand, your code is not very clear since there lacks some ENDIF and ENDLOOP so we don't really see where there is imbricated loops or not...

For the loop on i_bsis, there seems also to have some error since you fill structure wa_revn but you append structure wa_final!!! There seems to be no link between those two structure!

Another point (but that don't affect performance but helps the code to be simpler),

DELETE FROM ztobi_gl_revn_ld CLIENT SPECIFIED WHERE mandt = sy-mandt.

is equivalent to

DELETE FROM ztobi_gl_revn_ld.

(if you add option CLIENT SPECIFIED it is in order to set mandt with another value than the current client!!!).

Best regards,

Samuel