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

MBEW performance Issue.

Former Member
0 Likes
990

Hi,

We are fetching records from mbew table using key fields matnr,bwkey.

When we use for all entries option in select statement the system gets hang.

So we are using concept of package size to increase the performance.

It works fine for minimum no of records but for large no of records it doesnt work.

Kindly guide us thru efficient way to resolve this issu.

The code is attached herewith for your reference

SELECT * FROM mard

INTO TABLE it_mard_temp package size 400

FOR ALL ENTRIES IN it_s033

WHERE matnr EQ it_s033-matnr

AND werks EQ it_s033-werks.

IF sy-subrc EQ 4.

MESSAGE e002(sy) WITH 'Record not found'.

ENDIF.

IF it_mard_temp[] IS NOT INITIAL.

SELECT matnr

bwkey

verpr FROM mbew

INTO TABLE it_mbew_temp

FOR ALL ENTRIES IN it_mard_temp

WHERE matnr = it_mard_temp-matnr

AND bwkey = it_mard_temp-werks.

ENDIF.

append lines of it_mard_temp to it_mard.

append lines of it_mbew_temp to it_mbew.

refresh: it_mard_temp,it_mbew_temp.

endselect.

With Regards

***************************Point is assured **********************

4 REPLIES 4
Read only

Former Member
0 Likes
663

Hi,

In my humble opinion I would not go with PACKAGE SIZE.

I would rather get all my data in one hit and then do an ABAP looping on the internal table to process the other SELECT Query

I would have written something like this.


do.
DESCRIBE table itab1 line total_length.
APPEND LINES OF itab1 idx1 TO idx2 TO itab2. 

Select <something something>
for all entries in itab2
where <something something>.

* keep clearing this and keep filling it. It's lesser than SELECT ENDSELECT PACKAGE SIZE
clear : itab2[]
          itab2.
* This is just the logic you can fix the idx2 by dividing the data chunk in 4, 5 or watever parts.

if idx2 = total_length
 EXIT.
endif.
idx1 = idx2.
idx2 = idx2 * 2.

enddo.

The reason for doing like this is I like ABAP to do my processing instead of using any kind of SELECT ENDSELECT even if it's with package size.

This approach might work for you.

Regards

Nishant

P.S.: This is just a demonstrative logic not the actual code

Read only

Former Member
0 Likes
663

Is this code itself within a loop?

Rob

Read only

Former Member
0 Likes
663

after selecting the records from MARD,

you can sort the internal table it_mard_temp by matnr werks

Then Delete the adjacent duplicates from it_mard comparing matnr werks.

Then you can hit the table MBEW with for all entries of it_mard_temp.

Reward if it is useful.

Thanks,

Srinivas

Read only

Former Member
0 Likes
663

Thanks All for your valuable help.

point has been givn