Escolar Documentos
Profissional Documentos
Cultura Documentos
03/09/16
Workflow_for_Beginners
Page 1 of 16
03/09/16
Workflow_for_Beginners
Page 2 of 16
1:Find a standard business object - which relates to the desired master data.
Transaction SWLD
Definition Tools SAP Business WorkflowDevelopmentDefinition ToolsBusiness
Object Builder (Transaction Code SW01)
Click on the Business Object Builder. The initial screen appears as follows.
Either search for an object by name in short description. Or use the IMG structure, which
is accessed via the Business Object Repository button.
Position mouse cursor in the field Object/interface type and hit F4In the pop up
window click Information SystemSearch the business object created earlier or SAP
standard business object. Select it and click display
03/09/16
Workflow_for_Beginners
Page 3 of 16
Select all object types and the following screen appears. Here the businisess object
BUS2054 has been explored, which is under Project Systems.
03/09/16
Workflow_for_Beginners
Page 4 of 16
03/09/16
Workflow_for_Beginners
Page 5 of 16
A screen showing the components of the object is dispalyed as the following figure:
03/09/16
Workflow_for_Beginners
Page 6 of 16
Open the Object type in change mode. When you change your subtype the first step is to
create a new event, this is done by selecting the Event node and clicking the create
button. Give the event a name and a description. Next set the status of this object type
component to implemented.
Event:
Z_EVENT_XX
Name:
Event name: XX
Description: Event Description: XX
Click on the new event and
Edit Change Release Status Object Type Component Implemented
(A small box sign vanishes from the right side of the event, indicating that it is
implemented)
There can be multiple triggering events for a standard/customer task.
In R/3 4.0 the release strategy for new Object Types and Object Type
Components (methods, attributes, events, etc.) was enhanced. Now
when an object type and/or components are created, there are
different statuses to select, based on its required purpose. The
statuses are:
03/09/16
Workflow_for_Beginners
Page 7 of 16
4: Create a method.
Next a method must be created without using any function module template. When
creating the method ensure that the method call is synchronous - this means that the
method doesn't require a terminating event.
A method can be synchronous or asynchronous. Synchronous Method
Method that, for the duration of its execution, assumes the process
control and, after its execution, reports to the calling component (work
item manager, in this case).
Synchronous methods can return the following data, if defined: Return
parameters, one result and Exceptions.
Terminating events can also be defined for a single-step task described
with a synchronous method. At runtime, the relevant work item is then
terminated either when the synchronous method is successfully
executed or when one of the defined terminating events occurs.
Asynchronous Method
Method that, after its execution, does not report directly to the calling
component (work item manager, in this case).
Asynchronous object methods do not return results, parameters or
exceptions.
At least one terminating event must be defined for a single-step task
described with an asynchronous object method.
At runtime, the relevant work item is only terminated if one of the
defined terminating events occurs.
Next set the status of this object type component to implemented. The methods are not
implemented unless you once open their program. Select the method and open its
program. It gives a message Do you want to generate a template automatically for the
missing section. Click Yes. Inside the program insert the code CALL
TRANSACTION FB03. Display Financial Document.
03/09/16
Workflow_for_Beginners
Page 8 of 16
Method:
Z_METHODXX
Name:
Method name: XX
Description: Method Description: XX
Edit Change Release Status Object Type Component Implemented
5. Create Key fields.
The whole business object needs to be implemented so click on the business object title
and
Edit Change Release Status Object Type Implemented
Now you can check the syntax, generate the Business Object and then test it.
Execute the custom method you created and give the Company code, Document
number and Year.
7:Create workflow task.
Now we need to create a workflow task, this will be triggered by the event and will call
the desired method in your business object subtype/Object type.
Tasks to user means generic actions, which are in the responsibility of
a person (agent) or group of persons (agents), that, may have to be
done in a predefined interval.
Runtime execution of a single step task produces a work item in the
selected agents integrated inbox.
Transaction SWLD
Definition Tools Tasks/Task Group Create
03/09/16
Workflow_for_Beginners
Page 9 of 16
03/09/16
Workflow_for_Beginners
Page 10 of 16
8: Set up containers.
There are a number of data containers, which are used in this process to transport relevant
data between events, tasks and methods, we need to make a few small modifications to
these.
Click on the Containers button. Now click the Create button. Create three fields in the
container with reference to the database table. For the first field give reference table name
as BKPF and reference field name as BUKRS, for the second give reference field
BELNR and GJAHR for the third. Now go back to the Triggering Event tab,
highlight the newly created record in the table and click the Binding Definition button.
03/09/16
Workflow_for_Beginners
Page 11 of 16
This shows us how data is transferred from the Event container into the Task container.
There should be four records. Now click on the Event Parameter Container button, this
shows us what data is present in the event for transfer to the task. If there is matching
data in the Event Parameter Container, copy the element name from the screen and insert
it in to the associated slot in the binding definition (Enclosed in &'s).
The last step of all is to activate the event linkage, by pressing the small red button to
the left-hand side of the event record. When it is activated it becomes green. This creates
the link between the event and the task - which will call the method, which in turn calls
the required transaction or reports or function module.
Determine the possible Agents for executing the single step Task.
An agent is an executor of a work item.
A work item is the actual runtime representation of a workflow
process step (task). Work items appear in users integrated
inboxes.
Possible agents are a collection of agents who qualify to execute a
work item, and therefore could potentially receive a work item in
their integrated inboxes.
Selected agents are those possible agents (1 or more) who are
elected to execute a task at runtime. They actually receive the
work item in their
integrated inboxes.
The actual agent is the agent among those selected agents who
actually processes the work item. When the actual agent processes
this work item, it disappears from the integrated inboxes of any
other selected agents.
At runtime, a pool of selected and actual agents can be created for
the following types of actual agents:
The processing agent: The person(s) who actually processes
the
work item.
The deadline agent: The person(s) informed when a work
item is not processed fully within the specified deadline. This
notification is received via a deadline work item in the deadline
agents integrated inbox.
The notification agent: The person(s) notified when an activity
step is fully processed. This notification is received via notification
e-mail in the notification agents SAP office e-mail. The notification
03/09/16
Workflow_for_Beginners
Page 12 of 16
Agents are an important part of tasks. Agents (capable executors of the task) must
be assigned to the single-step task. (Within the task definition, Additional
dataAgent assignmentMaintain.) These are the agents drawn from the
organizational plan who are qualified to perform the task.
03/09/16
Workflow_for_Beginners
Page 13 of 16
10: For this demo example, you will trigger the event by writing a custom code.
The starting point of a workflow is the object/event trigger. Without this the
possibility of building a workflow is ruled out. The triggering of events is achieved
through a number of mechanisms some of them are listed below:
Events can be created in the following ways:
Change document
Status management
Message control
Custom code: The function module SWE_EVENT_CREATE is used to trigger the
event. Dont forget to write a commit work after the function module call.
11. A Single Step Task.
By now you have defined a Business Object with key fields Company code, Accounting
document number and Fiscal year. You have created a method and an event for the
Business Object. You have also defined the Task for linking the method and event and
also defined containers and performed the binding definition. You have also defined the
custom code to trigger the event. Now, your objective is to display financial document
using CALL TRANSACTION FB03, when the event is triggered. For this you must put
the following piece of code inside the method of the object and generate it.
Check that you have given your username in the agent assignment section of the task.
Now when you execute the custom code the event will be triggered, so the key fields will
be inside the event container, from there it will pass on to the task containers you have
defined. This transfer is controlled by the binding definition you established before
activating the task. From the task container the key fields will be available inside the
Business Object. Thus they will be assessable inside the Object Method, where you use
them to display the financial document.
12. Some Workflow Concepts
03/09/16
Workflow_for_Beginners
Page 14 of 16
03/09/16
Workflow_for_Beginners
Page 15 of 16
3) The workflow step transfers application data from the workflow to the
synchronous customer/standard task.
4) The task transfers application data from the task to the object method parameters.
5) The execution of the object method may change the application data. The object
method parameters transfer data to the task.
6) The task transfers application data back to the workflow.
7) The workflow step transfers application data from the workflow to the
synchronous customer/standard task.
8) The workflow step transfers application data to the standard role parameters.
9) The task transfers application data from the task to the object
method parameters.
10)
The execution of the object method may change the application data. The
object method parameters transfer data to the task.
11)
The task transfers application data back to the workflow.
12)
The workflow step transfers application data from the workflow to the
asynchronous customer/standard task.
13)
The task transfers application data from the task to the object
method parameters.
14)
The terminating event transfers application data to the task.
15)
The task transfers application data back to the workflow.
The dataflow between the application and workflow container elements and between
the elements of the workflow container, event containers, task containers, role
containers, and method parameter containers is controlled by a set of rules called the
binding definition.
03/09/16
Workflow_for_Beginners
Page 16 of 16