on 07-13-2009 5:00 PM
Hai,
I have an user exit in 2LIS_03_BF,when i am extracting the data it is taking so much time,the issue is with this below routine,
can any one tune this coding.
***********************************************************************
To populate the value of vbelv from table vbfa comparing vbeln with mseg-mblnr
WHEN '2LIS_03_BF'.
TYPES:BEGIN OF ty_vbfa,
vbeln TYPE vbfa-vbeln,
vbelv TYPE vbfa-vbelv,
END OF ty_vbfa.
DATA:git_vbfa TYPE TABLE OF ty_vbfa,
gs_vbfa LIKE LINE OF git_vbfa.
DATA:c_data1 LIKE ls_mc03bf0 OCCURS 0 .
c_data1[] = c_t_data[].
SELECT vbeln
vbelv
FROM vbfa
INTO TABLE git_vbfa
FOR ALL ENTRIES IN c_data1
WHERE vbeln = c_data1-mblnr.
SORT git_vbfa BY vbeln ASCENDING.
REFRESH: c_data1.
FREE: c_data1.
LOOP AT c_t_data INTO ls_mc03bf0.
l_tabix = sy-tabix.
READ TABLE git_vbfa INTO gs_vbfa WITH KEY vbeln = ls_mc03bf0-mblnr BINARY SEARCH.
IF sy-subrc = 0.
ls_mc03bf0-vbelv = gs_vbfa-vbelv.
MODIFY c_t_data FROM ls_mc03bf0 INDEX l_tabix.
ENDIF.
ENDLOOP.
REFRESH: git_vbfa.
FREE: git_vbfa.
**************************************************************************
Regards,
Harsha
Hi Harsha
I think the problem could be due to 'FOR ALL ENTRIES'. we expect that the for all entire will enhance performance. However it degrades the performance when no. of entries is high. I believe 2lis_03_bf will bring in quite a lot records even in delta extraction
also whenever your are using for all entries you must make use of as many 'key fields' as possible in where clause
Use of FOR ALL Entries
Outer join can be created using this addition to the where clause in a select statement. It speeds up the performance tremendously, but the cons of using this variation are listed below
Duplicates are automatically removed from the resulting data set. Hence care should be taken that the unique key of the detail line items should be given in the select statement.
If the table on which the For All Entries IN clause is based is empty, all rows are selected into the destination table. Hence it is advisable to check before-hand that the first table is not empty.
If the table on which the For All Entries IN clause is based is very large, the performance will go down instead of improving. Hence attempt should be made to keep the table size to a moderate level.
hope this helps.
regards
Sanjyot
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Try this, couldn't do syntax check though...
To populate the value of vbelv from table vbfa comparing vbeln with mseg-mblnr
WHEN '2LIS_03_BF'.
TYPES: BEGIN OF ty_vbfa,
vbeln TYPE vbfa-vbeln,
vbelv TYPE vbfa-vbelv,
END OF ty_vbfa.
FIELD-SYMBOLS <vbfa> TYPE ANY.
FIELD-SYMBOLS < gs_vbfa> TYPE ANY.
DATA: git_vbfa type sorted table of ty_vbfa with unique key vbeln.
Data : gs_vbfa LIKE LINE OF git_vbfa.
DATA: c_data1 LIKE ls_mc03bf0 OCCURS 0 .
c_data1[] = c_t_data[].
SELECT vbeln vbelv FROM vbfa
INTO Corresponding fields of TABLE git_vbfa
FOR ALL ENTRIES IN c_data1
WHERE vbeln = c_data1-mblnr.
REFRESH: c_data1.
FREE: c_data1.
LOOP AT c_t_data assigning <vbfa>
l_tabix = sy-tabix.
READ TABLE git_vbfa WITH TABLE KEY vbeln = <vbfa>-mblnr BINARY SEARCH assigning< gs_vbfa> .
IF sy-subrc = 0.
ls_mc03bf0-vbelv = <gs_vbfa>-vbelv.
MODIFY c_t_data FROM ls_mc03bf0 INDEX l_tabix.
ENDIF.
ENDLOOP.
REFRESH: git_vbfa.
FREE: git_vbfa.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
WHEN '2LIS_03_BF'.
TYPES:BEGIN OF ty_vbfa,
vbeln TYPE vbfa-vbeln,
vbelv TYPE vbfa-vbelv,
END OF ty_vbfa.
DATA:git_vbfa TYPE TABLE OF ty_vbfa,
gs_vbfa LIKE LINE OF git_vbfa.
DATA:c_data1 LIKE ls_mc03bf0 OCCURS 0 .
c_data1[] = c_t_data[].
SORT c_data1 by mblnr.
Delete Adjacent duplicates from c_data1 comparing mblnr.
Delete c_data1 where mblnr is initial.
If c_data1[] in not initial.
SELECT vbeln
vbelv
FROM vbfa
INTO TABLE git_vbfa
FOR ALL ENTRIES IN c_data1
WHERE vbeln = c_data1-mblnr.
If sy-subrc = 0.
SORT git_vbfa BY vbeln ASCENDING.
REFRESH: c_data1.
FREE: c_data1.
LOOP AT c_t_data INTO ls_mc03bf0.
l_tabix = sy-tabix.
READ TABLE git_vbfa INTO gs_vbfa WITH KEY vbeln = ls_mc03bf0-mblnr BINARY SEARCH.
IF sy-subrc = 0.
ls_mc03bf0-vbelv = gs_vbfa-vbelv.
MODIFY c_t_data FROM ls_mc03bf0 INDEX l_tabix.
ENDIF.
ENDLOOP.
REFRESH: git_vbfa.
FREE: git_vbfa.
ENDIF.
ENDIF.
Hope this imporves the performnace a lot. Let me know after testing.
Regards
Ramesh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.