Avoiding duplicate Co-product component in Production Order
In SAP standard production order creation of standard, special, and disassembly production orders, and it allows manual or back-flush issue of components.
And Production order with BOM, special production orders can be created on the go without BOM. Here in Special Production order without BOM allows users to punch multiple components in it.
Standard Production order in SAP allows any number of duplicate components in single production order. In order to avoid that I tried with user exits and validation which is already there.
Industry needs to create only a production order for specified intervals. For example, only one production order for 5 days activity which will provide some co-products. It’s a tedious process for an end user to find the existing component and update the quantity, whenever a duplicate component is found as a co-product, as an ABAP consultant need to provide solution to industry for their needs in systematic way. This blog post explains the approach handled to arrest above mentioned situation.
Work around Steps:
In a day co-product will be around 400 to 500. As everyone are aware that if a co-product is increased or added as a new component, GRN/MIGO needs to be completed against respective production order for the increased quantity or newly added component quantity.
Developed an ABAP program to upload components and quantity to provide a final solution to end user to achieve this visited several Q&A sessions in community and few external resources related to SAP and compiled the instruction/suggestion into this solution.
Creation of Production Order: This is being discussed in community in several blogs / Q & A that is creation of Production order through BAPI_PRODORD_CREATE.
This activity is next task of above one this is also a quite familiar BAPI to get header and component details of given production Order BAPI_PRODORD_GET_DETAIL.
Having components list already available in existing production order, by looping the upload data which is already captured in Internal table from Excel data, and reading the component inside and compare the existence of component. If component available already in Production order then, update the existing production order quantity with uploaded template quantity and change quantity in production order through FM CO_XT_COMPONENT_CHANGE.
If the component is new ie., not in existing production order, insert/Add a component into Production order through FM CO_XT_COMPONENT_ADD. In order to get the position for the newly created component add this piece of code.
ASSIGN ('(SAPLCOBC)RESB_BT') TO <gt_resb_bt>. LOOP AT <gt_resb_bt> ASSIGNING <gs_resb_bt>. numc = sy-tabix * 10. <gs_resb_bt>-posnr = numc. CLEAR lv_numc. ENDLOOP.
Commit the FM using prepare_commit, capture the data result to an internal table and popup with a Check box and GR quantity as input field so that User can enter exact GR Quantity…
Auto GR will be triggered thorough BAPI_GOODMVT_CREATE with goodMvt_code ’02’ with movement indicator ‘F’ for the remaining quantity with movement type 101.
Even though all the above-mentioned steps found ok, to follow. As a result program had an issue for every alternate materials with system’s Standard error “Production Order Locked by User XXX” where the XXX is uploading user, and same too have been addressed.
Awaiting for Question / comments regarding this and ready to guide in any area of C001/02/03 MB1B, etc.,
Thanks & Regards.
This has been extended for mass goods receipts/ consumptions for multiple production orders
<gt_resb_bt> is not a table, can't make a loop it