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

Query performance

Former Member
0 Likes
805

Hi Gurus,

please can you tell me how to speed up the performance of a query where I used a custom field (NUMEROBOLLA) with a search coded as below:

clear NUMEROBOLLA.

select single XABLN from LIKP into NUMEROBOLLA

where vbeln = CONSEGNA.

CONSEGNA is another custom field where I retrive SD Delivery number.

Thank you very much

Kind Regards

Andrea

7 REPLIES 7
Read only

Former Member
0 Likes
770

HI,

If you are writing the SELECT Statement in the LOOP..ENDLOOP statement then it can be a performance issue. You can this select statement outside the Loop using SELECT ..FOR ALL ENTRIES and read the table for the XABLN in the Loop.

Read only

Former Member
0 Likes
770

Hi:

To avoid this type of dilemna, i would advice to use function module like C1CE_LIKP_READ

Regards

Shashi

Read only

Former Member
0 Likes
770

Avoid using select single in loop.

If possible try to use all the key fields in where condition.

for eg.

CONSTANTS: c_vbeln TYPE vbfa-vbeln VALUE IS INITIAL,

c_posnn TYPE vbfa-posnn VALUE IS INITIAL,

c_vbtyp_n TYPE vbfa-vbtyp_n VALUE IS INITIAL,

CASE1:

SELECT vbelv posnv vbeln posnn vbtyp_n rfmng meins

INTO TABLE i_vbfa FROM vbfa

WHERE vbelv IN so_vbeln

AND posnv IN so_posnv.

CASE2:

SELECT vbelv posnv vbeln posnn vbtyp_n rfmng meins

INTO TABLE i_vbfa FROM vbfa

WHERE vbelv IN so_vbeln

AND posnv IN so_posnv

AND vbeln GE c_vbeln

AND posnn GE c_posnn

AND vbtyp_n GE c_vbtyp_n.

This will definitely improve the performance to a considerable extent.

Edited by: harsh bhalla on Mar 30, 2009 1:11 PM

Read only

ThomasZloch
Active Contributor
0 Likes
770

VBELN is the primary key of LIKP, so there is no problem with your query.

Thomas

Read only

former_member131774
Contributor
0 Likes
770

You use key field in the search so this sql does not have problem.

But you need to check if this kind of sql is used inside the LOOP.

Also you need to check NUMEROBOLLA is the same type of XABLN.

Read only

Former Member
0 Likes
770

Please try to include some more conditions in where .

This will provide slight improvement in performance.

Also , if possible replace Select single from Database table to Read statement on the internal table.

Read only

0 Likes
770

"Please try to include some more conditions in where. This will provide slight improvement in performance."

How can someone say this things? Why don't you answer only if you know what you are saying?

And how can you give points to this? Please read what Thomas said ... that's your correct answer.

Regards and good luck!

Valter Oliveira.