SAP S/4HANA Integration in Embedded EWM

In respect to quality inspection and master data in decentralized and embedded EWM, there are some partly configurable differences to reduce process complexity and data redundancy in embedded EWM.


We’ll go over them in this blog post. The figure below gives an overview of the further and optional interfaces between the ERP part of SAP S/4HANA and EWM components. Dotted arrows mark optional interfaces that will likely not be used in integration of embedded EWM in customer implementations as per activation of their concurrent options for leaner and more direct integration, depicted as solid arrows.


Schematic SAP S/4HANA Transactional Data Integration with Embedded EWM


However, you could still opt for the less lean integration option, in order to be able to use further EWM functionality that is available with this option only. Good examples might be choosing not to eliminate delivery processing from Kanban so as to be able to use wave management alongside the deliveries for Kanban supply or not eliminating the transportation unit for freight order management integration so as to still be able to use EWM-based yard management for status tracking and movements of transportation units and vehicles. On the other hand, options for eliminating inspection rules for inspection lot creation or activating synchronous goods movements (at least from EWM to SAP S/4HANA) seem more likely to occur as positive aspects of data redundancy reduction and tighter integration prevail.


Elimination of Expected Goods Receipts

To simplify processes and eliminate the need for data redundancy replicating and updating transactional data objects between SAP S/4HANA and EWM, the use of persistent expected goods receipt documents was eliminated in embedded EWM. Instead, wherever SAP S/4HANA document data is required in EWM for the creation of inbound deliveries, direct access to purchase orders and manufacturing orders from EWM delivery processing has been made available. Once again, the service adapter framework is used to differentiate between embedded and decentralized EWM contexts.


For expected goods receipt, the service adapter framework will return an instance of class /SCWM/CL_EGR_MANAGER_S4 in context of embedded EWM for service interface /SCWM/IF_EGR_MANAGER. Furthermore, class /SCWM/CL_DLV_EGR2PDI_S4 reuses class /SCWM/CL_DLV_EGR2PDI for inbound delivery creation using the purchase or manufacturing order data calling class, /SCWM/CL_EGR_READER_S4. It is in this class that reading and mapping of given transactional data from SAP S/4HANA to EWM objects takes places emulating transient expected goods receipt data.


In this process, enhancement spot /SCWM/ES_EGR_S4 (Enhancements to Expected Goods Receipt in SAP S/4HANA) has been made available to allow for custom determinations and data mapping toward the emulated expected goods receipt data. It contains BAdIs /SCWM/EX_MAP_EGR_DOCTYPE_S4 (Mapping Document and Item Type for EGR) and /SCWM/EX_MAP_EGR_S4 (Mapping of EGR Data), which can be used to influence the expected goods receipt document and item type determination and the mapping of transactional data from SAP S/4HANA to transient EWM expected goods receipt objects. This expected goods receipt data is then finally used for copying into inbound deliveries, mainly reusing existing copying functionality. BAdIs of enhancement spot /SCWM/ES_ DLV_EGR2PDI (Enhancement Create Inbound Delivery from Expected Goods Receipt) remain available in this context.


Elimination of Notification Documents in Delivery Processing

The use of any notification documents in the delivery interface was eliminated for embedded EWM, also referred to as skip (delivery) request functionality. The ability to create notification documents in a decentralized environment in case of, for example, missing master data is not required in an embedded environment anymore. Therefore, only processing documents remain for the delivery objects in embedded EWM. We will not go into much technical detail about how the skip is achieved; basically, the logic of the transfer or transition service between the notification and the processing document was moved to the message processing layer of the respective document category during mapping into EWM. BAdIs for custom determination of EWM delivery aspects remain fully available.


Optional Elimination of Quality Inspection Engine Inspection Rules

Embedded EWM optionally supports the usage of quality management without using Quality Inspection Engine–based inspection rules. For checking relevancy of quality inspection, the system can be configured to access the quality management material master directly, thereby eliminating redundancy in objects controlling the quality management planning. Transparent table /SCWM/QIOTWM_NIR holds EWM process–relevant data when no inspection rule is used. The location-dependent stock type and the external process step hence can be derived from the warehouse number, inspection object type, inspection process, and quality inspection group.


Again, the service adapter framework has been leveraged to detect the right inspection settings for service /SCWM/IF_AF_QINSP_INT per the given context. For embedded EWM, class /SCWM/CL_QLOT_S4 will be instantiated, retrieving Customizing settings via class /SCWM/CL_QCUST_SEL_INT_S4. The quality management material master data, as stored in table QMAT, will then be enriched by the EWM-relevant data to create the inspection lot (table QALS).


Optional Synchronous Integration for Kanban and Stock Postings

For embedded EWM, there was an initiative early on to bring EWM-triggered goods movements closer to the SAP S/4HANA-based inventory management component, thereby eliminating potentially stuck queues in the until then asynchronous goods movement interface by changing the posting method to synchronous. In synchronous mode, which can optionally be activated on the warehouse number level, any issues or errors arising from either EWM or the materials management’s stock management will be shown to the user when trying to execute the posting from EWM transactions, like /SCWM/POST, /SCWM/DIFF_ANLALYZER, /SCWM/ADGI, and /SCWM/ISU.


