Skip to Content

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!

To report this post you need to login first.

36 Comments

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

  1. Rick Bakker

    Good job! But I would add that, depending on your version, it can be even easier to logically delete multiple workflows:

    – go to SWIA

    – select a number of top-level workflow workitems using Ctrl or Shift

    – Edit > Work Item > Logically Delete

    – Refresh

    (0) 
  2. Paul Bakker Post author

    Thanks for all the encouraging comments. I was always daunted by the idea of blogging but it’s actually quite fun.

    I think Rick Bakker should stop lurking and do some as well.

    If the ‘sophomore syndrome’ doesn’t hit, I’ll post the second epistle next week. ๐Ÿ™‚

    (0) 
  3. Praveen Nenawa

    Just when I needed it .
    I wanted to stop continoue reminder mails about an approval process.
    This blog came to rescue.

    Thanx a Lot .

    Prav Kr.

    (0) 
  4. Margaret A Hilsbos

    Thanks Paul. I found this blog quite useful recently. Also this topic came up in a discussion on Linked In and I gave a link to this blog.

    I’m looking forward to the next 72 installments. ๐Ÿ™‚

    (0) 
      1. Paul Bakker Post author

        I don’t know, but you could add an implicit enhancement to function module SWW_WI_ADMIN_CANCEL (which is called from SWIA when logically deleting).

        cheers

        Paul

        (0) 
  5. EBONGUE ANDRE

    Hi Paul Thanx for the tutorial.Is it possible to logically delete a wf from report ( calling the SWIA)? at the moment i’m justing completing programmatically one of my workitem, that completes my wf not “delete it”.

    Regards.

    (0) 
    1. Paul Bakker Post author

      Andre,

        Yes, you can logically delete workflows from a program by calling the function module SAP_WAPI_ADM_WORKFLOW_CANCEL.

      cheers

      Paul

      (0) 
      1. Tammy Powlas

        I was asked to clean up workflows from 2009 from an inbox…fortunately I stumbled on this, and it seems to work in our Q box….next will try production ๐Ÿ™‚

        (0) 
  6. Andrej Antalovci

    Ok, nice explanation, but I have one question related to this:

    โ€œwe logically delete top-level (WS*) workflow instances only, not (TS*) workitemsโ€

    What about tasks like TS00008068 or TS20000051? this is not WS but it is on top level, can I logically delete it?

    ย 

    ย 

    (0) 
    1. Paul Bakker Post author

      Andrej: Yes, you’ are right: if the workflow consists of a single TS item, then it is of course the top-level item (and is ok to logically delete).

      (0) 
  7. Saurabh Sharma

    I want toย  “complete manually” the workflow items but it is not available for multiple items in bulk. the system is allowing me to do one by one item individually. Pl suggest how to “complete manually” multiple items

     

    (0) 

Leave a Reply