SAP EWM Blog

Today I will describe one of the most frequently used BAdIs in the outbound process during an SAP EWM implementation.

Its purpose is to sort or filter the quants that the system determined according to the standard settings.

It is called from the program /SCWM/SAPLREM_BIN_DET-SRC_BIN_DET every time the system looks for available stock for goods issue.

The BAdI receives the following values as input:

Parameter name Description
iv_call if rough bin determination is running, the value is A
iv_anfml the quantity for which stock has to be found in the current run of the BAdI
iv_vorga the activity type, which is most likely obsolete and no longer used (the possible values can be found in the global constant wmegc_vorga_*)
IS_LTAP the structure of the warehouse task the quant is being searched for
IS_MAT_GLOBAL global material data
IS_MAT_LGNUM warehouse-number-specific material data
IS_MAT_HAZARD hazardous material data
IT_MAT_UOM material data by unit of measure
IS_T331 data of the storage type the run is being performed for (if a storage type group is specified in the search sequence, the structure is not filled).
IS_T333 the settings of the warehouse process type the quant search is being performed with
IT_QMAT the table of quants the system found according to the standard strategy
IT_QMAT_STD the table of the original quants, before SAP's internal BAdI /SCWM/EX_CORE_RMS_I_DETERMINE was run (in my experience it has always been equal to IT_QMAT)
IV_REM_RULE the stock removal strategy that was determined according to the settings
IO_LOG the log object
IV_ROW the row of the IO_LOG object. Used for logging.

 

The BAdI returns:

Parameter name Description
ET_QMAT_CUS the output table of quants the system will use if we need to make changes.
EV_SET the indicator that ET_QMAT_CUS has to be used
CS_ORDIM_CUST warehouse task data in the customer structure

 

So, suppose you are creating a pick warehouse task or looking at the available quants for picking in transaction /SCWM/PRDO. In that case the system starts searching for available quants according to the configured strategy, and this BAdI is called.

You have to be aware that the BAdI may be called several times for one order item, namely:

  • If the storage type search sequence that was determined has more than one storage type (or storage type group) assigned to it. In this case the BAdI is called first for the first storage type, then for each subsequent one, until the quants that were found cover the required quantity  iv_anfml
  • If the current warehouse task was rounded down to less than iv_anfml, then for the remaining quantity the system starts the available quant determination again and the BAdI is called again. Example: iv_anfml = 100 pieces. There are available quants of 50 pieces each in 2 bins. Accordingly, on the first run the system shows those 2 bins, but the warehouse task is created for only 50 pieces, so for the remaining quantity the system starts the available quant determination again. On the next run iv_anfml = 50 pieces. The system shows those 2 bins again, but the available quantity in the first bin is now 0.

So much for when it is called. Next, if you need to sort or filter the quants according to your own logic, you do so and write the result into the output table ET_QMAT_CUS. Do not forget to set the EV_SET indicator if you want the system to accept your changes.

Bear the following BAdI restrictions in mind:

  • quants can only be sorted or deleted, new ones cannot be added.
  • if certain quants were deleted on the first run, they will not reappear on subsequent runs

I hope this article helps you cut down the time you spend writing the functional specification for this BAdI. Good luck!