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

performence problem

Former Member
0 Likes
1,119

Hi All,

I have written a select command on the table COEP based on objnr and vrgng fields ( both are required )

So when i was execuiting the query it was taking too much time for a single record.

Can you guide me the alternative table or alternative how to get the data fastly.

Advanced Thanks for your guidence

Best Regards

Sudhakar

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,072

It may be an index field, but that doesn't mean the index is being used. You can verify this by running an ST05 trace (using the SQL Explain functionality). You'll need an index with both objnr and vrgng probably. Alternatively you could try to find a way to fetch the other index fields in order to use an existing index.

10 REPLIES 10
Read only

Former Member
0 Likes
1,072

There are several options to speed up your query.

- Try to get the key fields. Maybe through COBK.

- See if there's an index defined for your fields. If not, it can be useful to create it. But be careful: adding indices can slow down other actions on the COEP table (like updates).

- Select only the fields that you need (don't use SELECT *)

- Don't use a negative SELECT (as it invokes a full table scan)

With kind regards,

Roel van den Berge

Edited by: Roel van den Berge on Feb 19, 2010 2:31 PM

Read only

Former Member
0 Likes
1,072

Do like if not matching key fields

Loop at itab into wa_tab.

clear itab_coep.

SELECT * FROM COEP INTO itab_coep WHERE OBJNR EQ wa_tab-objnr

APPEND itab_coep to itab_coep1.

delete itab_coep1 where vrgng NE wa_tab-vrgng .

ENDLOOP.

Edited by: Sachin Bidkar on Feb 19, 2010 2:32 PM

Read only

0 Likes
1,072

Hi All,

Thank you for your speed reply.

But still it is taking the time after using the objnr ( index field )

Kindly guide me if any alternative.

Thanks in advance

Best Regards

Sudhakar

Read only

0 Likes
1,072

can you paste your code for that plz

Read only

Former Member
0 Likes
1,073

It may be an index field, but that doesn't mean the index is being used. You can verify this by running an ST05 trace (using the SQL Explain functionality). You'll need an index with both objnr and vrgng probably. Alternatively you could try to find a way to fetch the other index fields in order to use an existing index.

Read only

0 Likes
1,072

Take a look at [Note 115219 - Performance improvements for line items|https://service.sap.com/sap/support/notes/115219]

Regards,

Raymond

Read only

0 Likes
1,072

Hi All,

Please find code below :

SELECT wtgbtr objnr vrgng

FROM coep

INTO TABLE itb_coep

FOR ALL ENTRIES IN itb_aufk

WHERE objnr = itb_aufk-objnr

and vrgng ne 'KOAO'.

The above query is taking too much time to fetch the single record .

Thank you for your guidence

Regrds

Sudhakar

Read only

0 Likes
1,072

for all entries it will take time...

do like this i mentioned earlier

Loop at itb_aufk into wa.

Clear itb_coep.

SELECT wtgbtr objnr vrgng

FROM coep

INTO TABLE itb_coep

WHERE kokrs eq wa-kokrs

objnr = wa-objnr.

APPEND LINES OF itb_coep TO itb_coep1.

ENDLOOP.

DELETE itb_coep1 WHERE vrgng ne 'KOAO'.

i tried this code its working fast...

Read only

0 Likes
1,072

- Check if index COEP~2 is active in (all) database

- Do you need COEP or can you use total tables like COSS and COSP which are cumulated but have much less items.

Regards,

Raymond

Read only

0 Likes
1,072

This is a frequently asked question. If you had searched, you would have found something like:

SELECT wtgbtr objnr vrgng
  FROM coep
  INTO TABLE itb_coep
  FOR ALL ENTRIES IN itb_aufk
  WHERE objnr = itb_aufk-objnr
    AND lednr = '0'
    AND vrgng NE 'KOAO'.

Please use code tags when posting code.

Rob