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 tunning

Former Member
0 Likes
526

Hi,

Please help me improve the performance of my program,it is scanning too many records in the code below and hence taking a lot of time.

form sub_get_hdr_data changing xyt_git_vbak type gty_t_vbak.

REFRESH xyt_git_vbak.

SELECT vbeln

FROM vbak INTO TABLE xyt_git_vbak

WHERE vbeln IN s_vbeln.

SORT xyt_git_vbak by vbeln.

endform. " sub_get_hdr_data

&----


*& Form sub_get_itm_data

form sub_get_itm_data using xt_git_vbak type gty_t_vbak

changing xyt_git_vbap type gty_t_vbap.

REFRESH xyt_git_vbap.

if not xt_git_vbak[] is initial.

select vbeln

matnr

BRGEW

VBELV

POSNV from vbap into table xyt_git_vbap

for all entries in xt_git_vbak

where vbeln = xt_git_vbak-vbeln

and posnr ne space.

sort xyt_git_vbap by vbeln.

endif.

-


Please reply urgently.

thanks.

Subia

1 ACCEPTED SOLUTION
Read only

mvoros
Active Contributor
0 Likes
506

Hi,

honestly there is not too much space to improve performance of your program. Probably there is no space at all. The tables VBAK and VBAP are usually very big. You use primary key for reading data from VBAK, hence there is no space for improvement. Then you use part of the primary key for reading data from VBAP. Hence again there is no space for improvement. There should be no records in VBAP with posnr equals to space. So you can get rid of that condition. As I said, these tables are big and you use primary keys to get data from tables. Therefore I do not see so much space for improvements.

Cheers

4 REPLIES 4
Read only

Former Member
0 Likes
506

Hi Subia,

If the select-option S_VBELN is initial then the select statement fetches all the records from table VBAK.

Try to reduce the selection set by giving more fields in the selection criteria.

When using for all entries in the select statement for fetching item data from VBAP include all the key fields in the table (i.e. VBELN and POSNR) to ensure you get all the items in an order. You can also remove the condition 'posnr ne space'. Create a secondary index for VBAP with the required fields to improve the performanace.

Hope this info is useful.

thanks,

Satya.

Read only

mvoros
Active Contributor
0 Likes
507

Hi,

honestly there is not too much space to improve performance of your program. Probably there is no space at all. The tables VBAK and VBAP are usually very big. You use primary key for reading data from VBAK, hence there is no space for improvement. Then you use part of the primary key for reading data from VBAP. Hence again there is no space for improvement. There should be no records in VBAP with posnr equals to space. So you can get rid of that condition. As I said, these tables are big and you use primary keys to get data from tables. Therefore I do not see so much space for improvements.

Cheers

Read only

Former Member
0 Likes
506

hi,

the number of records scannned is based on the value range u specify in s_vbeln.

in your 2nd select, remove posnr ne space. these unwanted entries can be deleted after the data fetch. specifying inequality condition will bypass the index/key search.

regards,

madhumitha

Read only

Former Member
0 Likes
506

Hi,

Instead of using a sort statement after both the select statements use the addition 'ORDER BY' of select statement itself.

I hope this helps,

Regards

Raju Chitale