2016 Aug 31 1:15 PM
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
2016 Aug 31 1:27 PM
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.