cancel
Showing results for 
Search instead for 
Did you mean: 

Regd SELECT ENDSELECT and FOR ALL ENTERIES

Former Member
0 Kudos
226

Hi All,

I have an extraction where i am extraction some data from matrial master and the for these materials i have to get the plant details and material text.

Here my problem is that i have checked the extraction using <b>SELECT ENDSELECT Loop</b> and Also <b>FOR ALL ENTRIES</b>.I analysed both the performance file using se30.

The result is asfollows.

<u><b>FOR ALL ENTRIES</b></u>

ABAP - 82.2%

DB - 17.8%

Time for Execution - 784 Sec

<u><b>SELECT ENDSELECT LOOP</b></u>

ABAP - 36.9%

DB - 63.1%

Time for Execution - 224 Sec

Is it good to use FOR ALL ENTRIES than SELECT Loop because the DB hit is less in FOR ALL ENTRIES.

Is this wright or can i use SELECT LOOP.

Thanks&Regards,

Siva

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi,

SELECT ENDSELECT will have performance issue, it will hit the database as many records it has.

But FOR ALL ENTRIES will improve the performance it will fetch records from database at a strech.

See this link to get a good idea

http://help.sap.com/saphelp_nw04/helpdata/en/66/f9545ed3654bd4b55bf7a5b9953a53/frameset.htm

Thanks & Regards,

Judith.

Former Member
0 Kudos

I think you should use FOR ALL ENTRIES but try to enhance the performance of your ABAP statements.

coding should be :

Get Material Data in say lt_mara.

Get Plant details for the material in a sorted or hashed internal table.

Get Material Text details for the material in a hashed table.

The tables that you have declared as hashed should be accessed (READ TABLE ) with key field, in this case MATNR.

So your program structure will be :

  • For material

DATA : lt_mara type type sorted table of mara with unique key SPRAS.

  • For material text

DATA : lt_plant_detail TYPE hashed table of <ty_plant_details> with unique key MATNR LGORT.

  • For material text

DATA : lt_makt TYPE hashed table of makt

with unique key SPRAS matnr.

GET MATERIAL DATA in lt_mara.

Get Plant details for the material into lt_plant_detail for all entries in lt_mara.

Get Text details for the material into lt_makt for all entries in lt_mara.

  • Now For processing

LOOP AT lt_mara.

  • Wherever you need to access lt_makt / lt_plant_details

READ TABLE lt_makt with

key spars = sy-langu and matnr = lt_mara-matnr.

ENDLOOP.

In case you are not able to declare any of of the itabs as hashed table due to lack of any unique key, you should declare it as sorted table with non-unique key.

Or declare it as standard table but sort it before accessing it and then use

SORT ITAB.

READ TABLE <itab> with key = key1 ....BINARY SEARCH.

This will be a lot more efficient than linear search.

Thanks,

Ram

Former Member
0 Kudos

hi,

In each single case it may be differently.

It depends on:

-how often occurs this extraction?

-is your DB very loaded at this moment?

etc.

Usually, it is better to put the load on ABAP. But 784 sec - it isn't good time for user. But if your extraction occurs rarely and/or your DB is very loaded, it can make sense.

PS You mast execute you extraction more than 1 time (better 3-4) to analise real work time of your extraction..