Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Problem adding components to production order using CO_XT_COMPONENT_ADD

maria_merino
Active Participant
0 Kudos

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

2 REPLIES 2

maria_merino
Active Participant
0 Kudos

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..

0 Kudos

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