Skip to Content
Author's profile photo Paul Bakker

How to archive SAP workflows



In this, the sixth blog in a 73-part series (‘The Overworked Workflow Administrator’), I hope to definitively answer the commonly-asked question: ‘How do you archive SAP workflows?’.


As a workflow administrator, I always knew I had to eventually archive some workflows, but it never reached the top of my ‘To Do’ list. Until now: we are preparing to migrate to a new system, and need to reduce our SAP table sizes. It’s also nice to do a spring clean after 7 years of operation.



Note that when I say ‘workflows’, I mean workflow instances – for example, an approval workflow for an $11,000 tax refund. A ‘workitem’ is a step in that workflow instance, which may appear in an inbox.


What does it mean to ‘archive’ a workflow?


Simply put, when you ‘archive’ a workflow, it is removed from the SAP instance and placed offline (i.e., in a file on your application server).

The workflow (and all its workitems, attachments, log history etc) is still available for read-only access, but its data disappear out of many large SAP database tables. This makes the Basis people very happy 🙂 .


You archive in two separate steps: writing a workflow to an archive file, and then deleting the workflow from the SAP system.


Note that you can only archive workflows that have status COMPLETED (or CANCELLED).


Why would you want to?


You may wish to archive workflows if:

  • Your Production system has been running for a few years
  • Your critical SAP workflow tables (like SWWWIHEAD, SWNCNTP0) are growing fast, impacting performance and slowing down Basis tasks
    (like system backups)
  • You are migrating to a new system and want to reduce the amount of database table data


The business users are nervous about this ‘archiving’. What are the impacts?


I’ve been told that many archiving projects never get off the ground, because of the ‘D’ word (deletion). Business users fear that the deleted workflows – and the legal audit trails they contain – will disappear forever.


As far as I can tell, the risks are small. This procedure has been around for years, and is (presumably) used routinely by thousands of large SAP customers. You don’t ‘delete’ the workflows until after the ‘write’ process’ has completed successfully. And yes, the workflows are physically deleted from the Production system, but they live on in the archive files.


Of course, you do need to be very careful with those archive files; it now becomes the responsibility of the Basis team to keep them safe and properly backed up.


How to archive workflows


Let’s assume that general archiving has already been set up in your system, and that the necessary configuration has been done for archive object ‘WORKITEM’. (If this is not true, please follow the instructions in SAP Note 2157048. This note contains a beautifully clear document by Eddie Morris called ‘Work Item Archiving for SAP Business Workflow’).


In the example below, I am archiving all eligible (COMPLETED / CANCELLED) workflows in our Test system, which were created between 2009 and
2012. There are about 450,000 workflows to be archived.



Step 1: Write the Workflows to Archive

  • Transaction SWW_SARA
  • Click on the ‘Write’ button
  • Create a new variant: enter a variant name (e.g., 2009_2012) and click ‘Maintain’
  • Choose the workflows that you want to archive; for example, all those with creation dates between 2009 and 2012. Choose ‘Production Mode’ (to actually write the archive file)



  • Save and return to the previous screen
  • Set up the archiving job: set the ‘Start Date’ (Immediate) and the ‘Spool Parameters’ (Send to SAP Spooler Only for now)

Once all the lights are green, you can hit ‘Execute (F8)’.

  • Then click the green ‘Job’ button to view the progress of the archiving job in SM37.


Step 2: Confirm that archiving was successful

  • Check the SM37 job logs to make sure they completed without errors


Step 3: Delete the archived workflows from SAP

  • Transaction SWW_SARA
  • Click the ‘Delete’ button (yes, it’s safe – nothing is deleted yet!)


  • Click the ‘Archive Selection’ button, and choose all the archive files written in the previous step



  • Set up the deletion jobs: set the ‘Start Date’ (Immediate) and the ‘Spool Parameters’ (Send to SAP Spooler Only for now)
  • Once all the lights are green, you can hit ‘Execute (F8)’.
  • Then click the green ‘Job’ button to view the progress of the deletion jobs (one for each archive file) in SM37.


How to view the archived workflows


The archived workflows can be browsed via the ‘Read’ button in SWW_SARA. The ‘Archive Explorer’ (via the ‘Information System’) allows you to search by date, task id, and so on. You can even search by BOR object, or class instance.

You can also locate the archived workflow for an individual business object via the GOS (Generic Object Services) tool. For example, if you want to view the approval workflow for a FICA refund document, just select ‘Archived Workflows’ from the GOS menu in the FPE3 (Display Document) transaction.

Top Tip: Clean up your old workflows first


My very first attempt at archiving did not pick up as many workflows as I had hoped. Thousands of old items still remained in the system. This is because – as mentioned above – archiving is restricted to workflows with status CANCELLED or COMPLETED.


We found a few hundred workflows in status ERROR, as well as many thousands in status STARTED.


The ERROR workflows were old instances that ran into errors and – for whatever reason – were not restarted. It would be dangerous to revive them now(!), so we decided to logically delete them. This sets them to status CANCELLED.


The STARTED workflows were, in most cases, workflows that had completed successfully, but were waiting for the user to acknowledge the outcome (e.g., ‘Your leave has been approved’). The workflows that fit this pattern were also logically deleted.


We decided, however, that if a user had reserved a workitem, then we would not archive the parent workflow.

