Allow deletion of every single shopping cart via shopping cart monitor in SRM 7.0x
First of all, Deletion of shopping cart is not a standard solution.
Please refer to knowledge base article 1649794 – Status dependent control of Shopping Cart
The administrator can only change shopping carts when:
– the shopping cart was created by himself,
– the shopping cart items have the status ‘Error in transfer process’ (I1112).
Shopping Carts with item Status ‘Error in transfer process’, can be only proceed by the administrator. The administrator can in transaction Monitor Shopping Cart:
– edit the erroneous Shopping Cart items to resolve the error and reorder them again,
– delete the erroneous line items,
– retransfer the erroneous line items without change.
I had a need to delete a shopping cart, which has not been transferred to backend – have active status “error in transmission”.
SAP provides a standard shopping cart monitor, which allow to delete shopping carts as administrator, but unfortunatelly, not for approved shopping carts.
But there is a simple solution for this. All you need is to implement a BADI /SAPSRM/BD_PDO_MONITOR_SC.
Here are some steps, how to do this.
First you should go to transaction SE18 – Business Add-Ins: Definitions, select a BADI and click on “Display” button.
Then click on “Create BADI Implementation” Button.
A new popup window will be opened.
You should enter a name for enhancement Implementation and composite enhancement implementation.
Please do it according to your naming conventions. If you want to create new composite enhancement implementation – first click on create button,
then you need to define a Package, where you want to save your implementation (Z_BADI in my case).
And define a request number for transport to Test and Productive.
After saving all the changes you’ll get a new popup for BADI Implementation (will be created inside of newly created enhancement implementation).
Please enter BADI Implementation and implementation class names according to your naming conventions.
Confirm your changes.
After confirming you’ll jump to windows with BADI Implementation.
Here you should navigate to implementation class (just double click).
You need to imeplement MODIFY_LIST method of the BADI. Make a double click on method name.
In the opened popup you will be prompted to implement the method.
I used following code, to change standard system behaviour.
METHOD /sapsrm/if_ex_bd_pdo_mon_sc~modify_list. FIELD-SYMBOLS: <fs_header> LIKE LINE OF ct_sc_result_header, <fs_item> LIKE LINE OF ct_sc_result_item. LOOP AT ct_sc_result_header ASSIGNING <fs_header> WHERE status = /sapsrm/if_pdo_status_c=>gc_pdo_sc_released AND flag_delete_allowed = abap_false. <fs_header>-flag_delete_allowed = abap_true. LOOP AT ct_sc_result_item ASSIGNING <fs_item> WHERE header = <fs_header>-guid AND del_ind = abap_false AND status <> /sapsrm/if_pdo_status_c=>gc_pdo_transfer_err. <fs_header>-flag_delete_allowed = abap_false. EXIT. ENDLOOP. UNASSIGN <fs_item>. ENDLOOP. UNASSIGN <fs_header>. ENDMETHOD.
Method has a following logic: first loop via all shopping cart headers, which are approved but deletion is not allowed. For every shopping cart is by default allowed to delete it. Then is checked, whether all not deleted positions have active status “error in transfer”, if not – disable deletion.
Changes should be activated.
Additionally you should implement the rest 2 mthods of the class. You may leave implementation empty (don’t forget to actiovate newly implemented methods).
After activation you should be able to delete shopping carts, which have not been transferred.
interesting solution. However I have to say that I would never recommend to implement it and I would rather modify SC statuses in CRM_JEST table to get rid of such shopping cart. Enabling deletion of SCs without respect to their statuses might be a way to hell 😉
If you allow deletion - it would just set a I1040 for CRM_JEST, at least from my experience.
Yes, you are right about the outcome, but my problem with this solution is that you will give the administrator right to delete (accidentally or not) SCs which should not be deleted (e.g. with follow-on document created). It might be useful but shold be delivered with "!!! Use with precaution !!!" label on it 🙂
At the beginning of this post I mentioned, that this case solves the issue with not transferred shopping carts. SCs with following documents can be deleted via standard until no GR or IR exist. If you need some warning - it can be also implemented, but it was not in a scope of this post.
Konstantin, great work, it works, thanks a lot. In opposition to some other opinions here, IMHO every company need this. We are facing some errors, whereby there is no possibility to delete SCs with status "Awaiting approval" in SRM 7 EHP 1 and 2.
glad to hear it.
I have a approved SC in production with 16 line items now all the line items are showing
the status I1111 is in colored with blue
PO was not created ,I checked at BBP_DOCUMENT_TAB no entries found
Now the business want to delete the SC ,below are my tried solutions but even then unable to delete it .All are working fine in quality but in production not working
5.FM CRM_STATUS_UPDATE can help only to add the status but not for the document close in SC
could you please me on this how to delete a SC ,they do not want to implement the above BADI because the functioning is fine at quality but not at Production
In fact, currently we recommend using the standard report BBP_SC_AUTO_RETRANSFER to process SC status problem.
Regarding the SC problem you mentioned above, if your business has confirmed to delete the SC, you could check whether your system has already report BBP_SC_AUTO_RETRANSFER and whether note 1958403 is included or implemented.
If the note is still not implemented, just apply it.
Then run the report with the following parameters:
Use Timeout: X
Shopping Cart Number: (your SC no.)
The report will force the status of the SC item into I1112 (error in transmission) so that the SC will be shown in application monitor.
Next step, you could go to SC monitor to find this SC and delete it.
Hope this could help you.
Thanks for the reply.
we tried the above solution but not working .any alternative solution can u provide?
What is the status of those items now? Still I1111 or I1112?