cancel
Showing results for 
Search instead for 
Did you mean: 

How to delete a Shopping cart ?

Former Member
0 Kudos

Hello experts ,

1) How to delete a SC if follow on docs are created ?

2) Is it advisable to delete complete history along with SC ?

Thanks

Kapil

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

Hi Kapil,

  • First you need to delete the follow on PO by marking the item as deleted

 

* Convert header structure to the type expected by 'BBP_PD_PO_UPDATE'
MOVE-CORRESPONDING ls_header_import TO ls_po_header_u.
ls_po_header_u
-zzdeleted_doc = 'X'.

* Convert item structure to the type expected by 'BBP_PD_SC_UPDATE'
LOOP AT lt_item ASSIGNING <fs_item>.
APPEND INITIAL LINE TO lt_update_item ASSIGNING <fs_update_item>.
MOVE-CORRESPONDING <fs_item> TO <fs_update_item>.
<fs_update_item>
-del_ind = 'X'.
ENDLOOP.

CLEAR lt_messages.

* Update Shopping Cart
CALL FUNCTION 'BBP_PD_PO_UPDATE'
EXPORTING
i_header               
= ls_po_header_u
i_save                 
= 'X'
iv_with_change_approval
= ' '
IMPORTING
e_changed              
= lv_changed
TABLES
i_item                 
= lt_update_item
e_messages             
= lt_messages. 

    CALL FUNCTION 'BBP_PD_PO_SAVE'
EXPORTING
iv_header_guid
= ls_po_header_u-guid.


COMMIT WORK.

  • Now you need to detach the deleted PO from the SC by using program "CLEAN_REQREQ_UP" I'm sure that you have a job for it in your system but you can it manually. The SC will get status I1115.
  • Now you can delete the SC.

* Convert item structure to the type expected by 'BBP_PD_SC_UPDATE'
LOOP AT lt_item ASSIGNING <fs_item>.
APPEND INITIAL LINE TO lt_update_item ASSIGNING <fs_update_item>.
MOVE-CORRESPONDING <fs_item> TO <fs_update_item>.
<fs_update_item>
-del_ind = 'X'.
READ TABLE lt_status WITH KEY p_guid = <fs_item>-guid
stat  
= 'I1113'
TRANSPORTING NO FIELDS.
IF sy-subrc IS INITIAL.
READ TABLE lt_status WITH KEY p_guid = <fs_item>-guid
stat  
= 'I1115'
inact 
= ' '
TRANSPORTING NO FIELDS.
IF sy-subrc IS NOT INITIAL.
lv_fdoc_error
= 'X'.
ENDIF.
ENDIF.
ENDLOOP.

* Update Shopping Cart
CALL FUNCTION 'BBP_PD_SC_UPDATE'
EXPORTING
i_header               
= ls_po_header_u
i_save                 
= 'X'
iv_with_change_approval
= ' '
IMPORTING
e_changed              
= lv_changed
TABLES
i_item                 
= lt_update_item
e_messages             
= lt_messages.

      CALL FUNCTION 'BBP_PD_SC_SAVE'
EXPORTING
iv_header_guid
= ls_po_header_u-guid.

Regards,


Ronen Ravansari

0 Kudos

Hi Kapit,

1. What is the purpose of deleting the SC if the PO is available ?

2. You can archive the documents with preceeding one.

regards,

Kannan B

Former Member
0 Kudos

Hi Kapit,

Answering your questions:

1) You can't modify a SC with a follow on document, you can delete the follow on document of the SC and reuse it for other sourcing. Or, if you have a complete circuit of follow on document, you can archive it.

2) There is not a standard option to do this, but you can develop a custom program that do it.

Best Regards,

Emanuel.

konstantin_anikeev
Active Contributor
0 Kudos

Hi Kapit,

just move it to archive

Regards

Konstantin