Enhance SAP EWM – Quant determination for stock removal

Enhance SAP EWM

Quant determination for stock removal strategy

The purpose of this series of blogs/videos is to give an overview about how to enhance specific functional areas of SAP EWM quant determination. This series is useful for developers jumping (or being pushed ) from other modules into EWM or for more experienced consultants in order to gain a deeper understanding of specific topics.

In this post we focus on the stock removal rule. Thus, we ignore all other functions which have an impact on the source SAP EWM quant determination (e.g. storage type search sequence, warehouse process type etc.).
For a better understanding just imagine sitting in front of a rack with many different bins storing the same product but with different quantities, GR dates, Best-before-dates, Units of Measure, HU type, number of open tasks and so on.

What is possible via standard customizing?
No #1 rule for every EWM consultant – always explore standard options ahead of touching the code. Even the smallest development will kick your ass with small surprises (latest the person who has to support your Z-ideas ).
This customizing node answers the question about which source bin/quant to select in order to create a warehouse task against a warehouse request item:

As mentioned above, EWM gives us a long list of stock attributes which can be used to sort possible source quants. Simply select the attributes that you want to consider, put them in a meaningful sequence and set the flag to sort descending if needed (if you do not set the flag, EWM will sort ascending by default). This customizing is stored in table /SCWM/T334RR.

Open (german-speaking) EWM-Jobs @

Most common examples are a sorting based on WDATU in order to realize FIFO/LIFO or a sorting based on VFDAT in order to realizes FEFO/LEFO. Usually this is combined with a sorting based on QUAN in order to clean up partially filled bins or in order to minimize the number of picks per warehouse request item.
I do explain more complex examples as part of the video about this topic.

Where can I find the standard coding?
In case you have a problem with the standard behavior that needs to be debugged or in case you are just curious about how the standard coding processes the customizing mentioned above, you need to look at include /SCWM/LREM_BIN_DETF12.
In subroutine rem_rule_get (1) EWM reads table /SCWM/T334RR which stores the customizing. Once done, subroutine qmat_sort applies the sorting to the internal table of possible source quants (ct_qmat):

How can I enhance here in a ‘clean’ way?
Badi /SCWM/EX_CORE_RMS_DETERMINE is not the only option to implement a custom stock removal rule but one of the most powerful and most used ones:

The interface method imports lots of data which can be used as a base for a custom logic. E.g. stock data (> ct_qmat imports stock details based on the AQUA table), product master data or customizing details about source storage type and warehouse process type:

Inside of the Badi you use this data as an input in order to change the sorting and/or the content of the internal table ct_qmat. You write the changed data into table et_qmat_cus and export this table to the caller program. In addition to this you must set the flag lv_set in order have the standard consider your changes:

Bonus (to get inspired)
SAP delivers a handful of sample implementations. You can use those to explore the options that you have with this Badi and learn how to implement an enhancement here in a technically accurate way:

As an example we take a look at class /SCWM/CL_EI_CORE_RMS_DET_MFS which implements a logic that evaluates the status of the MFS resources (e.g. cranes for an automated high-bay warehouse). If the resources are not available (e.g. ran into an error and not recovered yet) the bins/quants from the respective aisles are excluded from the list of possible source bins/quants:

Summary
– EWM standard already provides a pretty powerful customizing which can be used to sort possible source quants based on one or multiple stock attributes. Evaluate all options around the standard customizing before you consider implementing the Badi!
– Badi /SCWM/EX_CORE_RMS_DETERMINE is the place to be in case you want to implement your own logic to select a source quant for picking/stock removal
– Before you implement your own logic, have a look at the standard example classes in order to learn and get inspired!

I hope this blog post provides value to you and you could learn something. Please feel free to subscribe to my blog updates or my youtube channel in case you want to be notified about new posts!

Get my monthly blog-updates!

Subscribe to my Youtube channel!