At the same time, further attempts have been made to simplify SAP S/4HANA materials management–triggered stock postings and production planning-triggered Kanban events to EWM, optionally eliminating the delivery interface, and have EWM creating (goods movement) warehouse tasks alongside the initiation of materials management–based material documents or production planning-based Kanban status updates. In addition, the synchronous setup for stock postings would also allow for combined EWM and materials management storage locations in one material document, triggered from the respective materials management transactions—specifically, MIGO. In the following sections, we will take a closer look at the rather newly available functionality of synchronous postings.



SAP S/4HANA inventory management uses the central MB_CREATE_GOODS_MOVEMENT function module for its stock postings. This function module can import a parameter on the goods movement header level (IMKPF-EWM_SYNC_POST_REQ) in order to synchronously post a goods movement from SAP S/4HANA to EWM. The function module will still check if the intended movement is really EWM-relevant, basically checking for an embedded EWM warehouse number (IMSEG-EWM_LGNUM) and an EWM-relevant movement type.


Also, the EWM storage bin must be provided (IMSEG-EWM_LGPLA). Should these prerequisites not be fulfilled, the function module might fall back into delivery creation, such a if the warehouse number was managed decentrally. Otherwise, the EWM class for synchronous goods movements, /SCWM/CL_EWM_GOODSMVT_SYNC, is called via its interface, /SCWM/IF_EWM_GOODSMVT_SYNC. Finally, either EWM function module /SCWM/GM_CREATE will be used for triggering an EWM goods movements or function module /SCWM/GM_CANCEL will be called in case of goods movement cancellations.


Enhancement spot /SCWM/ES_CORE_GM contains BAdIs /SCWM/EX_CORE_GM_GMDOC_PACK (Packaging Proposal upon Goods Receipt) and /SCWM/EX_CORE_GM_GMDOC_WT (Automatic Warehouse Task Creation upon Goods Receipt). These can be implemented with custom logic to determine if and how automated packing and warehouse task creation should be performed for goods receipt postings triggered in synchronous goods movements from SAP S/4HANA to EWM.


Transaction MIGO

Over the different SAP S/4HANA versions, more and more goods movement postings, initiated not just by Transaction MIGO but most manufacturing-related transactions for goods movements, have been enabled for synchronization between SAP S/4HANA and EWM. Transaction MIGO offers most extended features for EWM integration however, up to the point of dialog enhancements. The figure below shows an example of a goods issue to cost center processing with movement type 201. Once the movement type has been activated for synchronous goods movements in the respective warehouse number, Transaction MIGO offers the Warehouse Management tab for input of further EWM-related data, like the aforementioned storage bin. It also allows for direct access to the stock overview of the respective warehouse and pulls the stock situation once the material to be posted has been defined.


Transaction MIGO: Warehouse Management Tab for Synchronous Goods Movement Postings


The Warehouse Management tab for input of EWM-related data has been made available through implementation /SCWM/CL_EI_MIGO_WHSE_TAB_S4 of the BAdI definition MB_ MIGO_BADI_INT, internally used and owned by SAP. The BAdI implementation basically dispatches any further calls to class /SCWM/CL_MIGO_S4, which contains the main business logic. Several further classes exist, which are needed for the various processes and reference documents to support the Transaction MIGO–triggered processing of synchronous goods movements to EWM, named /SCWM/CL_MIGO_*_S4—for example, /SCWM/CL_MIGO_WHSE_S4, responsible for the mapping of SAP S/4HANA and EWM warehouse numbers and several additional checks. Other classes manage the handling of reference documents alongside packaging or bin proposals that are available within the different processes. We recommend walking through such classes for a more detailed overview of the technical implementation.



Simplified Kanban is less about synchronization of goods movements, even though goods issue for Kanban supports synchronous stock postings. It focuses instead on the elimination of the delivery object in the SAP S/4HANA to EWM communication for replenishment of stocks, kept, for example, in Kanban containers, from external suppliers or warehouses to the production line. In this case, a replenishment warehouse task is created directly for production supply at container event Empty and may also be confirmed directly at container event Full, both triggered from the Kanban control board. It also supports warehouse task display, cancellation, and reversal.


The demand and supply relationship is maintained by so-called control cycles. Such control cycles have been enhanced to allow for additional EWM-related data maintenance—predominantly, the destination storage bin and the activation of simplified Kanban via the stock transfer replenishment strategy.


Extended Control Cycle Settings for EWM-Related Data


The EWM-related Kanban events are mostly triggered from subroutines of function group MPKB (Container Maintenance for Kanban), belonging to package MD05. All integration between Kanban in production planning in SAP S/4HANA and EWM is done via direct method calls going through interface /SCWM/IF_KANBAN_WT_CONTROL, implementing class /SCWM/CL_KANBAN_WT_CONTROL. On the other hand, in the direction of EWM to Kanban in production planning in SAP S/4HANA, all calls go through interface /SCWM/IF_KANBAN_WT_POST_PRC_S4 and implement class /SCWM/CL_KANBAN_WT_POST_PRC_S4. Here the service adapter framework has been used for class determination and instantiation, following service /SCWM/IF_KANBAN_WT_POST_PRC.



