Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Performance problem in select query again

Hi Experts,

I have another performance issue with this.

Select matnr werks from marc

Into table i_marc

For all entries in i_mara

Where matnr eq i_mara-matnr.

Loop at I_mara.

Read table i_marc with key matnr = I_mara-matnr.

Endloop.

When I showed this code to my boss he suggested me to do some performance tuning.But i do not have any idea what to do.I am already using for all entries.

Please suggest.

Neeti

Tags:
replied

Hi Neeti,

Generally we should sort the table first before using for all entries, so that you can use binary search in the read command.This follows binary search algorithm and thus improves the performance.Try this.

Select matnr from mara

into table i_mara

Where matnr in s_matnr.

Select matnr werks from marc

Into table i_marc

For all entries in i_mara

Where matnr eq i_mara-matnr.

<b>Sort I_marc by matnr.</b>

Loop at I_mara.

Read table i_marc with key

matnr = I_mara-matnr

<b>binary search.</b>

Endloop.

Hope it helps,

Suruchi

0 View this answer in context

Helpful Answer

by
Not what you were looking for? View more on this topic or Ask a question