‎2016 Sep 06 11:49 AM
Hi experts,
I need to add components to production order. Before doing that I delete an existing component using:
CALL FUNCTION 'CO_XT_COMPONENTS_DELETE'
CALL FUNCTION 'CO_IT_SET_FLG_ITAB_NEW'.
CALL FUNCTION 'CO_XT_ORDER_PREPARE_COMMIT'.
COMMIT WORK AND WAIT.
Then, if I have deleted position 0020, I need to add a new component in that 0020 position with function CO_XT_COMPONENT_ADD I get error X4017 (Component &1: Operation not found in order &2). Is there any posibility to add component in the same position I have previously deleted ?
Thanks in advance.
MarÃa
‎2016 Sep 07 12:54 PM
Does anybody know how to solve my issue ?
The consultant told me to try module function CLOI_CHANGES_UPL_31 but I think it's not suitable for my requirement..
‎2016 Sep 16 6:49 PM
Hi Maria
Can you share us a code snippet in order to replicate the error please?
I'm not familiar with Production orders but I faced a similar issue several months ago with maintenance orders, since they also use operation numbers. In order to execute the function you need to concatenate the operations number with the ORDERID in order to create a object key that the function identifies the operation. like the following:
CONCATENATE ORDERID CONST_OPERATION INTO IT_METHOD-OBJECTKEY.
IT_METHOD-REFNUMBER = REFNO.
IT_METHOD-OBJECTTYPE = 'COMPONENT'.
IT_METHOD-METHOD = 'CREATE'.
...
OrderID is the Maintenance order number generated by SAP
CONST_OPERATION is the operations number (in my case is always 0010)
REFNO is always 0001
And to add the new component use the following code:
IT_COMPONENTS-ACTIVITY = CONST_OPERATION.
IT_COMPONENTS-MATERIAL = COMPONENTS_LIST-MATERIAL.
IT_COMPONENTS-PLANT = PLANT.
IT_COMPONENTS-ITEM_CAT = 'L'.
IT_COMPONENTS-STGE_LOC = COMPONENTS_LIST-STGE_LOC.
IT_COMPONENTS-REQUIREMENT_QUANTITY = COMPONENTS_LIST-REQUIREMENT_QUANTITY. ...
In my case the operations number is a number that in the transactions always fills with 0010.
Hopes this helps to solve your issue.
Warm regards.
Lorenzo MartÃn Olmos