The service adapter framework provides service and interface /SCWM/IF_ERP_GOODSMVT_SYNC to instantiate class /SCWM/CL_ERP_GOODSMVT_SYNC_S4 in the context of embedded EWM (S4_OP_INT). From here, class /SCWM/CL_ERP_GM_MAPOUT is called for a lean simulation of the SAP S/4HANA goods movement posting. The service class itself is called in the central function module of EWM-based goods movements, /SCWM/GM_CREATE. If the current stock posting is relevant for synchronous ERP posting, and there are no errors coming back from the SAP S/4HANA posting simulation, the EWM goods movement will be committed using function module /SCWM/GM_POST.


Thereafter, the SAP S/4HANA goods movement posting will be performed using function module /SCWM/ERP_GM_SYNC_UPD_S4 with a synchronous call of function module /SPE/GOODSMVT_CREATE, meaning in the same logical unit of work. BAdI /SCWM/EX_ERP_GOODSMVT_EXT is available for custom changes to the goods movement posting (e.g., for custom movement type determination logic) beforehand. However, if the stock has a delivery or production material request document reference, or is in any way not relevant for synchronous posting, the SAP S/4HANA goods movement posting will again be performed with an asynchronous call of function module /SPE/GOODSMVT_CREATE, triggered via a respective logistics inventory management engine collection in a separate logical unit of work, using function module /LIME/DOCUMENT_POST.


Optional Elimination of EWM Shipping and Receiving Transportation Unit

While the formerly available transportation unit–based EWM integration with SAP TM works with the EWM transportation unit, the advanced shipping and receiving integration of SAP TM and EWM has a different, simplified design. The transportation unit is basically skipped, and the EWM deliveries and handling units are directly integrated with the TM freight order on the single freight unit level. In addition, a new document type called the consignment order has been introduced with SAP S/4HANA 2020 and is supported by the advanced shipping and receiving integration only. This document type can group transportation requirements based on certain criteria, such as the same source and destination location or the same delivery date and time. On top of that, more statuses are introduced, which allow for a higher frequency of data synchronization between the SAP S/4HANA or EWM delivery and the SAP TM freight order. Last but not least, advanced shipping and receiving allows for a combination of EWM- and materials management–managed storage locations in one freight order.


The service adapter framework has again been used to differentiate between different transportation planning types stored on the EWM delivery header level. Service and interface /SCWM/IF_AF_SR_TRANSPORT instantiate class /SCWM/CL_AF_SR_TRANSPORT, which implements common methods for either shipping and receiving or advanced shipping and receiving environments.


The entire EWM and SAP TM integration with its different integration options is too large a topic to be handled here. We therefore recommend checking out additional information sources, like the SAP Help information for both EWM and SAP TM.


Integration of Just-in-Time Processing with EWM

Just-in-time (JIT) processing is a common and frequently used concept in repetitive and discrete manufacturing, such as in the automotive industry, dealing with supply-to-line processes for large quantities of products and allowing for accurate forecasting of replenishment. It is based on tight alignment between suppliers and production warehouses. Embedded EWM can create (and update) stock transfer deliveries from JIT calls, which represent replenishment requests generated from the JIT processing application. We recommend checking out the SAP Help on EWM for a good overview of JIT processing in regard to integration with embedded EWM.


Enhancement spot /SCWM/ES_JIT includes BAdIs for custom fields in JIT deliveries (/SCWM/EX_JIT_CUSTOM_FIELDS, Use of Custom Fields in Warehouse Requests for JIT Processing) and monitor selections (/SCWM/EX_JIT_CUSTOM_SELECT_MON, Custom Selection Fields in Warehouse Monitor Nodes for JIT), as well as delivery document and item type mappings (/SCWM/EX_JIT_MAP_DOCTYPE, Definition of Document & Item Type at Warehouse Request Creation for JIT Call).


Extensibility Guide for JIT and EWM Integration

We strongly recommend reading the Extensibility Guide for JIT-EWM-Integration for further information on the JIT and EWM integration architecture and enhancement options in supply-to-line processing, considering not just JIT-based processes, but also further EWM components’ BAdIs that might be of interest in extending the overall process with custom logic. The guide is available from the SAP Community wiki.


Editor’s note: This post has been adapted from a section of the book EWM with SAP S/4HANA: Architecture and Programming by Peter Zoellner, Robert Halm, Daniela Schapler, and Karen Schulze.


EWM with SAP S/4HANA: Architecture and Programming
EWM with SAP S/4HANA: Architecture and Programming

Your warehouse is unique, so your system must be too! Explore your options for extending and customizing both embedded and decentralized EWM in SAP S/4HANA. Use function modules, BAdIs, and custom code to alter the UI, automate processes, change standard procedures, and more. With detailed examples and sample code, you can ensure that your warehouse management solution suits your business precisely!

Learn More

SAP PRESS is the world's leading SAP publisher, with books on ABAP, SAP S/4HANA, SAP CX, intelligent technologies, SAP Business Technology Platform, and more!