Skip to Content
Author's profile photo Paul Bakker

SAP Workflow as ABAP++ : Don’t program it, workflow it


In this blog, the second in a 73-part series, we discuss the use of SAP Workflow as an extension of ABAP: a kind of ‘ABAP++’.

/wp-content/uploads/2013/01/plus_plus_176611.jpg Plus-Plus building blocks

Workflow is often thought of as ‘simply’ a tool for collecting approvals: approve a Purchase Order, reject an employee’s leave request, etc.  It’s usually all about decisions, inboxes, agent assignment and so on.

But workflow can also serve as a rich programming tool for deftly handling complex sequences of background steps. We can in fact use it when there is no human interaction at all.

Let’s start with a real-world example from one of our recent clients, a state tax office.

Talking with the Taxman about Processing*

We all pay tax. Let’s say you appealed against a harsh assessment of your 2012 return, and the tax office reduced your tax bill by $1000. That’s called a ‘reassessment’, and while it’s great news for you, it‘s a practical burden for the tax office. A reassessment requires significant post-processing:

  • reverse any write-offs; also reset clearing, cancel interest and remove dunning locks
  • change the due dates on existing debts
  • run clearing again (and wait for it to finish)
  • adjust any existing ‘payment plan’ to use the new, reduced amount

Can you imagine a tax officer doing all that manually, and in the right order? I can’t. So we decided to automate it. The tax office liked this idea a lot, but had some strict stipulations:

  • the above tasks have to be executed _immediately_ when the reassessment is posted: not in some overnight batch job
  • a detailed audit trail of the adjustments is required, in case there is an appeal
  • if the process stops halfway (due to an error), we should be able to safely restart it
  • if the process stops due to a locking error, it should restart itself

Can you imagine a clever ABAP program doing all of this? I can’t. When do we trigger the program? Where do you keep this audit trail? What about restarts and locking errors? 

OK, maybe it could be done. But to any workflow developer, the above requirements clearly spell out the word ‘W-O-R-K-F-L-O-W’.


The Workflow Solution

What seems like an impossible set of requirements is really no problem at all, once you approach it from a workflow perspective.

  • We break the problem down into objects, events and methods (E.g. event Reassessment.Posted, method PaymentPlan->Adjust).
  • We use the workflow builder to create an intuitive flow diagram of the process steps. This diagram can also be used in early discussions with the business analyst.
  • We employ terminating events to wait for external processes to finish before proceeding.
  • We can also use complex forking logic (although not required here)

The use of SAP workflow technology then provides the following snappy features for free:

  • By raising a Reassessment.Posted event, the processing can start immediately
  • We have a detailed log of everything that happened, including the data values at the time (which are stored in the workflow containers)
  • Using GOS (Generic Object Services), users and auditors can easily find and view the processing log for any given reassessment
  • If a step halts due to a temporary locking error, workflow will automatically retry the step three times, 20 minutes apart
  • If a step halts due to an application error, we can examine the containers (even possibly adjust them) and resume the workflow from that point on. See transaction SWI2_DIAG.

Returning  to our tax office client, the above workflow was successfully implemented and now handles hundreds of reassessments a week. This saves the tax officers many hours of drudge work, and ensures that all steps are done correctly and in the right order.  Errors are very rare, especially after we sorted out a few issues with temporary error handling. 

The Results

Once they felt the power of workflow, our client embraced the idea. We now have ‘ABAP++’ workflows handling processes such as:

  • Client registration checks across multiple systems (R/3 and CRM)
  • The updating of FACTS on contract objects
  • Initiating refunds

I’m sure many other people have explored this same concept; I just haven’t seen many examples of it yet. I’d love to hear your stories..

* obscure 80’s music reference

Assigned Tags

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

      Hi Paul,

        Great Blog. Expecting lot of blogs in future. 

      Author's profile photo Rick Bakker
      Rick Bakker

      Great stuff!

      I especially like the idea of having no users involved - sometimes the right person for the job is WF-BATCH.

      Author's profile photo Swarna Latha Padala
      Swarna Latha Padala

      Good one! Great way of explaining the meaning of 'Work-flow'.

      Author's profile photo Susan Keohan
      Susan Keohan

      Hi Paul, This is great stuff (of course, you are preaching to the choir here but still).

      I very often have to remind people that workflow is not just about sending mail.  The audit trail (provided by the workflow log) can be a deciding factor on whether you should use workflow.

      Sure, this could also be accomplished by an ABAP report.  But why re-invent the wheel.

      Keep on blogging!


      Author's profile photo Jocelyn Dart
      Jocelyn Dart

      Nice Paul! Great to see a big reminder also that workflow is not just about approvals! Looking forward to the next 71... 🙂

      Author's profile photo Former Member
      Former Member

      I am new in here - so let me first greet you: 'Hello WF gurus' 🙂

      Concerning the blog, I really liked the ABAP++ name 😉

      I have regretted not having ++ operator in ABAP so many times.. now I understand why - SAP reserved it for more sophisticated function than simple increment 🙂 for Workflow!

      Author's profile photo Former Member
      Former Member

      Great article Paul!  I really enjoyed it.

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

      Hey Tracy,

      Thanks - glad to hear it. Now it's your turn!

      We all have a workflow blog inside us.



      Author's profile photo Murali Krishna
      Murali Krishna

      A simple concept which explains the GREAT about Workflow.

      Wonderful explanation.

      Best Regards,

      Murali Krishna.

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

      Thanks for the kind feedback Murali!



      Author's profile photo Roopashree V
      Roopashree V

      Hi Paul,

      Your article will make every ABAPers learn workflow. No doubt.




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

      Roopa - I'm glad you liked the blog. I hope you can give it a go!