large table VBRK: No field of a table index in where condition

large table VBRK: No field of a table index in where condition

 

Hi,

 

Code inspector says "large table VBRK: No field of a table index in where condition" for the below query.

 

Am i getting this error because of not using key field VBELN in my where condition?

 

Guide me to proceed further

 

OPEN CURSOR c1 FOR SELECT vbeln

fkart

vkorg

inco2

zlccode

sfakn

fksto

vbtyp

fkdat

zcpord

zlord

 

FROM vbrk

WHERE sfakn EQ space

AND fksto EQ space

AND fkart IN s_biltyp

AND ( fkdat IN s_doc_dt

AND fkdat IN invdate)

AND land1 IN s_count

AND zcpord IN s_cuspo

AND rfbsk = 'C'.

DO.

 

FETCH NEXT CURSOR c1 INTO wa_vbrk.

 

IF sy-subrc <> 0.

 

CLOSE CURSOR c1.

 

EXIT.

 

ELSE.

 

APPEND wa_vbrk TO it_vbrk.

CLEAR wa_vbrk.

 

ENDIF.

 

ENDDO.

 

Regards,

Vjai

 

 

 

 

 

  • Hi

     

    It's a performance problem, your query doesn't use the key field or fields belonging to an index of VBRK, so the selection could take a long time.

     

    Now the problem is to understand what you really need....probably a solution can be to create an index....

     

    • Thanks for your reply. I am sure that itu2019s a performance problem.

       

      Vbeln is the key field which is not used in the where condition of the query.

       

      What about the performance if I change with select query instead of open cursor..

       

      Regards,

      Vjai

       

      • Hi

         

        I don't think you improve the performance

         

        If the selection takes too long time, you need to considere to create an index or change the logic of your selection (if it's possible of course)

         

        Max

Error: No first field of table index in where condition

 

I've got following errors while doing code inspector or extended syntax check:

(Large table VEKP: No first field of table index in where condition).

 

My code is like below as per as code-logic.

What's the necessary changes to do to remove the above code?

 

SELECT VENUM

BRGEW

BTGEW

BTVOL

VOLEH

VHILM

LMENG

BREIT

HOEHE

MEABM

VPOBJKEY

FROM VEKP

INTO TABLE i_vekp

WHERE vpobjkey = w_mkpf-xblnr.

 

IF sy-subrc = 0.

SORT i_vekp BY venum.

ENDIF.

 

 

How can I remove the error? How to use index in where clause I'm not getting and on which key? or, should I use the statement "EC C1_NOFIRST to remove the error?

 

Kindly guide.

 

  • should I use the statement "EC C1_NOFIRST to remove the error?

     

    you can not really ask this question in this forum. This check gives you hints to the most serious problems in database accesses, if you want to override it, then you should better forget about performance.

     

    If you are not familiar how databases use indexes, then check resources in the net or in books, in

    short they use indexes and the indexes are absolutly necessary with large tables, if you want to get

    good performance.

     

    But indexes can only be used in the order of their field, until a field is not used in the WHERE-condition, (gap). If the gap is already the first field, then the index can not be used at all.

     

    In your case there is not first field of any index specified in the WHERE condition, so the SELECT might be slow. Either you can add a condition on a first index field or you have to live with a poor performance.

     

    Siegfried

     

     

    • This is not a syntactical error.

       

      Extended syntax check was done and such messages are only viewable under SLIN.

      As this is not syntactical error, so i can definitely ask this question under this forum as it is related to performance.

       

      Anyway thanks a lot for your detailed explaination on index for sure.

      Best regards.

       

       

       

        • sap_kolkata06 wrote:

           

          > This is not a syntactical error.

          >

          > Extended syntax check was done and such messages are only viewable under SLIN.

          > As this is not syntactical error, so i can definitely ask this question under this forum as it is related to performance.

          >

          > Anyway thanks a lot for your detailed explaination on index for sure.

          > Best regards.

           

          I think that the first answer I gave is the one you are looking for. field VPOBJ can easily be added to the where (using all the domain values if necessary). This will both speed up performance and get rid of the extended syntax warning. See [Using an Index When You Don't Have all of the Fields|/people/rob.burbank/blog/2006/09/13/using-an-index-when-you-dont-have-all-of-the-fields]

posted @ 2012-10-26 12:15  VerySky  阅读(4867)  评论(0)    收藏  举报