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

Poor performance in VBFA select statement

former_member259894
Discoverer
0 Likes
771

Hi SAP Gurus,

I have a VBFA select statement which goes something like this:

select vbelv posnv posnn vbtyp_v from vbfa

into table i_vbfa

for all entries in is_bil_invoice-it_gen

where vbeln = is_bil_invoice-it_gen-bil_number

and posnn = is_bil_invoice-it_gen-itm_number

and ( vbtyp_n = 'M' or vbtyp_n = 'N' ).

However this statement takes around one whole minute to execute even in Quality.

Please help me optimize this code.

Thanks,

Anita Jeyan.

2 REPLIES 2
Read only

former_member585060
Active Contributor
0 Likes
548

Hi,   

    Just check any secondary index available for the VBFA table, i think you use standard secondary index 'M01' with VBELN and POSNN fields, just check the Status of the Index, if it 'New' you can't use it, if it is 'Active' you can use it. If not 'M01' try with 'Z02' which has fields VBELN and VBTYP_N. Change your I_VBFA table structure to use secondary index.

Ex code with Secondary Index 'Z02':-

TYPES : BEGIN OF ty_vbfa,

           vbeln   TYPE vbfa-vbeln,                " Modified structure to use secondary index

           vbtyp_n TYPE vbfa-vbtyp_n,

           vbelv   TYPE vbfa-vbelv,

           posnv   TYPE vbfa-posnv,

           posnn   TYPE vbfa-posnn,

           vbtyp_v TYPE vbfa-vbtyp_v,

         END OF ty_vbfa.

DATA : i_vbfa  TYPE STANDARD TABLE OF ty_vbfa,

        wa_vbfa TYPE ty_vbfa.

SELECT vbeln

        vbtyp_n

        vbelv

        posnv

        posnn

        vbtyp_v

                FROM vbfa

                INTO TABLE i_vbfa

                FOR ALL ENTRIES IN is_bil_invoice-it_gen

                WHERE vbeln   = is_bil_invoice-it_gen-bil_number

                AND   vbtyp_n IN ('M', 'N')

                AND   posnn   = is_bil_invoice-it_gen-itm_number.

Try with above code and see the performance, modify the I_VBFA structure according to secondary index.

Thanks & Regards

Bala Krishna

Read only

ThomasZloch
Active Contributor
0 Likes
548

VBFA access has been discussed many times before, please search for available information and read SAP note 185530 as a start.


Thread locked.

Thomas