EWM-MES Direct Integration For Receiving HUs in EWM
This technical blog post is intended to share my experience with A2A (Application to Application) Interface for the EWM-MES Integration without middleware. MES application in this A2A integration is a non-SAP system. In the Decentralized-EWM system, there are few important APIs provided by SAP for a smooth integration with Manufacturing Execution System (MES), some of the most useful of them are as below:
- /SCWM/MFG_CONSUME_ITEMS_EXT Consumption of Goods from Production
- /SCWM/MFG_READ_STOCK_EXT Stock Information from Production
- /SCWM/MFG_RECEIVE_HUS_EXT Receive HUs
- /SCWM/MFG_REVERSE_HUS_EXT Reverse HUs
- /SCWM/MFG_REVERSE_ITEMS_EXT Consumption Reversal from Production
- /SCWM/MFG_STAGE_EXT External Staging Request for Production
Above are RFC enabled FMs that can be found inside function group /SCWM/MFG (Advanced Production Integration).
In this blog post, I have taken the example of receipt of Handling Units from MES communicated to Decentralized EWM on S/4 HANA, via API /SCWM/MFG_RECEIVE_HUS_EXT.
To expose the out-of-the box API /SCWM/MFG_RECEIVE_HUS_EXT to an external Manufacturing Execution System (MES) of our enterprise, I used the web-service based integration (i.e. WSDL file based Integration). Web Services Description Language (WSDL) is based on XML message schema framework.
To use a exposed web service definition, MES must know the URL of the target WSDL.
Step 1: Web Service Definition Creation. For the creation of web-service, I have used below the SE37 transaction which calls Enterprise Service wizard. One can also use SE80 for web service creation.
Once the service definition is generated, there will be WSDL URL generated and it is then provided to the partner MES system, in order to invoke the API in EWM.
As you could also see the web service definition also shows up the input and output field structure involved for the interface communication of MES with EWM, using underlying API.
Other important steps: Make sure SOAMANAGER is also set-up correctly for the web service based Integration. Usually it is a Basis (system administrator) activity.
Step 2: WSDL URL is invoked by external MES system
The API function module /SCWM/MFG_RECEIVE_HUS_EXT invokes the method RECEIVE_HU of the API “/SCWM/IF_API_MFG_RECEIVING” that enables to post goods receipt of packed products from production shop floor in specific packages i.e. handling units.
The system creates new inbound delivery with a packed delivery item for each HU for receipt is posted by MES and communicated to EWM.
Prerequisite to create Inbound delivery by this API is that Expected Goods Receipt (EGR) document must exist prior in the EWM with ref. to ERP production order.
The RECEIVE_HU method consists of the following steps:
- Querying the expected goods receipt (EGR) based on the manufacturing order reference and the product
- Creating a new inbound delivery based on the EGR
- Creating planned HUs linked to the inbound delivery
- Creating and valuating batches for batch-managed products
- Creating serial numbers for serialized products
- Updating deliveries with the valuation quantity and valuation unit of measure (UoM) for catch-weight managed products
Following table shows the input and output parameters used in the API.
|#||Parameters of API||Details|
|1||IV_LOGSYS (mandatory)||This a logical system of the ERP.|
|2||IV_PLANT (mandatory)||This is a plant of the ERP system. Plant + Logical System=>maps PSA(ERP-EWM)|
|3||IV_WHS_NUMBER (mandatory)||This is a ERP warehouse number ERP WHS Number => maps EWM WHS number|
|4||IV_ORDER_NUMBER (mandatory)||This is a manufacturing/production order number from ERP.|
|5||IT_HANDLING UNITS (mandatory)||This is a external identification of a handling unit.|
|6||IT_SERIAL_ NUMBERS(optional)||For serial number managed products, the unique serial numbers must be received.|
The API is having following export parameters based on the above import or inputs provided by MES system using the Interface.
- ET_HANDLING_UNITS- This contains the number of the HU for which receipt is posted
- ET_BAPIRET- This parameter provides the return message upon FM execution
Example-Sample Test Results from Direct API execution (without web service call)
- Input parameters provided in the /SCWM/MFG_RECEIVE_HUS_EXT 2. Handling Unit successfully received3. BAPI success message
SAP EWM API /SCWM/MFG_RECEIVE_HUS_EXT when integrated seamlessly with the partner system MES using integration methods like webservice, it can be deployed without much development effort and time.
- SE37 Function Module Documentation of /SCWM/MFG_RECEIVE_HUS_EXT