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

Problem deleting components from production order using CO_XT_COMPONENTS_DELETE

maria_merino
Active Participant
0 Likes
2,692

Hi experts,

I've searched the forum for some help with the issue I have.

I developed a report which shows an ALV with production order + components. The user should be able to select one component and delete it. After reading lots of similar posts, this is what I did:

DATA: li_resb TYPE coxt_t_resbdel WITH HEADER LINE,

         li_return TYPE  coxt_t_bapireturn WITH HEADER LINE.


  li_resb-rsnum = i_datos-rsnum.

   li_resb-rspos = i_datos-rspos.

   li_resb-matnr = i_datos-component.

   li_resb-xloek = c_x.

   APPEND li_resb.


CALL FUNCTION 'CO_XT_COMPONENTS_DELETE'

     EXPORTING

       it_resbkeys_to_delete       = li_resb[]

*   IS_COMP_NR                  =

* IMPORTING

*   E_ERROR_OCCURRED            =

    TABLES

      ct_bapireturn               = li_return

    EXCEPTIONS

      delete_failed               = 1

      OTHERS                      = 2.

   IF li_return[] IS INITIAL.

     CALL FUNCTION 'CO_XT_ORDER_PREPARE_COMMIT'

ENDIF.


Then I check tx. CO02 and the component I deleted is now grey (not editable) but flag XLOEK is still blank. In table RESB it happens the same. Is there any way I can do what the user needs using a bapi/function ?


Thanks in advance,


María

Hi experts,

I've searched the forum for some help with the issue I have.

I developed a report which shows an ALV with production order + components. The user should be able to select one component and delete it. After reading lots of similar posts, this is what I did:

DATA: li_resb TYPE coxt_t_resbdel WITH HEADER LINE,

         li_return TYPE  coxt_t_bapireturn WITH HEADER LINE.


  li_resb-rsnum = i_datos-rsnum.

   li_resb-rspos = i_datos-rspos.

   li_resb-matnr = i_datos-component.

   li_resb-xloek = c_x.

   APPEND li_resb.


CALL FUNCTION 'CO_XT_COMPONENTS_DELETE'

     EXPORTING

       it_resbkeys_to_delete       = li_resb[]

*   IS_COMP_NR                  =

* IMPORTING

*   E_ERROR_OCCURRED            =

    TABLES

      ct_bapireturn               = li_return

    EXCEPTIONS

      delete_failed               = 1

      OTHERS                      = 2.

   IF li_return[] IS INITIAL.

     CALL FUNCTION 'CO_XT_ORDER_PREPARE_COMMIT'

ENDIF.


Then I check tx. CO02 and the component I deleted is now grey (not editable) but flag XLOEK is still blank. In table RESB it happens the same. Is there any way I can do what the user needs using a bapi/function ?


Thanks in advance,


María

1 REPLY 1
Read only

maria_merino
Active Participant
1,542

I think it's solved.. I changed this code:

IF li_return[] IS INITIAL.

     PERFORM change_flag_set(saplcozv).

     CALL FUNCTION 'CO_IT_SET_FLG_ITAB_NEW'.

     CALL FUNCTION 'CO_XT_ORDER_PREPARE_COMMIT'.

     COMMIT WORK AND WAIT.

   ELSE.

   ENDIF.


Now I have to find a bapi to add new component.