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
I am getting short dump when packaging material was entered as 400006935 and I got success message when packaging materials as "PALLET2", is it due to Routine - MDLP1 maintained for Domain - /SCMB/MDL_PRODUCT_NO
Thanks Prakash for sharing the post. Its helpful.
@prakashpol1 - I need to create a Gateway Service to Create HU and Pack HU - thoughts on where I should start?
Michael Pytel As there is no standard API provided like GR API-/SCWM/MFG_RECEIVE_HUS_EXT mentioned in this blog, suggest creating your own custom RFC FM and call the standard SAP provided interface class /SCWM/CL_PACK, there are many useful methods CREATE_HU and PACK_HU in this interface/class. Then expose this RFC as webservice to import/export the data from this custom FM.
We can integrate external MES with SAP EWM, Is my understanding correct?
@prakashpol1 : Thanks for this detailed blog. This was very helpful .
BAPI : /SCWM/MFG_RECEIVE_HUS_EXT (Receive HUs) was working fine when we have EGR in standalone EWM . But in embedded EWM this BAPI was not working as we dont have EGR in embedded , Any suggestion on how to receive HU's from MES in embedded EWM without EGR .
Thanks for the help .