By-Product receipt with SAP EWM API
Goods Receipt of By-Product against Process Order in SAP EWM with Advanced Production Integration
This blog post is to explain how to perform the Goods Receipt for By-Product in SAP EWM with Advanced Production Integration.
To narrow down further, this blog post helps to understand the master data setup, process flow involved and how SAP EWM recognizes the by-product in EGR line item, configuration setup required to support that.
Both the functional and technical aspect of by-product receiving is covered.
What is By-Product?
Product that is produced incidental to the production process of other products.
Master Data Setup
Production BOM in ERP system
By-Product for process order should be maintained as BOM components with negative quantity in ERP. No other additional maintenance required for By-Product.
There is no master data setup in EWM for by-product.
Create Process Order in ERP (Tcode – COR1)
Go to Material List to view the BOM list.
Movement type is 531 when the component is maintained with negative quantity.
Release the process order.
Execute the material staging.
Save the process order.
PMR created in EWM once the WM staging executed in ERP Process Order. (Tcode - /SCWM/MON)
PMR staging and consumption is not covered, as the focus here is on Goods Receipt process of by-product.
Create EGR in EWM using EGR report from ERP using push method. (Tcode - /SPE/EGR)
How SAP EWM recognizes the By-Product line item in EGR?
EGR queue in EWM SMQ2.
Here we can find two line items (One for the Process Order Header Material and another is for the Process Order By-Product)
The line item for the by-product carries the reservation document number from ERP as reference.
Reservation is the key information for the EWM to process this line item as by-product.
We can understand that by seeing the below code in EWM system.
Coding to fill the ERP movement type when goods movement posted in EWM.
Class - /SCWM/CL_DISPA_W2IM_GOODSMVT
Method - FILL_MOVE_TYPE
Coding to find the ERP movement type when goods movement posted in EWM.
Class - /SCWM/CL_ERP_TIMBWA
Method - FIND_MOVE_TYPE
Coding to fill the BAPI GM code when goods movement queue triggered from EWM to ERP during Goods receipt in EWM against EGR.
Class - /SCWM/CL_DISPA_W2IM_GOODSMVT
Method - FILL_BAPI_GM_CODE
List of GM Codes in SAP ERP
01: Goods Receipt for purchase order
02: Goods receipt for production order
03: Goods issue
04: Transfer posting
05: Other goods receipts
06: Reversal of goods movements
07: Subsequent adjustment to a subcontract order
Goods Receipt for header material for process order will be done with respect to order number using GM Code ‘02’ where as for by-product it will be done with respect to reservation using GM Code ‘05’.
Reservation will be updated as reference documents in GRN, EGR & IBD for by-product line item.
EGR queue will get stuck in EWM if the reservation document category ‘RES’ is not active for the GRN reference document customer profile.
Message: Document category RES missing in reference profile /SCWM/GRN_DLV_PROD
Configuration to support By-Product Processing
Configuration of customer profile for reference document category of GRN.
Make sure this is active for the customer profile of EGR & Inbound delivery as well as the reservation should flow from the ERP Process Order à GRN à EGR à IBD.
If the reservation number is missing in EGR or IBD, then EWM determines the movement type of by-product of as 101 instead of 531 and populates the incorrect BAPI GM Code ‘02’ instead of ‘05’.
Sample failed GR message for a process order is shown below.
Reason for Error: When the BAPI GM code is ‘02’ instead of ‘05’, then ERP considers it as GR for header material. Then it compares the ERP Process Order header material with the by-product as a validation before posting GR. It will not be same and gets failed in the validation.
Now coming to our document flow.
Goods Receipt Notification in EWM with Reservation reference.
EGR document with reference to reservation document.
Let us set the breakpoint now in the code we have seen above and try to post GR for the EGR via RFUI.
GR posted in EWM. Check the inbound delivery created for EGR in the monitor.
Reservation reference copied to Inbound delivery as well.
Debugging triggered from the ‘Send ERP Messages’ PPF Action.
Code is in the ‘Fill_MOVE_TYPE’ method.
Reason is ‘GRMF’ which is GR for Manufacturing process and reservation is not blank.
Variable to identify by-product is marked as ‘X’.
Movement type changed from 101 to 531 since the variable for by-product is marked as ‘X’.
GM Code set as ‘05’ due to GR line item with reservation number.
GR Goods Movement Queue in ERP SMQ2
Documented Goods Movement of Process Order in ERP
MIGO display of GR material document
By-Product receiving process is completed now.