Skip to Content
avatar image
Former Member

Performance tuning of user exit in 2LIS_03_BF

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

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • avatar image
    Former Member
    Jul 13, 2009 at 11:46 PM

    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

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jul 14, 2009 at 01:08 AM

    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.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jul 14, 2009 at 09:29 AM

    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

    Add comment
    10|10000 characters needed characters exceeded