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.
    UNASSIGN <fs_item>.
  UNASSIGN <fs_header>.

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

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

      Nice write-up,it is quite a common question that every client asks how to delete a shopping cart which is not completed especially SC in error in transmission, maybe  they don't like the POWL filled with failed shopping carts 😉