Additional Blogs by Members
cancel
Showing results for 
Search instead for 
Did you mean: 
Former Member
0 Kudos

Overview

We use LP21 / RLLNACH1 (WM replenishment for fixed bins) in background processing. We have defined background jobs with 3-6 steps which executes RLLNACH1 for different storage types and storage locations. Execution times for biggest storage location were between 45 and 90 minutes. The job is scheduled 6 times every day, which gives total execution time from 4,5 to 7 hours! Every job execution creates 100 - 150 transfer orders, so it should not last so long.

Problem cause

I checked source code and debug the program - it was not performing any long SELECT statements, but the most of the time spends in READ_MATERIAL_NEW_46 form.

I found instructions (RLLNACH1, lines 1461-1471):

LOOP AT inspl.
  LOOP AT p_mard
    WHERE matnr = inspl-matnr
        AND werks = werks
        AND lgort = inspl-lgort.
    EXIT.
  ENDLOOP.
  IF sy-subrc <> 0.
    DELETE inspl.
  ENDIF.
ENDLOOP.

In our case tables p_mard and inspl contain:

- p_mard[] - 511000 rows
- inspl[]     -   59000 rows

When we check definition of P_MARD table:

DATA: BEGIN OF P_MARD OCCURS 100.
    INCLUDE STRUCTURE MARD.
DATA: END OF P_MARD.

it appears to be a standard table.

It is obvious, that searching this table with simple LOOP is very inefficient.

Solution

I created a modification:

*{   REPLACE                                                                  1
*\   LOOP AT inspl.
*\     LOOP AT p_mard
*\       WHERE matnr = inspl-matnr
*\           AND werks = werks
*\           AND lgort = inspl-lgort.
*\       EXIT.
*\     ENDLOOP.
*\     IF sy-subrc <> 0.
*\       DELETE inspl.
*\     ENDIF.
*\   ENDLOOP.
*** RLLNACH1 performance
SORT p_mard[] BY matnr werks lgort.
  LOOP AT inspl.
    READ TABLE p_mard[]
      TRANSPORTING NO FIELDS
      WITH KEY matnr = inspl-matnr
                     werks = werks
                     lgort = inspl-lgort
      BINARY SEARCH.
        IF sy-subrc <> 0.
          DELETE inspl.
        ENDIF.
      ENDLOOP.
*** RLLNACH1 performance - end
*}   REPLACE 

Test results

Results of this change was very satisfactory.

Here are execution times before and after change:
- 5 days before
- 5 days after
- 6 executions every day

execution timesbefore [s]after [s]after / before
MIN27501033,7%
MAX50882164,2%
AVG34411644,8%

As a result of the change described here, program execution time descreased over 25 times.

6 Comments