Академический Документы
Профессиональный Документы
Культура Документы
40
From the release of SAP® NW04 version, SAP® has introduced many new features among which exception
handling is one.
Exception handling is done in workflow using Blocks (TRY-CATCH mechanism). “Blocks” is one of the new
features introduced from NW04 version.
This document details about the usage of Blocks and the approach to trigger and handle the exceptions.
Pre-requisites
It is assumed that the reader of this article has some knowledge in SAP® workflow and has worked with the
steps Mail, Process control earlier.
Overview of Blocks
• Blocks could be treated as folders combining a group of dependent work items. They are shown as
folders in the workflow log.
• Each block would have start and end nodes.
• Blocks can be deadline monitored (only Latest End)
• Blocks can catch exceptions
Following are the screenshots representing how a “Block” appears in the workflow definition and in the
workflow log:
Fig: Appearance of “Block” in the Workflow definition.
A “Block” is completed only if the dependent work items are complete or in the final state. If a “Block” is
cancelled, all its dependent work items are cancelled.
Each “Block” can have its own container elements. All the parent container elements are visible within the
“Block”.
Defining a Block
All the dependent steps could be defined with in the Block start and Block end.
As mentioned earlier, Blocks can handle exceptions. If an exception is caught, everything inside the block is
cancelled. If exception is not caught, process is set to an ERROR state (This could be compared to TRY-
CATCH in ABAPTM programs. If the exception is not caught, program results in dump)
• Create a new workflow and define a new step “Block” as mentioned earlier page.
• In the “Block” step, click on the tab “Exceptions” and make an entry of a new exception, for e.g.,
“Dummy_Excep”, which would be raised in the workflow definition.
• Activate the exception defined above, by clicking on the button left to the exception name
• Go back to the main screen. Two branches would be appearing between the block begin and block
end, as shown below. Exception branch is taken whenever the exception, Dummy_Excep, is triggered.
• Exceptions are triggered using the step “Process Control”. Define a new step “Process Control” in the
normal branch. Enter the step name and the outcome name. Select “Throw Exception” in the function.
In the event name, select the exception name defined earlier (see the screenshot below).
• Uncheck “Step not in workflow log” if you would like to see this step in the workflow log.
• Define a mail step in the exception branch of the block (for testing purpose – to ensure that this
exception branch is taken, when the exception is triggered). The execution flow of the exception
handling is shown below:
SWITCH in multiple condition
SAP® has introduced new features in Business Workflow in the releases 6.20, NW04 and NW04s.
This Tutorial introduces you to a new feature SWITCH provided in the step “Multiple Condition” of SAP®
Workflow. It is assumed that the reader of this Tutorial has already some knowledge in Business Workflow and
has worked on “Multiple Condition” step earlier.
The SWITCH feature in the step “Multiple Condition” is provided from the release NW04. The only feature
available before NW04 with this step is “CASE”. In the case of “CASE”, the workflow system checks the value
of the basis of comparison against the defined comparison values (as shown below).
In SWITCH, each branch of it carries a condition definition. We can visualize “Multiple Condition” with SWITCH
as a group of “Condition” steps.
Create a new workflow definition with a container element “CARRID” (Well known example for training
purposes).
Set the “Properties” as import.
Double click on the undefined step to create a step “Multiple Condition”. Following screen appears:
Understanding "Local Workflow"
In this tutorial, we would explain creating and working with a local workflow.
Fill-in the Abbreviation and Description and click on the tab “Version-Dependent (Current Workflow
Version).
Select the step “Event Creator”. Provide the Step Name and Outcome Name. Also select “Trigger Local
Event” in the Event Creator.
Enter the name of the event we defined earlier.
Go back to the main screen and create a new step (See the screenshot below)
Go back to the main screen. In the local workflow definition, right click and click on Create.
Create a new step “Mail”.
Go back to the main screen. The workflow definition would look as follows:
Activate your workflow and test your workflow definition. You might not be able to find the email in your
SAP inbox. Follow is the screenshot from the workflow log.
When the main workflow is ended, the local workflow would automatically end with a status “Logically
deleted”. The workflow would continue further after the step “Event creator” without waiting for the local
workflow to complete.
So let us create a step “User Decision” after the step “Event Creator” in the workflow definition.
Activate and test run your workflow definition. You would now observe an email and also work item
regarding the user decision step in your SAP Inbox (see the screenshot below)