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

Performance Problem in Select query

Former Member
0 Likes
1,448

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
Read only

valter_oliveira
Active Contributor
0 Likes
1,410

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
Read only

valter_oliveira
Active Contributor
0 Likes
1,411

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.

Read only

Former Member
0 Likes
1,410

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.

Read only

0 Likes
1,410

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.

Read only

Former Member
0 Likes
1,410

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

Rob

Read only

0 Likes
1,410

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.

Read only

0 Likes
1,410

>

> 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

Read only

Former Member
0 Likes
1,410

Hi,

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

Read only

Former Member
0 Likes
1,410

thanks all

my question is answed

thanks bye

Read only

0 Likes
1,410

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.