Skip to Content
Author's profile photo Konstantin Anikeev

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.

image2013-5-12 12-7-1.png

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.

image2013-5-12 12-23-21.png

Then click on “Create BADI Implementation” Button.

image2013-5-12 12-31-53.png

A new popup window will be opened.

You should enter a name for enhancement Implementation and composite enhancement implementation.

image2013-5-12 12-35-4.png

Please do it according to your naming conventions. If you want to create new composite enhancement implementation – first click on create button,

image2013-5-12 12-37-20.png

image2013-5-12 12-37-55.png

then you need to define a Package, where you want to save your implementation (Z_BADI in my case).

image2013-5-12 12-52-36.png

And define a request number for transport to Test and Productive.

image2013-5-12 12-54-9.png

After saving all the changes you’ll get a new popup for BADI Implementation (will be created inside of newly created enhancement implementation).

image2013-5-12 12-56-56.png

Please enter BADI Implementation and implementation class names according to your naming conventions.

Confirm your changes.

image2013-5-12 12-58-22.png

After confirming you’ll jump to windows with BADI Implementation.

image2013-5-12 12-59-42.png

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.

image2013-5-12 13-3-11.png

In the opened popup you will be prompted to implement the method.

image2013-5-12 13-6-14.png

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.

image2013-5-12 13-24-21.png

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.

image2013-5-12 13-30-25.png

Assigned Tags

      10 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Former Member
      Former Member

      Hello Konstantin,

      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 😉

      Best regards,

      Tomas

      Author's profile photo Konstantin Anikeev
      Konstantin Anikeev
      Blog Post Author

      Hi Thomas,

      If you allow deletion - it would just set a I1040 for CRM_JEST, at least from my experience.

      Regards

      K

      Author's profile photo Former Member
      Former Member

      Hi Konstantin,

      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 🙂

      Regards,

      Toams

      Author's profile photo Konstantin Anikeev
      Konstantin Anikeev
      Blog Post Author

      Hi Thomas,

      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.

      Regards

      Konstantin

      Author's profile photo Thomas Ruppe
      Thomas Ruppe

      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.

      Regards

      Thomas

      Author's profile photo Konstantin Anikeev
      Konstantin Anikeev
      Blog Post Author

      Hi Thomas,

      glad to hear it.

      Author's profile photo Former Member
      Former Member

      Hi ,

      I have a approved SC in production with 16 line items now all the line items are showing

      I1111   Item in Transfer Process

      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

      1. 1.SRM Administrator->SC Number->selected the SC –Deletion option not enabled
      1. 2.Used the below FMs
        • BBP_PROCDOC_STATUS_CHANGE & BAPI_TRANSACTION_COMMIT—>Tried in Quality working fine but not working in production
        • BBP_PD_SC_DB_DELETE & BAPI_TRANSACTION_COMMIT—>Tried in Quality working fine but not working in production
      1. 3.Tested the scenario in Quality by adding the status Item in Transfer process to the SC and executed the above FMs working fine at Quality
      1. 4.I had a screen sharing session with the user and open the SC from the advanced search option and clicked on Edit No Delete Option available at Header level , Tried at Item level its prompting Item cannot be deleted

         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

      Author's profile photo Wendy Xu
      Wendy Xu

      Hi Anil,

      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:
      ======

      Select: X

      Use Timeout: X

      Shopping Cart Number: (your SC no.)
      Simulate: (blank)
      ======

      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.

      Regards,
      Wendy

      Author's profile photo Former Member
      Former Member

      Hi Wendy,

      Thanks for the reply.

      we tried the above solution but not working .any alternative solution can u provide?

      Author's profile photo Wendy Xu
      Wendy Xu

      Hi Anil,

      What is the status of those items now? Still I1111 or I1112?

      Regards,
      Wendy