For more information on logical deletion, please see this blog: How to ‘logically delete’ workflows.



Any Questions?


Q: Are the complete workflows really written to the archive? Attachments, comments, objects, logs, everything?


A: Yes they are. I successfully tested the retrieval of different attachments from the archive: RAW notes, Word documents, and JPEG images. Business objects (such as refund documents) are a little different: they just have their key (e.g., document number) stored in the archive, so that they can be reinstantiated on demand – the same as in any workflow instance. Works seamlessly!


Q: Can I still browse the archived workflows through SWIA and SWI2_FREQ?


A: No of course not – they’ve been deleted from the SAP tables. But you can browse them through the SWW_SARA transaction (see above).


Q: Which tables are SAP workflows actually stored in?


A: Lots of them, but especially these large ones:

    • SWWIHEAD (Headers)
    • SWWCNTP0 (XML Container)
    • SWWLOGHIST (Work Item History)
    • SWW_CONT (Work Item Container)


Archiving can remove millions of rows from these tables.


Q: Is it possible to reinstate workflows after they have been archived?


A: No it is not. But why would you want to? The archived versions are just a click away.

Also, you can’t actually do anything with a COMPLETED workflow, except view the log.


Q: I have some Production workflows that I just want to delete. Should I bother archiving them?


A: Definitely archive them. The archiving process gives you a safe and fool-proof way of removing workflows – and all their child workitems – from your system. In general you should never directly delete workflows from Production – see Jocelyn’s heart-stopping blog for the many reasons why.


Q: So are there any disadvantages to workflow archiving?


A: I suppose there’s a risk that something could happen to the physical archive files, if the Basis team is not careful (for example, they could inadvertently delete them when transitioning to a new system). But even then, there should be a backup available.


Access to the archived workflows is of course a little slower, because they have to be extracted from a file. But how many users regularly need to look at old workflows?


Another drawback (for business users, perhaps) is that you can only view the logs of archived workflows in technical mode, not in the colourful ‘Active X’ or ‘Graphical Log’ formats.


Have fun!

Assigned Tags

      You must be Logged on to comment or reply to a post.
      Author's profile photo Bikas Tarway
      Bikas Tarway

      Very nicely explained.

      Author's profile photo Anjan Paul
      Anjan Paul

      Thanks Paul, for your wonderful document.

      Author's profile photo Eddie Morris
      Eddie Morris

      Superb Paul

      Author's profile photo Former Member
      Former Member

      Hi Paul,

      Thank you for the nice blog. how do we find the workflow which are ready to be archived? do we have a report to identify workflow in cancelled or completed status? how do we logically delete workflow in ERROR status?


      Author's profile photo Rick Bakker
      Rick Bakker

      The blog contains a link to another blog on how to logically delete workflows.

      You can find wfs of any status by going to SWI1 and searching on that status (use type F to see top-level workflows)

      Author's profile photo ABHISHEK SINGH

      Kudos Very Nicely Explained 🙂 🙂

      Author's profile photo Ronen Weisz
      Ronen Weisz

      Very nice blog, we actually have one of the problems you described of business users fear   from deleting the old workflows. we actually even gave them the option to view the archived workflows in the regular display. and still they fear the archiving. I guess we will wait until the objects the workflows are linked to will be archived. 

      Author's profile photo Paul Bakker
      Paul Bakker
      Blog Post Author

      Thanks. Just as a postscript - we didn't end up doing the archiving!

      I guess the business got cold feet about removing any workflows from the system.

      Ah well, at least we (hopefully) know how to do it when the time comes.

      Author's profile photo Paul Harbertson
      Paul Harbertson

      Good Blog and well explained.

      We are undertaking an archiving project and workflow is one of our first objects. We wish to "automate" the processing using our batch execution software, which can supply variant information. We would be able to run the programs direct (WORKITEM_WRI, WORKITEM_DEL), however our sticking point is that "archive selection" is an interactive display. Is there a way to overcome this?

      Author's profile photo vadmin vadmin
      vadmin vadmin

      Hi Paul,


      Greetings. We are adopting the information provided in this blog and kick starting the archiving project for our workflow tables.

      Test mode executed perfectly fine and when we are production mode, the job is failing when the file size reaches 100 MB.

      Alternatively, when we specify 10,000 objects it is failing after the limit is reached. New archive files are not getting created automatically.

      Any help on where we are going wrong will be highly appreciated.


      Thanks and Regards





      Author's profile photo Tammy Powlas
      Tammy Powlas

      Paul Bakker - thank you so much, if you make it over the US I owe you a nice drink for this super-helpful helped me so much.


      Author's profile photo Paul Bakker
      Paul Bakker
      Blog Post Author

      Very glad to hear it, Tammy.

      A nice drink - ooh, I'm in!

      I'm actually a regular visitor of the JFK, LAX and MIA airports - if you live near any of those, we could make it happen 🙂

      Author's profile photo Tammy Powlas
      Tammy Powlas

      Hi Paul - I am near Dulles; just let me know when you are near Northern Virginia - cheers!

      Author's profile photo Abdul Rahman
      Abdul Rahman

      Nicely explained Paul!! I did archiving of basically 2 objects as of now (IDOCs & WORKITEMS) ...Searching more ...:-)