Skip to Content

How to ‘logically delete’ workflows

Introduction

 

In this first blog of a 73-part series ‘The Overworked Workflow Administrator’,  I hope to give a definitive answer to the commonly-asked question: ‘How do you logically delete a workflow?’.

 

Note that when I say ‘workflow’ I mean ‘workflow instance’ – for example, a purchase approval for a certain tractor costing $120,000. A ‘workitem’ is a step in that workflow instance that may appear in an inbox.

 

What does it mean to ‘logically delete’?

 

Simply put, when you ‘logically delete’ a workflow, it is set to status ‘Logically Deleted’ (aka CANCELLED) and so are all of its incomplete child workitems. These workitems are then immediately removed from users’ inboxes, and the workflow can be archived.

 

This is quite different from physically ‘deleting’ a workflow. When you ‘delete’, the workflow disappears out of the system completely. You may occasionally want to do this in a Development or Test system (for example if the system has been flooded with test workflows), but please do not delete workflows in a Production system. It can wreck absolutely everything, as Jocelyn D. entertainingly described here.

 

Why would you want to?

 

You may want to logically delete workflows if:

  • a workflow is in error and there is no possiblity / desire to restart it
  • an external event has occurred (e.g. an employee was terminated) that makes an unfinished workflow redundant
  • multiple workflows were generated by mistake, and are embarrassingly clogging up the Manager’s inbox

 

 

How to logically delete a single workflow instance

 

If there is one piece of advice that you remember from this blog, let it be this: we logically delete top-level (WS*) workflow instances only, not (TS*) workitems.

 

When you logically delete a workflow, all of its child workitems are automatically deleted as well, so the whole workflow is finalized in one fell swoop. It gives you ‘closure’. If you foolishly decide to delete a workitem, the top-level workflow remains in status ‘In Process’ and will be a blight on your workflow statistics forever.

To logically delete a single workflow from SWIA:

  • select a line (NB select the top-level WS* tasks only!). These will have status ‘STARTED’.
  • Execute the menu item Edit > Work Item > Logically Delete
  • Refresh

 

To logically delete a single workflow from anywhere:

  • go to the current workflow log (click on the ‘scroll’ button when you’re viewing a workflow in SWI2_FREQ etc)
  • click on the first line (i.e. the top-level workflow header)
  • choose the menu item Goto > Technical Workitem Display
  • choose the menu item Edit > Change
  • click the ‘Logically Delete’ button

 

 

If you then go back into the workflow log, the workflow icon is now a faded cube. It has the status ‘Logically Deleted’, as does the last workitem.

 

How to logically delete a lot of workflows

 

The above manual procedure works fine but can get tedious after a few hours. Luckily SAP has added the ‘logically delete’ function to transaction SWIA (Process workitem as administrator) although – if you are on a SAP_BASIS release before 7.11 – it may not be visible to the naked eye.

 

SAP Note 1286336 (‘New logically delete function for mass processing’) adds the function code ADMC (Administrator Cancel) to transaction SWIA. You can check the SAP Note to see if you already have the requisite support pack; if not, you can use SNOTE to put this note in yourself.

 

So, to logically delete multiple workflows:

 

  • run transaction SWIA, selecting only top-level (WS*) workflows
  • using ‘shift’ (or ‘control’), select all the workflows that you want to delete
  • type ADMC (‘Administrator Cancel’) in the (top-left) function code box, and press ‘Enter’

 

  • click the ‘Refresh’ button

 

 

All selected items should now have the status CANCELLED (aka ‘Logically Deleted’).

 

Any questions?

 

Q: Is it possible to reverse a logical deletion if I change my mind?

A: Unfortunately not. But all the information is in the log to start a new workflow instance with the same parameters, if required.

 

Q: Is ‘logically deleting’ the same as ‘manually completing’ a workflow or workitem?

A: No, not the same at all. When you choose to ‘manually complete’ a workitem (via SWIA), you are forced to choose an outcome for the current workitem. The workflow then continues on from that point.

 

Q: What impact does deletion have on the Universal Worklist?

A: This is another reason to always choose ‘logical deletion’. If you have (say) a million rogue items in the UWL, and you physically delete the workflows, these items disappear from the UWL but will remain in the back-end SWN_NOTIF table. In contrast, if you ‘logically delete’ the workflows, the items in SWN_NOTIF are updated to status ‘L’ and will be removed by normal housekeeping (program RSWNNOTIFDEL).

 

Good luck!

38 Comments
You must be Logged on to comment or reply to a post.