‎2008 May 03 10:40 AM
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
‎2008 May 04 5:07 AM
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
‎2008 May 03 1:02 PM
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.
‎2008 May 04 5:07 AM
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
‎2008 May 05 5:43 AM
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
‎2008 May 05 6:15 AM
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