Application Development and Automation 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: 
Read only

CO_XT_COMPONENTS_DELETE not working as expected

Former Member
0 Likes
4,044

Hi All,

We are using the  CO_XT_COMPONENTS_DELETE for deletion of Production order components  in CO02.

We are not getting any error when the FM is executed.  but the components are deleted from the production order.


'CO_XT_COMPONENTS_DELETE'

CO_XT_ORDER_PREPARE_COMMIT

BAPI_TRANSACTION_COMMIT'


Executed the FM is the above Sequence.



Any help how we can delete the Components and let me know which parameters we need to pass.



best regards,

Sandeep

10 REPLIES 10
Read only

Arun_Prabhu_K
Active Contributor
0 Likes
3,258

Execute COMMIT WORK AND WAIT instead of BAPI_TRANSACTION_COMMIT.

     CALL FUNCTION 'CO_XT_ORDER_PREPARE_COMMIT'.

     COMMIT WORK AND WAIT.

Read only

0 Likes
3,258

hey Arun,

I Tried this option as well and it is not working gone through the Link which is already in the SCN,

Thought of reach you by E mail..but not able to get any media to reach you.

best regards,

Sandeep

[email protected]

Read only

0 Likes
3,258

Sandeep,

     It is working for me. Sample code of mine:

  • DATA : resb TYPE COXT_T_RESBDEL WITH HEADER LINE.

     iresb-rsnum = rsnum.

     iresb-rspos = rspos.

     APPEND iresb.

      CALL FUNCTION 'CO_XT_COMPONENTS_DELETE'
     
EXPORTING
           IT_RESBKEYS_TO_DELETE      
= iresb[]

           TABLES
           CT_BAPIRETURN              
= bapiret1
     
EXCEPTIONS
           DELETE_FAILED              
= 1
          
OTHERS                      = 2.

     
if bapiret1-message is initial.
          
CALL FUNCTION 'CO_XT_ORDER_PREPARE_COMMIT'.
          
COMMIT WORK AND WAIT.
     
else.
          
MESSAGE bapiret1-message TYPE 'S' DISPLAY LIKE 'E'.
          
leave to screen 9003.
     
endif
.

Read only

0 Likes
3,258

Hi Arun,

Thanks for your prompt response.

I have tried the same way.. but no Luck ..it is not deleting the components. any system settings needs for deletion.

But the Change function module is working fine. i can able to change the components.

BEst regards

Sandeep

Read only

0 Likes
3,258

Check if you are able to delete that component directly via CO02 tcode.

Read only

0 Likes
3,258

yes ,I can able to delete the components  and Add the Components ,,

Read only

0 Likes
3,258

Sandeep,

     How do you say the component is not deleted in production order?

     If the production order is in CRTD status, that component line will be completely removed from that production order and if it is REL status, that component line will be there in production order but set with deletion flag.

Regards.

Read only

0 Likes
3,258

Hi Arun, the Status of the Production order is created status only.

Even though the component is not deleted. it is Appearing in RESB table .

Read only

0 Likes
3,258

Hi  Arun,

When the PRoduction order is in Relese status the Componet is getting deleted using the CO_XT_COMPONENTS_DELETE FM. But the Dletion Flag is not updating. But we tried to delete using CO02 the system throwing Error the component is already deleted.

For Adding the component we used the  CO_XT_COMPONENT_ADD the component is added in the Order , But the Item number ( ex: 0010, 0020 ) is blank for the orders crated by the Function module.

any idea how we can get the item number.??

Best reagrds,

Sandeep

Read only

0 Likes
3,258

Sandeep,

     How do you say the deletion flag is not set?

     Did you check the table control column "Deleted" in component overview?

     I don't know about the FM CO_XT_COMPONENT_ADD.