Application Development 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: 

Performance Problem in Select query

Former Member
0 Kudos

Hi,

I have performance Problem in following Select Query :

SELECT VBELN POSNR LFIMG VRKME VGBEL VGPOS

FROM LIPS INTO CORRESPONDING FIELDS OF TABLE GT_LIPS

FOR ALL ENTRIES IN GT_EKPO1

WHERE VGBEL = GT_EKPO1-EBELN

AND VGPOS = GT_EKPO1-EBELP.

as per trace i have analysed that it is fetch the complete table scan from the LIPS table and table contants almost 3 lakh records.

Kindly Suggest what we can do to optimize this query.

Regards,

Harsh

1 ACCEPTED SOLUTION

valter_oliveira
Active Contributor
0 Kudos

It happens because LIPS doesn't have an index to VGBEL (and VGPOS).

Since I think you cannot use VBFA to make an alternative selection you probably have to create an index in LIPS with field MANDT-VGBEL (or vgbel and vgpos, but vgbel is enough I think).

Regards,

Valter Oliveira.

9 REPLIES 9

valter_oliveira
Active Contributor
0 Kudos

It happens because LIPS doesn't have an index to VGBEL (and VGPOS).

Since I think you cannot use VBFA to make an alternative selection you probably have to create an index in LIPS with field MANDT-VGBEL (or vgbel and vgpos, but vgbel is enough I think).

Regards,

Valter Oliveira.

Former Member
0 Kudos

types: begin of line,

vbeln type lips-vbeln

posnr type lips-posnr

lfimg type lips-lfimg

vrkme type lips-vrkme

vgbel type lips- vgbel

vgpos type lips-vgpos

end of line.

data: itab type standard table of line,

wa type line.

IF GT_EKPO1[] IS NOT INITIAL.

SELECT VBELN POSNR LFIMG VRKME VGBEL VGPOS

FROM LIPS INTO TABLE ITAB

FOR ALL ENTRIES IN GT_EKPO1

WHERE VGBEL = GT_EKPO1-EBELN

AND VGPOS = GT_EKPO1-EBELP.

ENDIF.

0 Kudos

INTO CORRESPONDING FIELDS OF TABLE is not a performance problem ! You do what Yogesh proposed (it's better) but won't solve your problem tough.

Regards,

Valter Oliveira.

Former Member
0 Kudos

You should be able to use the sales document flow table (VBFA) to do this.

Rob

0 Kudos

You should be able to use the sales document flow table (VBFA) to do this

Since we are dealing with non SD documents i'm not sure if you can, but I don't have a SAP system here to check it right now.

Regards,

Valter Oliveira.

0 Kudos

>

> Since we are dealing with non SD documents i'm not sure if you can, but I don't have a SAP system here to check it right now.

Hmmm...

I missed the part about purchase orders, so maybe note 800219 is applicable.

Rob

Former Member
0 Kudos

Hi,

The comment made by Valter Oliveira is right. You have to create secondary index for LIPS

Former Member
0 Kudos

thanks all

my question is answed

thanks bye

0 Kudos

Harsh,

It sure would help others if you could mention how the issue was solved too. Now, thats the idea behind SDN, isnt it?

Regards,

Rashmi.