Академический Документы
Профессиональный Документы
Культура Документы
Building a simple Workflow application using the steps "User Decision" and "Mail". (More details)
Creating a container element and using it in the step "Mail". (More details)
Inserting data from Internal Table into the step Send Mail (More details)NEW
Tracing the events triggered during the execution of a transaction (More details)
Sending recursive mails upon reaching the deadline until the task is completed (More details)
Maintaining Translations for the Work item text and Outcome Names (More details)
Raising exceptions in a method and handling the same in the workflow (More details)
Steps to transport agent assignment from one system to another (More details)
Retrieving the Work item details of the deleted users (More details)
Registering WEB DYNPRO/BSP Application with a Workflow Work item (More details)
Capture Rejection Reason Text from User Decision in Workflow (More details)
Forward a work item to your own currently logged in SAP ID (More details)
Consistency and Extended Checks for Workflow Template and Tasks (More details) NEW
Offline Workflow Approval in ECC R/3 without SAP Logon from E-Mail (Outlook) (More
details) NEW
Passing multi-line parameters from an ABAP Class event to a Workflow container (More
details) NEW
Concept of Re-evaluate agents for active work items in SAP Workflow (More details) NEW
PO List Retrieval for which Workflow isn't triggered due to Event Linkage deactivation ( More
details)
Display Workflow overview of one object (Purchase Order) in another (Purchase Requisition)
(More details)
Trigger workflow when a record is created in a database table (More details) NEW
Triggering approval workflows only for Purchase Orders belonging to a particular purchasing
group (using startup conditions) (More details) NEW
Binding is the set of rules that define which data is passed to which part of the process.
c.
The area in which you insert the new workflow definition is indicated by
Now select the undefined step and select Create step or double click the undefined step. Now among
the different steps chose the User Decision by double clicking on it.
Now select
Now we need to include a mail step to be sent to the requestor. Now select the line Approve and do
a right click. Different options on shown on the context menu. Select Create.
Do not change the recipients. Our mail is intended for the persons who triggered this workflow.
&_WF_INITIATOR& contains the value who executed the workflow. Since this is a test object, we are
using &_WF_INITIATOR&. But we wouldnt be using this variable in real time scenarios. We would
discuss about this in the coming documents.
Now select
A popup appears requesting for the abbreviation and the name for this task. Enter the same and
press enter.
Press SAVE to save the workflow application. You need to enter an abbreviation and name for your
workflow as shown below. You can change any of these at any later point. After saving, a number is
assigned to your workflow starting with WS, as shown below.
Now choose
Now the recipient would receive a work item in his SAP inbox (Transaction SBWP).
Now execute the work item by pressing Execute. The following screen appears:
Choose one among Approve or Reject as part of the user decision. He can select the third option to
retain the work item in his inbox and make the decision later. Now suppose that the recipient has
chosen one of the first options. Now a mail would be sent to the requestor with the status of his
request.
As marked in green in the above screenshot, the description available in the work item is a default one
provided by SAP. In case we need to add our own text, do the following:
1.
In the tab Control, the standard task that is being used is displayed. In this case, the standard task
that is being used is TS00008267.
2.
Go to transaction PFTC_COP to copy the standard task. Select Standard task in the task type and
enter the task number (without the prefix TS) in the Task.
5.
A new task would be created. Please note the task number that is created now.
6.
To change the task description, you can use the transaction PFTC.
7.
8.
9.
Here replace the standard task number with the custom task created above.
2.
Lets create a container element for Carrier id. Click on the Workflow Container on the left side of
the screen (as shown in the screenshot below):
3.
4.
5.
6.
7.
Now the element created could be seen on the left side, below the Workflow Container.
2.
3.
In the subject line, enter Carrid value entered is: and click on Insert Expression.
4.
5.
6.
8.
Enter the value of the Carrid as shown above and press execute.
9.
A mail would be sent to the recipient mentioned earlier with the carrid value entered.
Inserting data from Internal Table into the step "Send Mail"
By Sandeep Jape, Yash Technologies
Purpose: The purpose of this document is to insert multiple lines of an internal table in Send Mail Step
in workflow.
Business Scenario: This tutorial can be used wherever you need to insert multiple lines of an internal
table in Send Mail Step through workflow for example PR, PO rejection text.
Process: This demo creation will involve the following steps
Pre-requisites:
You should have the basic knowledge about workflow that how to create a workflow & how to
include Send Mail Step. (Please check other tutorials on SAPTechnical.COM for your reference)
Step 1: Go to transaction SWDD, create a custom workflow save the same as follows
Step 2: Create a container element by name DIS_TXT& keep the properties as follows
Note: We are not going to fill this DIS_TXT at run time instead we will create test data in Initial Value
section which will be used at the time of testing. Refer the below screen shot, append lines using Append
Row Button & press confirm button >>
Step 3: Create add step Send Mail which will look like the following >>
Note:
Add subject & mail text & press OK button & give the name to step as follows & save in a request.
Now copy the task number of the send mail step & go to transaction PFTC >>
Inserting data from Internal Table into the step "Send Mail"
..Previous
Go to Transaction PFTC put your task & press change button >>
Now click on Container Tab & create an element as shown below >>
Note: Do not modify any standard mail step task, always copy & do the changes & use the same in your
custom WF.
Maintain properties for above element as shown below & save the task & exit >>
In mail step put your cursor on description & click o button Insert Expression
Double click on container element DIS_TXT & you will see following screen
Select last option All lines with line break. It will look like this
Note: For demo purpose I have included all 3 types
Now got to Transaction SBWP & click on Inbox & you will see our mail. Open it.
So we have successfully inserted multiple lines of an internal table in send mail step & displayed in
SBWP.
You can use this functionality in multitude of other ways as per your business requirement in your project.
Condition Step
By Suresh Kumar Parvathaneni
Agenda:
This document details about the steps Condition.
Pre-requisites: It is assumed that the reader of this document has a preliminary understanding of
workflow and has worked with the container elements earlier. If not, please go through the first two
Tutorials of workflow available in this site. (More details)
Procedure:
1.
2.
3.
4.
5.
Double click on Carrid. Next click on = and enter the value AA in the constant field and press
ENTER.
As shown above, there are two branches here. One navigates to true, if CARRID = AA else the
control takes the branch False.
Test the above scenario by inserting mail steps in the above 2 branches and by passing different
CARRID values.
Condition Step
By Suresh Kumar Parvathaneni
Agenda:
This document details about the steps Multiple Condition.
Pre-requisites: It is assumed that the reader of this document has a preliminary understanding of
workflow and has worked with the container elements earlier. If not, please go through the first two
Tutorials of workflow available in this site. (More details)
Procedure:
1.
2.
3.
Now click on undefined step and create the step Multiple Condition.
4.
5.
Do this.
Elseif carrid = AH
DO this.
Elseif carrid = SQ
Do this.
Else.
Do this.
Select the CARRID using the F4 help for the comparison basis field.
Enter the values of the carrid under the Comparison values with the corresponding outcome name (of
your choice)
Double click on Carrid. Next click on = and enter the value AA in the constant field and press
ENTER.
Click on Transfer and go to graphic.
As observed above, there are different branches for each value of CARRID mentioned above.
Test the above scenario by inserting mail steps in all the branches and by passing different CARRID
values.
2.
Create two container elements MaxSeats, Occ_Seats with the import property set. You can use the
reference fields sflight-seatsmax, sflight-seatsocc for this.
3.
Create another container element AvailableSeats without setting either import or export property as
this is calculated within the workflow and used within the workflow. You might use any of the above
reference fields as data types.
4.
Define a new step Container Operation in the workflow definition by double-clicking on the
Undefined step.
5.
In this step, we would calculate the available seats from the max seats and seats occupied.
I would recommend entering all the container elements from the F4 help instead of typing them
manually.
6.
7.
Create a mail step after this to send the available seats information.
8.
Test the above functionality by passing some values to the maximum and the seats occupied.
9.
2) Double click the below shown item in the workflow container to create an element called Counter.
3) Then the below screen pops up and fill the screen as shown below,
5) Now the following screen of step Loop Until opens and set the condition as below, i.e. the loop runs
until
8) Enter the following details in Send Mail step and click on Transfer and to graphic
11) Then create a Container operation step on the same False branch of step Loop Until after
the Send Mail step.
16) Go to your Business workplace (SBWP) and check the inbox. You will find two mails, as the counter
is initially set to 1 and loop runs for two times until Counter gets incremented to 3 to satisfy the
condition that was set in container operation.
Here we have to insert form type and action. Action can be of four types:
For it you have to create a form so that you can attach it to the workflow. Click on create button:
Here we are creating the form named Material info using the workflow container element Y_form_makt.
Now according to our requirement we are just using the material number & material description in the
form layout.
For e.g. we are using the material number as input value and description field as output only.
We have also implemented the required changes in the flow logic of that form.
After completing this, we will execute this workflow and will get the form:
6. If you have not created the structure, you can do so by double clicking the container.
7. Then give name for the container element and type of the element, and if you are using this
structure for changing of some values be sure to check export and import check boxes in
properties tab.
10. Give your form a name and select the structure for which you are building the form .
11. And click on continue.
15. This will open the form in screen painter to modify the form, make necessary changes in layout.
16. If you need to change the flow logic you can go there by clicking on flow logic, where you can
change the flow logic.
17. If you want to control the data in PBO and PAI level you can double click the module to be
navigated to the function modules generated by sap system. Even though SAP recommends not
to change the modules you can change them with due caution to meet your requirements.
Double-clicking on the key field parameter gives you technical information of the field.
In order to trigger an event programmatically, we would use the function module SWE_EVENT_CREATE.
Following is the sample code to trigger the events programmatically:
REPORT
ZDEMO_TRIGGER_EVENT.
DATA:
KEY
CALL
EXPORTING
objtype
objkey
event
*
*
*
*
*
*
*
*
*
*
*
*
KEY
=
'1163'.
LIKE
SWEINSTCOU-OBJKEY.
Material
Number
FUNCTION
(hard-coded)
'SWE_EVENT_CREATE'
=
=
=
CREATOR
=
TAKE_WORKITEM_REQUESTER
START_WITH_DELAY
START_RECFB_SYNCHRON
NO_COMMIT_FOR_QUEUE
DEBUG_FLAG
=
NO_LOGGING
=
IDENT
'
=
'
EVENT_ID
EVENT_CONTAINER
'
=
=
'
'
'
'
'BUS1001006'
KEY
'CREATED'
'
'
'
'
'
'
'
=
IMPORTING
=
TABLES
=
EXCEPTIONS
OBJTYPE_NOT_FOUND
OTHERS
.
IF
sy-subrc
MESSAGE
ID
SY-MSGID
WITH
SY-MSGV1
ELSE.
WRITE
ENDIF.
=
=
TYPE
SY-MSGV2
'Event
<>
SY-MSGTY
NUMBER
SY-MSGV3
1
2
0.
SY-MSGNO
SY-MSGV4.
Triggered'.
COMMIT WORK.
In order to test whether the event is getting triggered or not, we can make use of Event Trace. Switch on
the event trace using the transaction SWELS.
Requested Start
Latest Start
Requested End
Latest End
In this example, we will define a deadline to the User Decision example created earlier (click here).
Following is the screenshot of the application developed using the User Decision example:
After selecting Work Item Creation, chose an offset of 5 minutes. This means that the work item must be
executed within 5 minutes of the creation, if not this would trigger.
Check for the work item in the SAP Inbox. This time do NOT execute the work item.
Wait for the deadline to be triggered. After that, a deadline message is delivered to the recipient
mentioned in the Latest End tab. See the screenshot below.
Dont worry if the deadline message doesnt appear immediately after 5 minutes. This depends on
various factors including how the deadline monitoring program is scheduled and also on the availability of
the background processors.
Use SWWA to check how the deadline monitoring program is scheduled in program.
For example, assume that our work item has been created at 09:10 hrs and the deadline message is
expected to trigger at 09:15 hrs. From the above screenshot, it is understood that the background
program is scheduled to execute for every 3 minutes. Assume that the last run of the program is at
09:14hrs and the next run is expected at 09:17hrs. So even our deadline expires at 09:15, the deadline
message would appear only at 09:17hrs after execution of the background program.
Some more points
In our above example, we have used the deadline on the Work Item creation time. i.e., 5 minutes after
creation time, the deadline message would be sent. Now we would check the other option Expression.
Here we can mention the date and time, when the deadline message should appear irrespective of the
work item creation date/time.
As seen in the above screenshot, we can provide the target date and time by which the task should be
finished. Container elements could be used in this case. Please refer to our example on creation of
container elements (click here).
For demo purpose, we would be choosing the Requested Start as 2 minutes from the work item creation.
Choose the Work Item Creation from the list box.
Choose an offset of 2 minutes. This means that the work item shall be created after 2 minutes.
Save and activate the workflow definition. Execute the workflow definition.
In SAP inbox, you can observe that the work item is not yet delivered.
Following is the status of the workflow instance. You can observe that the work item is in the status
Waiting.
The status of the work item would convert to Ready after 2 minutes (as per the time mentioned in the
Requested Start).
5. Now go back to the tab Control. From the list box, select Create task
6. Let us have the material number displayed in the work item text. For this, we need to create a container
element for the Material (not a multiline element).
8. Choose the business object and the corresponding method for the material display (we have chosen a
dummy method for our demo purpose).
Click on Save and come back to the main screen of step Activity.
As seen in the above screenshot, there are two MATNR in the workflow container. One representing the
multiline element that we have created for the workflow container and the other is an index of a MATNR.
Since we have defined MATNR for the dynamic parallel processing, this step Activity would execute for
each entry in this multiline element MATNR. So MATNR() represents the index of the material during
runtime.
10. Choose the User in the Agents and specify the user id.
12. Execute the workflow. Test run your workflow definition by providing some test data
13. Now check your SAP inbox (Transaction SWBP). There would be three work items for three materials.
2.
Now from the menu bar, select Settings Workflow settings Maintain Substitute
3.
Highlight/Select the name on the window, in this case SAPDEV02 and click on
Substitute.
4.
Create
5.
Validity field describes about the period in which the setting would be active. Note that the dates on
the screen would range from the current date to 31 st Dec 9999.
Regarding the checkbox Substitution active, it is advised to leave this checkbox unchecked for
system performance reasons. A check in this box indicates that the substitution is permanent and if
left unchecked it is treated as as-needed. A permanent substitute will automatically receive the
primary users work items in their own box. In the case of as-needed, substitute must manually adopt
the work items from the primary users inbox.
6.
7.
Select the corresponding User-id (if you have been assigned as a substitute for multiple people, then this
option would allow you to select the user name of whom you would to check the work items)
The corresponding users work items would appear in our inbox now.
You can end the substitution, by selecting settings Workflow settings End substitution.
Note: Substitutes can only adopt work items that are directly routed to the person for whom they are a
substitute. If you are a substitute for a user (SAPDEV02) who has been made a substitute for another
user (SAPDEV01), you will only see work items for user SAPDEV02 and not of the user SAPDEV01.
Go to Transaction SO13.
2.
3.
4.
5.
6.
Now the notification would be received at the provided email address if there are any pending work
items in the inbox.
The BADi that is used in filtering the work items is WF_BWP_SELECT_FILTER. To implement the BADi,
go to transaction SE18. From the menu, select Implementation Create. (See the screenshot below)
Enter any meaningful short text for the implementation and click on the tab Interface
You are now navigated to the class builder. Now double-click on the method name shown on the screen
(see the snapshot below)
Now let us filter out the work items belonging to the task TS2000066. See the code below:
Activate the method and also the implementation. In the state of active, you wouldnt be able to make any
changes. To make any changes, we need to deactivate it and then make the changes.
Now check the inbox and would notice that the work items related to that task are no more appearing.
To notice the differences, try activating and deactivating the BADi implementation.
Go to transaction SMW0
2.
3.
Execute
screen)
the
transaction
(No
need
to
fill
any
values
on
the
selection
4.
Click
on
Create.
The
following
screen
Descriotion.
5.
appears.
Enter
the
Obj.
Name
and
6.
Your
screen.
entry
is
now
available
in
the
table
control
on
the
2.
Now
in
display.
3.
Click
Modules.
the
step
User
on
decision,
go
Demo
to
tab
Work
item
Function
The function modules shown above need to be used as a template for defining the logo as per the
requirement. Using the function module SWL0_PREVIEW_DEMO_GIF_ONLY, we can only display the
logo of the company. Using SWL0_PREVIEW_DEMO_TEXT_AND_GIF, we can display both logo and
our own text below the logo. The FM SWL0_PREVIEW_DEMO_TEXT_ONLY is used to display custom
text only. For our demo purpose, we would use the FM SWL0_PREVIEW_DEMO_TEXT_AND_GIF.
6.
Now change value of e_info-gif-id to the object-id created in SMW0 (Logo id) and e_infodialogtext to the custom text we require.
Now in the workflow builder and in the tab Work item display, mention the name of the Z function
module
created
earlier.
8.
Execute your workflow definition. In your SAP inbox, you can see the logo and the custom text in the
preview
pane
of
the
work
item.
2.
3.
We can link the events to either standard workflows or custom workflows to carry out our business
requirements. Before linking the business workflows to events, we would need to trace the events that are
triggered in a transaction. This document explains the procedure in tracing the events for the Material
Master transaction (MM01). We would trace the events that are triggered when a Material is created using
MM01.
1.
Go
to
transaction
SWELS.
pop-up
screen
as
shown
below
would
appear:
2.
Click
on
Switch
on.
The
event
now.
3.
trace
would
be
on
4.
Now go
to
transaction
SWELS and
click
on
Switch
Off to
switch
off the
event
trace.
5.
Go to transaction
creation.
SWEL
to
get
the
list
of
events
triggered
during
the
Material
6.
Click
Execute.
on
The list of events that are triggered are shaded in green. A workflow object (shown in yellow) is also
triggered as it is attached to the event CREATED belonging to the business object BUS1001006.
Sending recursive mails upon reaching the deadline until the task is
completed
Recently, we encountered a scenario where-in we need to send recursive mails for every xx hours, when
the deadline is reached, until the task is completed. I am presenting the same here, with a simple
example, hoping that this would be useful to you all.
Start a new workflow and define a "User Decision" step. For steps on how to define a User Decision
step, click here.
In the step "User Decision", switch to tab "Latest End" and provide the details as shown below:
In the action, select "Modeled" from the list. Enter the name of the outcome.
You can notice that there are 3 branches now. Two belong to the User Decision Step (YES/NO) and the
other one is of Modeled deadline. So whenever a deadline is reached, this branch executes. When the
user completes his task, it would either take YES or NO branch accordingly.
Now assume that we need to send repetitive mails to the agent for every 3 minutes, until he completes
the task (in this case, acting on User Decision step).
Double-click on "Undefined step" in the "Modeled" branch and select LOOP(Until)
Using "Loop (Until)", we would be sending emails repetitively for every 3 minutes. To keep the loop open
continuously, lets define a condition which would never be met.
Enter a step name and then click on "Click here to create a new condition".
Since we intend to make this Loop indefinite, create a condition similar to the following one.
The above screenshot is of the step "Loop (Until)". Now double-click on the "Undefined" step above and
create an email step.
Sending recursive mails upon reaching the deadline until the task is
completed
...Previous
Now we need to send mails once every three minutes until the task is finished. To achieve this, we would
need to create a business object (or use an existing one) and create a dummy method (with no code in it).
Ensure that the check box "dialog" is unchecked in the properties of this method.
Now create a step "Activity" by double-clicking on undefined step after the email step in the Modeled
branch.
Using the above step, we are restricting the LOOP to send mails for every 3 minutes only.
Save and activate your workflow.
Test run the workflow. Do NOT execute the work item and wait for the alert mails.
Work item in inbox:
Work item along with the alert mails (after the deadline is reached):
: FORMABSENC.
Method
: CREATE.
Now save the task and go back .Now the binding between the task and the workflow was shown like.
You don't fill any agent for this task. You leave it as empty as shown in the figure.
Now we move to the Task properties. Click the agent assignment icon.
Click here to continue...
You go back to the workflow builder now the Agent Assignment was active.
You enter the name of the user who wants to do this task . In my Example I entered Developer2. And
then click the Check Agent Button. It automatically creates the random key for that user and it will be
assigned to the Agent_001.
Now
again
click
Now the Leave Form will be waiting for the user to fill.
the
execute
Button.
Drag and drop the User decision step. Enter the following details
Select the agents Workflow initiator (expression) and click on Transfer and to graphic (tick mark
button).
Following screen appears.
To get &_WI_OBJECT_ID.MATERIAL& in above screen, click insert variable icon (above that yellow
icon).
Save in local package.
Go to Additional data menu Agent assignments -> Maintain.
Select it and click on Attributes from application toolbar and select General task radio button, click
Transfer
on
Select Workflow initiator as Agents and click on Transfer and to graphic button
continue.
Select workflow container and double click on BUS1001006 in the list displayed.
Click on properties tab and select the import check box and click on ok
Again open user decision, which was already created, and make changes as bellow
In Parameter1 click F4 and select Material number as bellow
Click on Binding
Click on ok
Save and come back to graphic, the following screen will appear
Check
your
SBWP.
Double click on Work item executable
inbox
by
using
TCode
ENDIF.
ENDFUNCTION.
Creating
rule
using
the
PFAC
Transaction
Go to the "Container Tab" and create a container element for the Position id which will be passed to the
function module
Our rule is created now. You can test the rule within the PFAC transaction by clicking the "Simulation"
button on the application toolbar. Now this rule is ready to be used in any workflow according to your
requirement via the rule container of the workflow.
Now you can use this rule in any of your workflow definitions.
You can observe that the text remains in the English language, whereas Workflow Started is translated
as Workflow gestartet (As the SAP has already provided translation for this)
Now to translate the text to German, Click on Extras -> Translation -> Translation (As shown in the
screenshot below):
Now a screen with all the workflow steps and outcome names are displayed for maintaining the
translation.
For our testing purposes, let us maintain the German text for the first two step types.
Now select the method you have created and click on button Exceptions available on the toolbar.
Following screen appears:
Enter the information as shown above. The error type Temporary error is chosen in the case wherein the
record is locked by somebody else or some required resource is not available. The error type Application
Error is to be chosen when there is no authorization for the document you are processing. The error type
System error is to be chosen if there are no values passed for the mandatory parameters.
Click on continue.
Try executing the method by clicking on Test/Execute (F8). The exception would be raised as shown
below:
Create a task and provide the following details in the new task:
Click on Outcomes tab. Here you can observe the exception you defined in your method:
As observed in the observe screen, the outcome is not active by default. If we do not handle the
exception, the work item might go into the error status. Activate the outcome:
Save your entries and go back to the main screen of Workflow builder. Please ensure that you have done
the agent assignment for this task.
You can now observe a new branch when the exception is raised. You can define your steps whenever
the exception is raised.
References:
http://help.sap.com/saphelp_nw04s/helpdata/en/c5/e4ad98453d11d189430000e829fbbd/frameset.ht
m
Enter a name for the Object type and click CREATE button for creating the custom BOR object.
Create events for triggering the workflow and stopping the workflow.
For creating the event place the cursor on the EVENTS and Click the create button like Key fields.
Create two events.
Enter the event name description etc and proceed further to create it.
Similarly create another event for ending the Workflow in the similar manner like that created earlier.
Click
on
the
CREATE
button
for
creating
the
workflow
for
handling.
Choose the Step type to be inserted for the notification like here we are using Send Mail option for
sending a mail to the user whenever any error occurred.
To continue, click here
error
Go
TAB.
to
the
Start
Events
After the successful linkage the following sign will appear on the workflow.....
This shows that the workflow has been linked to the event and it will be triggered whenever that particular
event will be triggered.
After the creation and successful linkage of workflow with the event it is required it is required to generate
a function module and attached it to the process code.
Go to SE37 transaction and copy a standard process code function module to a custom one. Do no
delete any parameters from the function module as the SAP standard program itself is calling this.
In that function module do the required validation and whenever the validation fails set a standard
parameter WORKFLOW_RESULT to 9999 from within the function module, otherwise normally proceed
to set the status to 53.
After the creation of function module it is required to attach it to the process code and corresponding
attached to the message type at the Partner Profile stage.
To continue, click here
Enter the Process Code Name, description and choose the processing type as Processing by function
module. Click on the extension button of Identification.
The details for the of the Process Code after clicking the identification button will be
Whenever idoc arrives into the Destination system then the standard SAP triggers the Process code
attached to the Message type in the partner profile. The partner profile is being maintained in the
transaction WE20.
Since, it is and inbound scenario so the message type and the corresponding process code will be
maintained for the Inbound Parameters.
Click on Create Inbound Parameters button for creating new Inbound Message type and the
corresponding message type.
Whenever the IDOC arrives into the target system, it checks the partner profile and finds the
corresponding process code. The process code is being linked with the function module through which
the IDOC is required to be
We can use ABAP classes in the definition and runtime components of SAP WebFlow Engine in the
same way as object types defined in the Business object Repository (BOR).
Before proceeding further we need to know where to create and maintain ABAP Classes and ABAP
Interfaces.
2.
The Class Builder allows us to create and maintain global ABAP classes and interfaces. Both of
theseobject types, like global data types, are defined in the ABAP Repository, thus composing a central
class library. Together, they form a central class library and are visible throughout the system. We can
display existing classes and interfaces in the class library using the Class Browser.
We can define local classes as well as global classes. They are defined locally in programs, function
groups or as auxiliary classes of global classes of the class pools. Local classes are only visible within the
defining module.
ABAP classes are processed using the Class Builder.
3.
To reach the initial screen of the Class Builder, choose Development Class Builder from the initial
screen of the ABAP Workbench or enter transaction code SE24.
4.
The Class Builder allows us to create Web development objects within the ABAP Workbench. We can use
the Class Browser to display and maintain existing global object types from the class library.
The diagram below illustrates the architecture of the Class Builder and the relationships between its
components (including the Class Browser)
From here, we can either display the contents of the class library or edit a class using the Class
Editor.Once we have defined an object type, we can implement its methods. From the initial screen or the
Class Editor, we can also access the Class Builders test environment. We can define the object types
immediately after implementing the method in the ABAP Editor. It is also possible to access the test
environment from the initial screen or Class Editor.
5.
Display an overview (in the Class Browser) of global object types and their
relationships.
6.
Create and specify the attributes, methods, and events of global classes and
interfaces.
Implement methods.
Redefine methods.
Global classes and interfaces that we create in the Class Builder are stored in the class library and
administered by the R/3 Repository: they therefore have the same namespace as all other Repository
objects. It is therefore necessary to have naming conventions for object types and their components and
to use them uniformly within program development.
8.
The following naming convention has been conceived for use within the SAP namespace. If we do not
observe the naming conventions for object types (classes and interfaces), conflicts will occur when the
system creates persistent classes, since it will be unable to generate the necessary co-classes.
9.
CL_<class name>
IF_<interface name>
Local
classes
in
(recommendation)
Local interfaces
(recommendation)
in
<method name>
Events
<event name>
Data
definitions
(recommendation)
<variable name>
To Continue....Click here
IM_<parameter name>
EXPORTING parameters
EX_<parameter name>
CHANGING parameters
CH_<parameter name>
RESULT
RE_<result>
12.
Within the SAP WebFlow Engine we can use ABAP classes that support the IF_WORKFLOWinterface.
Classes that have implemented the IF_WORKFLOW interface are recognized as workflow-enabled in the
Class Builder.
13. How to create ABAP Classes that support IF_WORKFLOW interface?
Next the pop up appears where we need to mention the detail as follows:
14.
The ZCL_TEST
interface.
class
now
contains
the
existing
methods
of
IF_WORKFLOW
The key attributes are used to define the object key. There can also be other defined attributes other than
key attributes. The SAP WebFlow Engine can access all public attributes of a class.
Key Attributes:
In the Class Builder there is an additional column Key Attributes on the
below:
We need to check this box when we are defining any attribute as the Key Attribute.
All key fields must be character-type fields (elementary types: CHAR, NUMC) and have a defined length.
The maximum length allowed for all key fields is 32 characters. The length of the key field for the
persistent display is 32 characters.
In the case of persistent ABAP objects we can use the GUID, which is generated automatically by the
object manager when an instance is created.
Attributes:
In addition to all the other data types that the Class Builder supports, we can also define attributes with
reference to an object from the Business Object Repository (BOR). To do this, we have to use the
structure SWOTOBJID as the data type. The BOR object is determined using the corresponding value.
To assign a BOR object instance to an attribute we need to use the corresponding BOR macros.
Normally, this is implemented within the CONSTRUCTOR of a class.
To Continue....Click here
Attributes
and
Key
BI_PERSISTENT~FIND_BY_LPOR
BI_PERSISTENT~LPOR
BI_PERSISTENT~REFRESH
BI_OBJECT~DEFAULT_ATTRIBUTE_VALUE
BI_OBJECT~EXECUTE_DEFAULT_METHOD
BI_OBJECT~RELEASE
A class that implements the IF_WORKFLOW interface can be used in any workflow. The class
is automatically released for use in workflows when the interface is implemented. Therefore, we
can only make compatible changes to a class after implementation (we cannot delete attributes,
change types or delete methods). There is no where-used list to show which workflows the class
is used in.
Internal classes of an application should not implement the IF_WORKFLOW interface, since
this could mean that each method of the class is used in the workflow. Therefore, we should
encapsulate the workflow functions in another class that calls the selected methods of the internal
class.
Each method of the IF_WORKFLOW Interface as mentioned earlier has its distinct functionality,
which is discussed below.
16. BI_PERSISTENT~FIND_BY_LPOR Method:
If we want to convert a persistent saved display of an object into an instance of the corresponding ABAP
class, SAP Webflow Engine calls the BI_PERSISTENT~FIND_BY_LPOR method.
Features:
The method parameter LPOR is the persistent object reference and is of SIBFLPOR structure type. A
reference of BI_PERSISTENT type is returned.
The following table shows the components of the SIBFLPOR structure:
Field
Description
CATID
TYPEID
INSTID
We can implement this method in several ways. In the case of persistent classes we can create the ABAP
object instance using the generated classes. In the case of individual persistence management we have
to implement the individual actions (such as creating an instance, performing an existence check,
entering public attributes, and so on) manually within the class.
Instance management takes place automatically in the case of persistent classes. In the case of individual
persistence management we also have to carry out instance management by class. The SAP WebFlow
Engine does not provide any instance management. We must therefore implement our own instance
management in the case of individual persistence management.
The FIND_BY_LPOR method should always return the same instance if the following problems are to be
avoided:
17.
BI_PERSISTENT~LPOR Method:
18.
BI_PERSISTENT~REFRESH Method:
SAP WebFlow Engine calls the BI_PERSISTENT~REFRESH method when the system has to ensure
that all values of an object are valid or that they agree exactly with the persistent display of the object.
Features:
The method implementation depends on the internal organization of the class. We can check the object
instance data in the database, if necessary.
If we do not need the method in our class, then we need only to carry out a dummy implementation
(without further coding) to avoid program errors when the system calls the method.
There is an implementation example in the CL_SWF_FORMABSENC demo class.
To Continue....Click here
20.
BI_OBJECT~EXECUTE_DEFAULT_METHOD Method:
The BI_OBJECT~EXECUTE_DEFAULT_METHOD method is the standard method for the object. This
method is executed when, for example, we call the object in Business Workplace.
Features:
We can display process objects or process step objects at different positions within the SAP WebFlow
Engine (for example, in Business Workplace and in Workflow Log). The SAP WebFlow Engine calls the
BI_OBJECT~EXECUTE_DEFAULT_METHOD method.
If we do not need the method in our class, then we need only to carry out a dummy implementation
(without further coding) to avoid program errors when the system calls the method.
There is an implementation example in the CL_SWF_FORMABSENC demo class.
21.
BI_OBJECT~RELEASE Method:
The system indicates that the reference to the instance is no longer needed by using
theBI_OBJECT~RELEASE method. This means we can delete the reference from instance management.
Once the last reference has been deleted from instance management, theGARBAGE COLLECTOR can
release the corresponding memory area.
Features:
If we do not need the method in our class, then we need only to carry out a dummy implementation
(without further coding) to avoid program errors when the system calls the method.
There is an implementation example in the CL_SWF_FORMABSENC demo class.
22.
In process steps we can use methods and attributes of ABAP classes in the same way as methods and
attributes of Business Object Repository (BOR) objects. We can call these methods in the process
context.
Features:
While using the ABAP Classes in the Process Steps the methods may contain dialogs, they can be
synchronous or asynchronous; they may appear in the workflow log, and so on.
In general, we can use any method that is implemented as a public method. The method can be
implemented in the class itself, in one of the super classes of the class, or by way of an interface.
The maximum permitted length for methods that are implemented by way of an interface, for
example IF_WORKFLOW~FIND_BY_LPOR, is 30 characters. If the method name is too long, we can
choose a shorter name for the method by defining an alias. If the method is implemented in the class or in
a super class, the name of the method cannot be longer than 30 characters, so this limitation does not
apply.
Parameters:
We can assign values from the workflow container to the method parameters. Conversely, export
parameters can be entered as workflow container values. The following overview shows how the
individual types can be used as parameters:
We can transfer method parameters that represent a persistent object (IF_WORKFLOW orBOR Object) in
the following ways:
TYPE SIBFLPORB
Object is transferred using the persistent display
BOR objects
TYPE SIBFLPORB
Object is transferred using the persistent display
TYPE SWOTOBJID
Object is transferred using the persistent display; this display is only valid for BOR objects
TYPE SWC_OBJECT
Object is transferred as object reference
Exceptions:
The SAP WebFlow Engine can deal with exceptions that are triggered by the methods. It differentiates
between application exceptions and temporary exceptions. The two exception categories are
differentiated by the exception in the class hierarchy or by naming conventions. In the case of a
temporary exception, the SAP WebFlow Engine attempts to execute the method again. In the case of a
permanent error the status for the workflow is set to error.
Class-Based Exceptions:
To create a temporary exception, we can use, for example, the CX_BO_TEMPORARY class or a
corresponding subclass. It can be helpful to trigger an exception for dialog methods when the user
cancels the dialog. Here, for example, we could trigger the CX_BO_ACTION_CANCELEDexception
(subclass of the CX_BO_TEMPORARY class).
Click on Change document class and then select Document from the list provided (see the screenshot
below):
After saving, go back to the main screen. You can observe the document template you just created, as
shown below:
Now in your workflow definition, create a new step Document from Template:
To continue...click here
Execute the work item. The document would open as shown below:
below)
After that Double Click On Include "Exclude Report" from Others tab
There
will
be
two
options
for
executing
the
report
in Dialog/ Background
Processing.
Give the Repot name, which is going to be executed. Here the report Name is ZWORKFLOWTEST.
Enter the select option name for the Selection screen of the report.
Here we are selecting For the report execution with the selection screen.
Continued...
With this we are into the last step of this process. Press the complete step from the screen.
In Result to the work flow execution the following screen of the report program will result
Step 2:
Select Plan version: 01
Select Object Type: TS
Select Object ID
Also,
In the Transport section enter or create your change request
Step 4:
On the next screen select the row with your task id Press "Add to Transport"
Then again select the row with your task id and press "Transport/Delete" this will bring up the prompt to
create a customizing request as shown below.
Remember: After clicking on Add to Transport you need to further click on Transport/Delete without
doing this together you wont see anything happening on your screen.
Step 5: Create the transport request to add the agent assignment in the transport by clicking on the create
button.
Step 6: Go to SE09 and release the transport and you now transport your change request as normal.
Give the name of the rule and choose the rule type as agent determination responsibilities.
Now go to the description page and give the rule description. Choose change text.
And choose the ok button. Now you have added a rule container element for netvalue (ekpo-netwr)
value.
After that go to the responsibilities tab. Here we can provide the agents for this rule.
Now, for example, choose the net value as 0 to 1000 and click on save.
The responsibility defined is in RED color. After saving the responsibility it will show the green color
status.
Choose your desired object type and choose create button. Now agent is assigned for your netvalue
between 0-1000.
You can assign several users for different netvalues. Lets assign one more agent when the netvalue is
between 1001-2000.
And you have to insert the agent for this net value range.
Enter the netvalue as 1000 it will show you the agent for this value.
Now you can use this rule in your workflow. Do not forget to do the binding between workflow container
and Rule container for the container element netvalue.
to
transaction
SWDD
and
create
new
workflow
definition.
Then
data.
Give the abbreviation and choose save. After that chose the tab start events.
Enter the following values:
Category: BO (Business Object)
Object type: BUS2032
Event: Created
Activate the event linkage and choose the binding button. Following screen appears:
choose
basic
In the above screen, A denotes Event linkage, B denotes Binding and C for Start Conditions
Click on Conditions button. Chose sales organization from the pop up screen as shown below.
And choose the operator as (=) equal to and choose the constant as 3000.
Now the workflow would only execute when the sales organization is 3000.
Provide the name of the customized function module name created earlier in the check function module
field.
Now workflow is triggered only when the sales order is created with the sales organization 3000.
Now as a monitoring tool we can also use transaction Code SWI2_ADM2 which retrieves the work item id
assigned to deleted users.
Now by picking up the entire work item Ids we can either re-execute the rule for the work item provided
some rule is used as the agent assignment step or in the task level shown in the screenshots.
We can also use the work item Ids that are retrieved from SWI2_ADM2 transaction to track the users that
are deleted and inform the concerned set of users. May be the user Id of a person has changed so we
need to retrieve the work item id that was present in the previous user id to be forwarded to the new users
id.
We need three standard reports to completely transfer the HR data from one system to the other. These
reports are RHMOVE00, RHMOVE30 and RHALTD00.
First, we execute the report RHMOVE00 on the DEV server.
In the field File name, press F4 and it shows the directory to choose the file from.
Notice the directory name here - /usr/sap/dev/work - this is the default directory of the dev server on
which we need to create a file (BASIS consultants would be helpful here). Give this directory name to the
basis person and ask him to create a file there named hrdata and grant you the write permission to this
file. We will use this file hrdata to export our records from dev server. This file would be Unix or Windows
NT based file depending on the server type. The basis person will create this file hrdata on the specified
server path. Once the file is created, it will show on the list of file name:
Now, our file hrdata contains all the data, which needs to be imported to the QA server. With the help of
BASIS consultant, copy the file hrdata from DEV server to QA server i.e. from path /usr/sap/dev/work
to /usr/sap/qua/work with the same rights and permissions provided on the dev server.
Note: If our requirement is to transport the HR data from one client to another, we can do the same by
clicking on
data.
In
the
other
scenario,
where
we
are
copying
data
from
one
server
to
another,
this
task wont solve our purpose. In QA server, run the report RHMOVE00
and choose P for physical file. This time, our working directory would be /usr/sap/qua/work/hrdata. Once
you execute the report in the quality server, the following screen appears:
Click on the
Press the
This way all the master data will get uploaded to the quality system. This will transport all the master data,
but if we compare the TCode PPOMA_CRM of DEV and QA servers, it will show that the organizations
have been created, positions beneath them are created but the persons attached to the positions are not
showed up. For doing that, we need to execute the report RHMOVE30 on the dev system and we see the
following screen:
Make the entries as shown in the figure and hit F8. We see the following screen:
Give the same or create a new request. Once done, release the request and transport the same. After the
request is transported, execute the transaction PPOMA_CRM in QA server. Thus we see that the entire
org structure is transported to the QA server from the DEV server. Now we see the persons attached to
the positions too.
Here Update op. indicates the operation, which triggers the event
At the bottom, Object type is the Business Object (which is already linked to the infotype 9048 in
SWEHR1) and Event is the event on the Business Object.
Save the entries.
Now we have configured the event ZRTW_INS on the Business Object BUS1065 to trigger whenever a
new record is inserted in IT9048.
We can also mention a Function module here instead of Event. This function module contains the code to
trigger
Now double-click on the message, to get the long text and the message details.
The above screenshot provides us with the message details (Message Class: ME) and Message Number
083.
Now we need to create a workflow which needs to be triggered from this message.
Go to transaction SWUY. Following wizard appears.
Click on Continue.
Click on Complete again. Pop-up screen regarding the package (Development class) appears. Assign
the package, you would like to have. Press ENTER. You would be automatically navigated to the
Workflow Template screen shown below:
Enter the Work item text and click on Workflow Builder. We are now in the Workflow Builder screen.
For our demo purpose, lets create a simple email step in our workflow definition. (To know about how to
include an email step in the Workflow definition, click here)
As highlighted in the screenshot above, the button Workflow is now enabled (before attaching a
workflow definition to this message, this button was disabled. Click on the button Workflow. The
workflow definition created earlier, in this case WS99900061, is now triggered. See the screenshot
below.
The enhancement technique (Open FI) that were developed for Financial Accounting Component.
Application developers must define their interface in a function module, an assignment table
is read in the accompanying code and the customer modules assigned are called
dynamically.
This can be easily adopted / customized to the business needs wherein SAP does not provide the
standard functionality through customization or enhancements. This functionality is primarily used in
FI in the areas of dunning, credit management, banking etc. For Example: Standard Dunning
functionality in SAP sends the notice to the Pay to partner function (based on the partner functions in
SD module i.e. pay to hits the books in Accounts Receivable in FI module), whereas the requirement
could be to send the same to Bill to party, based on the premise that the original invoice was sent to
him as per the partner functions in SD.
IMG Menu Path: Financial Accounting ->Financial Accounting Global Settings-> Business
Transaction Events-> Environment-> Infosystem (Processes).
Place the cursor on the key 00001120 and click on Sample Function Module
This navigates you to SE37 Function Builder. This is the function module
(SAMPLE_PROCESS_00001120) we would need to copy into a Z or Y function module for coding
Now in the SE37 screen, click on change button and enter the following code:
To assign function module to the event, we need to create a product, say ZPRODUCT. Click as
shown below:
Ensure that the Active check box is checked, otherwise BTE wouldnt trigger.
Now we need to assign the function module created earlier to the event
Click on new entries and create the following entry for 00001120:
To check whether the assignment field is filled with Demo BTE, display the created accounting
document from FB03 and check for the Assignment value.
Issue
For an opportunity, there is an associated OQT (Opportunity Qualification template) IBPO
QUALIFICATION, which has to be sent for approval using SAP workflows.
This OQT is a Java survey application that is embedded inside an opportunity.
The requirement was that whenever an OQT is saved, a workflow should be triggered to send this OQT
for approval. The OQT save button is a Java button that cannot be recognized directly by SAP system.
Software requirements
SAP CRM 2007
Solution
1.
Go to transaction CRM_SURVEY_SUITE.
2.
3.
When this survey is saved, it makes a call to CRM_SVY_OPPORT_PAI function module. This is the
linkage of the Java application to SAP.
4.
5.
This would show the implicit enhancement points for the function modules. By default, the implicit
enhancement points are at the start and end of the FM.
6.
7.
Go to the end of the FM and click on the yellow line. Now go to Edit -> Enhancement Operations ->
Create Enhancement.
8.
9.
10.
A new enhancement would be created ad the following code would be added to the end of the FM.
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"" A
*$*$-Start:
(2)------------------------------------------------------------------$*$*
ENHANCEMENT 1 Z_IBPO_OQT_EVENTTRIGGER.
*
ENDENHANCEMENT.
*$*$-End:
(2)------------------------------------------------------------------$*$*
ENDFUNCTION.
11.
Now write the code to trigger the event of the business object inside this enhancement. This code
would be executed when ever an OQT is saved.
Call the FM SAP_WAPI_CREATE. This FM accepts the business object name, Opportunity GUID and
business object event name as input and triggers the BO event.
Save and activate the enhancement. Go to Function Module -> Activate Enhancement.
13.
14.
15. Execute the Opportunity transaction. On save of the OQT, the function module
CRM_SVY_OPPORT_PAI would get triggered which would in turn trigger the business object event.
This would trigger your workflow!
NOTE: This implementation can be used for save on any survey. Also enhancement of any function
module can be done similarly. This approach might seem simple, but has vast implications so should be
used with care. Also function module enhancement is only possible on SAP CRM 2007; older versions do
not support it.
Conclusion
The issue of triggering a workflow from a Java save button was solved.
As we want to pass different text in the decision task, copy the standard task TS00008267 and create a
new one.
Before that let us create a WF container element to hold the value of URL and pass it to the task level.
Here HYEPERLINK is the task container element which contains the URL.
Save the task and go back to the WF and complete the binding.
Now test the WF. For testing purpose, we will use the URL www.rediff.com. Otherwise one has to
prepare the URL in the method or by any means and pass it in this container.
The WF has started; please check the SAP inbox to check the message.
You can expand the nodes and can check various business objects in BOR. You can double click on the
BO node and it will take you to BO display (SWO1).
1
For creating a Business Object and its attributes there are many already existing tutorials. So in this
tutorial we will not discuss creation of BO and its attributes.
1.1
To create instance of a BO
To create an instance of BO we need to have the key fields of that BO. Key fields will be used to uniquely
identify the BO. We can use the FM 'SWO_CREATE' to create an instance of BO in any report program.
DATA:
i_objtype TYPE swo_objtyp,
i_objkey TYPE swo_typeid,
object TYPE swo_objhnd.
i_objtype = <Business Object>
i_objkey = <BO key>
CALL FUNCTION 'SWO_CREATE'
EXPORTING
objtype = i_objtype
objkey = i_objkey
IMPORTING
object = object.
The variable object will hold runtime instance of the object type.
The other way is to use the macros defined in include <cntn01>
INCLUDE <cntn01>.
DATA:
i_objtype TYPE swo_objtyp,
i_objkey TYPE swo_typeid,
object TYPE swc_object.
*Create instance of Object type
swc_create_object object i_objtype i_objkey.
Internally the macro calls the FM SWO_CREATE. So you can either go for direct FM call or the macro
call.
1.2
Container
Basically the term Container is used with reference to Business Objects and Workflows. The Container
actually holds import and export parameters associated with any method of Business Object at runtime.
When ever we are calling any method of Business Object we need to populate container for import
parameters and after the method gets executed it returns the values (export parameters) in Container.
Business Object container is technically of type SWCONT structure.
Here ELEMENT will be name of the variable/internal table which container holds and VALUE will have
corresponding value. For multi line variable or internal tables, the container will hold multiple values with
same element name.
1.2.1
For example lets create a Business Object ZSWE1 with only one method READ. We will discuss the
creation of BO in very brief.
Key field will be Purchase Order number (EKKO_EBELN) for BO.
Method READ will take Purchase Order number as input and will give all the Purchase Line items in it in
an internal table.
Step 1 : Create BO ZSWE1 for test purpose. You can give it any name.
Save the method. Now we will create the parameters of the method.
Import Parameters
PurchaseDocument
EKKO-EBELN
Export Parameter
ITEM
*****
Step 1 : Save the changes and make the status of the BO to implemented for testing
purpose. Also generate the BO.
Step 2 : Now lets test the BO. For this put a break point in the method READ at the
select query. Also take any PO number which will have multiple line items. You can
check EKKO and EKPO tables. In my case I am taking PO 4200000017. In my R3
system this particular PO contains 4 line items in EKPO table. Lets put a break point
and check the method.
Now execute the last statement in the method and see the contents of CONTAINER
(just before exiting the method.
So we have seen how the CONTAINER holds values while we are working with
Business Objects at runtime.
1.2.2
Some common macros defined in include <CNTN01> for working with Containers
Functionality
Macro
SWC_SET_ELEMENT
SWC_GET_ELEMENT
SWC_SET_TABLE
SWC_GET_TABLE
SWC_CLEAR_CONTAINE
R
Further you can check the include <CNTN01> for more macros. Also check the
macros. These macros call some specific function modules that you can use directly
in your code.
1.3
*&---------------------------------------------------------------------*
*& Report ZSWET_BO1
*&
*&---------------------------------------------------------------------*
*& To get attributes of BO instance in report
*&
*&---------------------------------------------------------------------*
REPORT zswet_bo1.
PARAMETERS: p_busobj(10) TYPE c DEFAULT 'BUS1001006',
p_key(70) TYPE c DEFAULT 'ZSHUKSWE20' ,
p_attr(32) TYPE c DEFAULT 'MATERIALTYPE',
p_access TYPE c DEFAULT 'G'. "To call method put 'C'
DATA:
i_objtype TYPE swo_objtyp,
i_objkey TYPE swo_typeid,
i_element TYPE swo_verb.
DATA object TYPE swo_objhnd.
DATA verb TYPE swo_verb.
DATA return TYPE swotreturn.
DATA lt_container TYPE STANDARD TABLE OF swcont.
DATA line TYPE swcont.
i_objtype = p_busobj.
i_element = p_attr.
i_objkey = p_key.
* Instantiate the business object. i.e give it a key and create it.
CALL FUNCTION 'SWO_CREATE'
EXPORTING
objtype = i_objtype
objkey = i_objkey
IMPORTING
object = object.
* Return attribute.
CALL FUNCTION 'SWO_INVOKE'
EXPORTING
access
= p_access
object
= object
verb
= i_element
IMPORTING
return
= return
verb
= verb
TABLES
container = lt_container.
* The attribute value is in the container returned from FM.
IF return-code = 0.
LOOP AT lt_container INTO line.
WRITE: / 'Attribute MATERIAL TYPE is : ',
line-value.
ENDLOOP.
ENDIF.
return
= return
verb
= verb
TABLES
container = lt_container.
The Output will be:-
Lets see an example below on How to Call the methods using the macros defined in include <CNTN01>.
*&----------------------------------------------------------------*
*& Report ZSWET_BO1
*&
*&----------------------------------------------------------------*
*& Using macros defined in CNTN01 include. To call method of BO
*& For reference check FM DNO_DB_APPENDIX_INSERT
*&----------------------------------------------------------------*
REPORT zswet_bo1.
INCLUDE <cntn01>.
* Get an attribute of a business object.
PARAMETERS: p_busobj(10) TYPE c DEFAULT 'BUS1001006',
p_key(70) TYPE c DEFAULT 'ZSHUKSWE20',
p_attr(32) TYPE c DEFAULT 'DISPLAY',
p_access TYPE c DEFAULT 'C'. "To call method put 'C'
DATA:
i_objtype TYPE swo_objtyp,
i_objkey TYPE swo_typeid,
i_element TYPE swo_verb.
1.4
To trigger an Event of BO
We can use the FM SWE_EVENT_CREATE to raise an event in any report program. An explicit commit
work is required after the FM call to trigger the event, other wise event will not be raised.
*&---------------------------------------------------------------*
*& Report ZSWET_BO1
*&
*&---------------------------------------------------------------*
REPORT zswet_bo1.
INCLUDE <cntn01>.
* Get an attribute of a business object.
PARAMETERS: p_busobj(10) TYPE c DEFAULT 'BUS1001006',
p_key(70) TYPE c DEFAULT 'ZSHUKSWE20'.
DATA:
i_objtype TYPE swo_objtyp,
i_objkey TYPE swo_typeid.
i_objtype = p_busobj.
i_objkey = p_key.
*Define container
swc_container container.
*To clear a continer
swc_clear_container container.
*You can populate the Container if required
*To generate event
CALL FUNCTION 'SWE_EVENT_CREATE'
EXPORTING
objtype
= i_objtype
objkey
= i_objkey
event
= 'CREATED'
TABLES
event_container
= container
EXCEPTIONS
objtype_not_found = 1
OTHERS
= 2.
IF sy-subrc <> 0.
" MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
"
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4
"
RAISING OBJTYPE_NOT_FOUND.
ENDIF.
COMMIT WORK.
Just triggering an event does not makes any sense until and unless a proper event receiver id is linked to
the event. This event receiver can be a FM or can be any workflow. Event linkage can be done in SWE2
or SWETYPV transactions.
2. Define a container element of Business Object type which you want to instantiate in a workflow.
We will define a container element of type business object BUS1001006.
3. Now Create an Activity type step and use Business Object SYSTEM and method
GENERICINSTANTIATE. This task will be background task since we dont want any interaction
with users.
In binding of the task with method pass variables objectkey and objecttype. These will be created
automatically in Task container. The method will return runtime object in export parameter
OBJECTINSTANCE.
Now create binding between TASK and workflow. Now here you can pass hard coded values for
OBJECTKEY
Material
Number
and
OBJECTTYPE
BUS1001006
Save it and finally we have added a step which instantiates a business object. Lets use this instance to
display the material ZSHUKSWE20. This step will return runtime object of type BUS1001006 and key =
ZSHUKSWE20.
Click here to continue...
This task will just call method DISPLAY of BO instantiated. The method takes some parameters as
input but for our current scenario even if we dont pass import parameter (non-mandatory) it will not
be a problem. We are just checking runtime existence of Business Object. So we dont have to worry
about the binding between method and task. But in real scenario do create proper bindings to avoid
any error.
Also do not forget to make the task General task so that any one can execute. Also assign Workflow
Initiator as agent so that you can test in workflow builder. In real scenarios take care of agent
assignment.
Now after we have created the task. Go back and then create binding between task and workflow. We
just need to pass our Container element MATERIAL to the task so that the task executes the method
DISPLAY with the key ZSHUKSWE20 and displays the material.
If we execute the workflow we can check the BO getting instantiated and material getting
displayed.
Directly execute the workflow and check. Go to Business workplace and check. You can see the
work item
So we can see the material ZSHUKSWE20 getting displayed which proves that the BO BUS1001006
was instantiated in workflow.
This way we have seen how to instantiate a Business Object in our workflows. The same we can replicate
elsewhere and can .
We can also put field restrictions to put conditions on triggering of the event.
Now when the event is triggered, to carry out the further processing we assign a receiver function module
to the event in transaction SWETYPV.
SWETYPV:
The receiver function module must have the interface as this fm SWW_WI_CREATE_VIA_EVENT.
Now we can perform the required action inside the receiver function.
Scenario:
Consider the following scenario where we can use the concept of triggering events based on changes
made to business objects.
Business Requirement:
To trigger a mail to be sent to the Sales Order creator whenever any changes are done to the schedule
lines and the indicator Fixed date and Qty is checked.
Technical Solution:
The change document for sales order related changes is VERKBELEG, and the business object is
BUS2032.
So we create an event SCH_CHANGED and assign it the change document VERKBELEG in
transactionSWEC.
Now assign a receiver fm to the bus/event - BUS2032/SCH_CHANGED in transaction SWETYPV.
Inside this function module we write the code to trigger the mail.
Select the Category and choose Assigned Message Templates and choose One Message per Notification
in Granularity and save as shown below.
Double click on Delivery Schedule in Dialog structure and create New Entries as shown below.
Double click on Subscription Basic Data and create New Entries for as shown below. Mention the delivery
schedule which created previously.
Double click on Filter Basic Data and create New Entries for Workflow Scenario as shown below.
Double click on Schedule Selection and give the filter value and choose in which are all days it should
schedule to send the notification and on what interval.
The below screenshots are as per standard settings and no need to do anything on that.
In SE38 tcode create a variant for program SWN_SELSEN and enable the check-box option No Time
Check During Send and save the variant.
Schedule this program in background job in SM36 with variant for every 15 minutes or what interval
needed.
Before testing, check whether the services provided in below link are active in SICF.
Introduction of events
About receiver FM
INTRODUCTION OF EVENTS:
Irrespective of whether you use uppercase and lowercase in the event name, the name is always
entered in uppercase letters in the event receiver linkage table by the system.
The event has now been created and is available in the Business Object Repository.
You can now use this event in the other definition tools in SAP Business Workflow.
Position the cursor on the new event and choose Edit Change release status Object
component to implement.
The object type must first be generated so that it can be instantiated and tested.
If we have a requirement like insertion of an entry in a table when material is changed in a sales
order or we want some functionality to happen when a purchase order or sales order is created,
generally in such cases we look for BADIs and exist, these are called after the save events are
triggered and we place our logic there.
But we can also have a separate approach in which we link the event to a function module through
Transaction SWETYPV and the logic are written in the FM to satisfy the requirement.
Now if we want to Debug that code, just by putting the break point there, we cannot reach their
directly
So for this purpose below mentioned method should be followed, this procedure is very useful and can
be utilized wherever we want to debug the events.
First go to transaction SWETYPV then new entries.
Here on changed event we have written our logic in (This function module is created by copying
standard receiver FM SWW_WI_CREATE_VIA_EVENT) and put the break-point there and this
ZRECEIVERFM is linked with the event by using transaction SWETYPV.
Here object type Bus2032 is taken which is for sales order, as here we are taking the case where
In a sales order while changing the quantity, the change event is triggered and then we are
linking this event to ZRECEIVERFM where we put our logic.
It will come to the following screen there go in setting --> update debugging.
Note: Before switching on the debugger check that the default debugger should be classic debugger
(check in SE38-->utilities-->debugging-->ABAP debugger)
Now press execute, then it will come to following screen, there go in setting --> Breakpoint at --> Method.
A pop-up will appear, in that give the class name as CL_SWF_EVT_STRATEGY_BOR_FB and
in Method giveprocess.
Now from here press F5, then after coming to CASE me->process_mode, here change the mode
manually as D (for debugging) as shown below.
Then execute, then we come to the our own created ZRECEIVERFM, where break point is set and
Logic is written.
APPEND it_message.
CLEAR it_message.
it_message = '<BR>'.
APPEND it_message.
CLEAR it_message.
IF appr_flag = 'A'.
CONCATENATE 'Your travel request' tripno 'has been approved.' '<BR><BR>'
INTO it_message SEPARATED BY space.
APPEND it_message.
CLEAR it_message.
ELSEIF appr_flag = 'R'.
CONCATENATE 'Your travel request' tripno 'has been denied.' '<BR><BR>'
INTO it_message SEPARATED BY space.
APPEND it_message.
CLEAR it_message.
ELSEIF appr_flag = 'S'.
CONCATENATE 'Your travel request' tripno 'has been returned to you for
corrections.' '<BR><BR>'
INTO it_message SEPARATED BY space.
APPEND it_message.
CLEAR it_message.
ENDIF.
it_message = 'If you have any questions regarding this action, please
contact your supervisor.'.
APPEND it_message.
CLEAR it_message.
CALL FUNCTION 'SO_NEW_DOCUMENT_SEND_API1'
EXPORTING
document_data = w_doc_data
document_type = 'HTM'
" To get the notification in HTML format
commit_work
= 'X'
TABLES
object_content = it_message
receivers
= t_receivers.
Import Parameters in function module ZSEND_NOTIF_MAIL_EMP:
Step2:
Method to send Notification.
BEGIN_METHOD ZSENDNOTIFMAILEMP CHANGING CONTAINER.
DATA: TRIPNO TYPE BAPITRIP-TRIPNO,
EMPEMAIL TYPE ADR6-SMTP_ADDR,
EMPNAME TYPE PA0002-CNAME,
APPRFLAG TYPE SYST-INPUT.
SWC_GET_ELEMENT CONTAINER 'EmpEmail' EMPEMAIL.
SWC_GET_ELEMENT CONTAINER 'EmpName' EMPNAME.
SWC_GET_ELEMENT CONTAINER 'ApprFlag' APPRFLAG.
tripno = object-key-tripnumber.
CALL FUNCTION 'ZSEND_NOTIF_MAIL_EMP'
EXPORTING
TRIPNO = TRIPNO
EMP_EMAIL = EMPEMAIL
EMP_NAME = EMPNAME
APPR_FLAG = APPRFLAG.
END_METHOD.
Click here to continue...
to
call
our
Method
in
Workflow.
Step4:
Workflow definition
Step5:
Event
Activation
(Event
Linkage)
Output:
Whenever a trip is created in ESS or in transaction code TRIP, you will get a notification mail in your inbox
as shown below.
You will get all the parameters related to the system. If it is not set click on the change button and
generate automatically will give you all the parameters maintained at the database level for the system.
After doing that click on the Generate URL button and then Test URL to make sure it is working fine.
2. Run Tcode: WF_CPL
Click on New Entries:
Pr
ovide following details into the transaction:
Task Workflow Task number to be linked with WEB DYNPRO / BSP PAGES
Directory SAP Workplace/Portal Content Directory
Logical System Logical system name of your system
SAP Release SAP Release of your system
User Name User Name
Service ID Unique Service ID to identify the WEB DYNPRO / BSP Application
3. Run Tcode: WF_EXTSRV
Click on the New Entries:
After adding all the details select the line and select parameters to add import/export parameters details.
Save the configuration and test your scenario.
Summary:
After this configuration is successfully completed, Web forms (WD & BSP) can be opened by opening the
work items. Also if the task is configured with UWL it can directly be opened from the UWL.
into
the
details
tab Ad
Hoc
Specification
We do not have any option for validation, means suppose we are deleting some data from
PO Item table but during back up it will not check in PO header table on that case there will
be entry in EKKO table but no entry in EKPO table. System will not be consistent.
2.
After back we do not have any link with the back up data, if we want to read some of the data
we do not have any option to read data based on Key field say PO Number.
3.
After deleting for some reason if back up fails we do not have option to restore it.
All the above mention points and some other points also removed in Data Archiving process. Now Data
Archiving process is a safe and reliable way to keep your system fast with recent data and up to date with
old data stored in third system.
Now the question is why we need data archiving. In every org. with increasing number of transaction the
size of database increases which leads the system to perform very slow, and expanses of unnecessary
memory ( if we want to increase the performance). We just cannot delete the old data because various
times we need those data, some time in Reporting purpose and sometime during Auditing purpose.
Concept of Data Archiving
Data archiving insure us that after archiving system will not be inconsistent. The concept is same which is
concept of SAP Business Objects (Transaction Code: SWO1). Every Business Objects consist of various
Attributes, Key Fields, Interface and Methods. The concept of business objects is same which the concept
of OPPS Programming is. Lets take an example of Business Object PO (BUS2012), the key field would
be PO Number, Attribute will be Vendor, PO Org etc, the method would be Creation of PO, Deletion of PO
etc. With the help of method we can change the attribute of object means we can change the PO, we can
delete the PO etc.
Now go on a little bit details, If we think about attributes than where these attributes are stored, they are
stored in various transparent tables in SAP with some relations. We cannot store all the attributes of an
object in a single table, concept of Normalization in Data Base. So we have various tables where we are
storing the data and making the validation based on Check Table, Value Table Etc. So for PO we have
various tables say EKKO for PO Header, EKPO for PO Item, EKBE, MARA, MARC, EBAN..and there
is some link among all these tables so the valid records in all the tables can create a business object
( Close to BAPI).
Now We just cannot delete the records of only EKKO because some relation still exist in EKPO, EKBE
Etc Tables. So if we want to delete a record we need to delete all the related entries from all the
dependent tables, and this is the concept of Data Archiving in SAP . In data archiving data cannot be
deleted from the system unless it is successfully copied into third system.
The data archiving process in the SAP system can be divided into the following steps:
1. Data is written to the archive
The data to be archived is read from the database and written sequentially to newly created archive files.
2. Data is deleted from the database
The delete program deletes the data from the database after it has been completely written to the archive
files. To ensure the integrity of the archived data, the delete session is not started until the created archive
files have been read and confirmed.
3. Archive files are stored
The archive files that were created during the write phase can be moved to storage systems or to tertiary
storage media. The storage phase is not part of the actual
Completed
Execution of the work item is no longer useful or required for the workflow logic.
Objective: To Archive Work items which are created between 12.06.2011 and 12.07.2011 and deleting
them from the database.
Steps
1. Customizing Archiving Objects: Transaction ABOJ
We have two options; either we have SAP Standard object / Custom Objects. For both the objects we
have transaction code AOBJ. Object is get the SAP Object which we need to Archive.
Archiving Object: WORKITEM
Double Click it for details. Here you will be able to see or modify write and deletion program names, which
are used for archiving.
The WRITE program is the name of the program which will be used for writing data in to Archive file.
Remember this program will change from object to object. Same for delete and reload programs.
As soon as you put the object name there you will get the changed screen. The other attribute it will
collect from AOBJ transaction. For Example if we delete the name of the deleting program from AOBJ
than Delete option will be removed from here also and if you put some new program name there it will
appear here also.
The next screen would be
Before going ahead lets check what are the dependent tables for the object. Click on DATABASE
TABLES. Your screen will be
If you see at the bottom than you will see the name of the tables from which data will be deleted after
archiving.
Now if we want to check what are the tables and these tables are involved in which click on radio button
Object for Tables and put the table name say JEST, on the bottom window you will get the number of
object in which this table is used. Select it and press Show Tables Button you will get the name of the
tables involve in this object.
Create & Maintain variant ZTEST and put suitable conditions as per requirement of archiving strategy.
Execute the session, which will create new archiving job. Logs can be seen through Jobs Button.
As per our configuration Deletion job was also automatically triggered after completion of the writing
action. This also can be seen through Job details.
Now data has been archived into application layer and data is removed from the database layer. Thus
improving significant performance of the system and also marks completion of archiving process for Work
items of the workflow.
Now the subtype will be created. Now to create a new method in subtype 'ZQMSM', click on METHODS
and then click on create button:
It will ask you if you want to create method with the help of some existing function module or not. Here,
we will create it with the help of function module 'ZFI_GET_MANAGER'. So click on YES tab:
Specify the function module name and you will get the following screen:
Click on right arrow button until you get the following screen :
Click on method just created and follow the below menu path to release the same:
Also, you need to implement and release the object type as a whole. To do the same, select object type
and follow the below menu path:
Now to delegate the subtype to supertype, go to initial screen of SWO1 and follow the below path:
Go into change mode and select NEW ENTRIES tab to create a new entry :
Next the pop up appears where we need to mention the detail as follows:
two
The ZCL_TEST class now contains the existing methods of IF_WORKFLOW interface.
tab and
sub-interfaces
Also, 2 new interfaces will be automatically added once you add IF_WORKFLOW interface in the class as
shown below:
Each method of the IF_WORKFLOW Interface has its distinct functionality, which is discussed below.
BI_PERSISTENT~FIND_BY_LPOR Method:
BI_PERSISTENT~REFRESH Method:
If we do not need the method in our class, then we need only to carry out a dummy implementation
(without further coding) to avoid program errors when the system calls the method.
BI_OBJECT~DEFAULT_ATTRIBUTE_VALUE Method:
BI_OBJECT~EXECUTE_DEFAULT_METHOD Method:
BI_OBJECT~RELEASE Method:
Now, the attributes need to be developed to implement above methods are as follows:
To trigger the workflow using event of class, we must also create an event of the class. To do this, go to
EVENTS tab, and there create a new event CREATED as shown below :
Before implementing above methods, a local type needs to be created. To do this, click on LOCAL TYPES
as shown below:
Now click on START EVENTS tab and specify the following standard event of the standard class :
Now go back and right click in between the WORKFLOW STARTED and WORKFLOW COMPLETED.
Select ACTIVITY from this list. The following screen will appear:
Click on the green button for binding above and confirm the bindings must be as follows :
Select ACTIVITY from this list. The following screen will appear:
Click on the green button for binding above and confirm the bindings must be as follows :
Select ACTIVITY from this list. The following screen will appear:
Click on the green button for binding above and confirm the bindings must be as follows :
Select ACTIVITY from this list. The following screen will appear:
Click on the green button for binding above and confirm the bindings must be as follows :
Select ACTIVITY from this list. The following screen will appear:
Click on the green button for binding above and confirm the bindings must be as follows :
Select ACTIVITY from this list. The following screen will appear:
Click on the green button for binding above and confirm the bindings must be as follows :
Select ACTIVITY from this list. The following screen will appear:
Click on the green button for binding above and confirm the bindings must be as follows :
Select ACTIVITY from this list. The following screen will appear:
Click on the green button for binding above and confirm the bindings must be as follows :
Select ACTIVITY from this list. The following screen will appear:
Click on the green button for binding above and confirm the bindings must be as follows :
Select ACTIVITY from this list. The following screen will appear:
Click on the green button for binding above and confirm the bindings must be as follows :
Select ACTIVITY from this list. The following screen will appear:
Click on the green button for binding above and confirm the bindings must be as follows :
Select ACTIVITY from this list. The following screen will appear:
Click on the green button for binding above and confirm the bindings must be as follows :
Select ACTIVITY from this list. The following screen will appear:
Click on the green button for binding above and confirm the bindings must be as follows :
Select ACTIVITY from this list. The following screen will appear:
Click on the green button for binding above and confirm the bindings must be as follows :
Select ACTIVITY from this list. The following screen will appear:
Click on the green button for binding above and confirm the bindings must be as follows :
Select ACTIVITY from this list. The following screen will appear:
Click on the green button for binding above and confirm the bindings must be as follows :
Select ACTIVITY from this list. The following screen will appear:
Click on the green button for binding above and confirm the bindings must be as follows :
Technical Specification
For adding attachments in the user decision steps method EVENT_RAISED of interface
IF_SWF_IFS_WORKITEM_EXIT needs to be implemented and it is used as a Function Exit in the user
decision step.
In this method code for inserting attachments needs to be implemented (Please use below code for the
same)
First check whether workflow container already have any attachments or not to avoid any duplications.
* Fetch
the
workflow
work
CALL METHOD IM_WORKITEM_CONTEXT->GET_WORKITEM_ID
RECEIVING
RE_WORKITEM = LV_ID.
* Fetch
CALL METHOD IM_WORKITEM_CONTEXT->GET_WI_CONTAINER
RECEIVING
RE_CONTAINER = LV_CONTAINER.
* Read attachment to confirm that there is no duplication
item
Id
Container
CLEAR LV_OBJ_RECORD.
CALL METHOD LV_CONTAINER->GET
EXPORTING
NAME = '_ATTACH_OBJECTS'
IMPORTING
VALUE = LV_ATTACH.
IF LV_ATTACH IS INITIAL.
If there
are
no
prior
attachments
then
identify
the
folder
id
based
on
sy-user
spool
number
in LV_SPOOL
field
LV_SPOOL
First
SOFM
(PDF_XSTRING).
attachment
= 'Attachment 1'.
= SY-LANGU.
= WA_DOCUMENT_INFO-DOC_ID.
object
prepare
send
= LV_SOFM.
Program exit would get triggered whenever user step is executed by the user.
Binding of user decision step:
Execution:
Once workflow is created you can associate with any event or you can directly execute it to check the
result.
After reviewing the document user can take the necessary decision.
3) Now the below screen appears and, fill the screen as shown below and click on Transfer and to
graphic (
).
4) Now a pop up appears and give the abbreviation and name of the task as below,
6) Save and activate the workflow, now a workflow no. will be assigned to your workflow as shown
below,
7) Now again create a new workflow, repeating the steps (1 & 2) and fill the Send Mail step as below,
9) Your 2nd workflow (Main Workflow) would now appear as below and create an additional step
Activity to trigger the sub workflow.
).
12) Save and activate and a Workflow no. will be generated as shown below,
13) Now you can test run the workflow, by clicking on the test (
). Now your main workflow and the subworkflow nested in it is also executed.
15) Go to your Business workplace (SBWP) and check the inbox. You will find two mails with the titles
Mail in Main Workflow triggered from main WF and Mail in Sub Workflow triggered from Sub WF.
1)
Constructor:
GET_RESULT:
Create:
EXPORTING
i_id
= i_id.
endmethod.
In BI_PERSISTENT~FIND_BY_LPOR interface method write the below code
method BI_PERSISTENT~FIND_BY_LPOR.
CREATE OBJECT result
TYPE
zcl_test_workflow
EXPORTING
i_id
= lpor-instid(10).
endmethod.
In the BI_PERSISTENT~LPOR method write the below code
method BI_PERSISTENT~LPOR.
result = me->M_Lpor.
endmethod.
Click here to continue...
Create one more task and enter the get_result method in the task like below
Create a custom business object that will read the GOS Attachment. This method will be called as
the default method in the BOR.
Create a custom workflow for demo. In this workflow we will use the main SAP Business Object for
TRIP; BUS2089 (Employee Trip).
We will instantiate the custom BOR in the workflow and attach it to the _ADHOC_OBJECT element
to create the dynamic GOS attachment link.
We can test in Business Workplace (SBWP) or the UWL in Portal if you have portal in your project.
(Please overlook the other methods. They are not related to this topic)
This method has no parameters
This is an instance depended method, that is the BOR must be instantiated to call this method
In
order
to
display
the
GOS
module GOS_ATTACHMENT_LIST_POPUP.
Attachments,
we
will
call
the
function
Here we will pass the importing parameter IP_MODE as D to ensure that the attachments can only be
displayed.
The approver should not be able to add or remove any attachments.
The code you will write in this method is shown below
begin_method gos_attach_display changing container.
DATA: is_object TYPE sibflporb.
is_object-typeid = 'BUS2089'.
is_object-catid = 'BO'.
is_object-instid = object-key.
* GOS Attachments
CALL FUNCTION 'GOS_ATTACHMENT_LIST_POPUP'
EXPORTING
is_object
= is_object
ip_check_arl
= 'X'
ip_check_bds
= 'X'
ip_notes
= 'X'
ip_attachments
= 'X'
ip_urls
= 'X'
ip_mode
= 'D'
* IMPORTING
* EP_SAVE_REQUEST
=
* TABLES
* IT_OBJECTS
=
.
end_method.
Please note that we are building the TRIP key here along with Business Object (BUS2089 for TRIP) and
Category ID (BO for Business Object).
This function module will read this unique key combination of the instance (TRIP and Employee Number)
with the Business Object ID and Cat ID and display the attachment list.
Now once the method is created, we will mark this method as a default method. I will explain later why we
are doing this.
In the BOR Screen, navigate to the Basic Data (CTRL+SHIFT+F1) of the BOR by clicking on the HAT
Icon as shown
Enter the Method GOS_ATTACH_DISPLAY and pass attribute as TRIP Number. This will display in the
work item as a link
We save and activate the BOR and mark the method and the BOR as Implemented and Released.
(This is a standard process to be followed when creating a custom BOR).
The above process completes our first step of creating and activating or Custom BOR that will read the
GOS attachment.
STEP 2: Create a Custom Workflow
We will create a custom workflow with simply two steps.
The first step will instantiate our custom BOR, second step will be the user decision that will be sent to the
approver.
The workflow will be modeled on the standard SAP business object BUS2089 as the main business
object.
Run PFTC and create the workflow template, name it as shown and save it
The element is created. Now navigate back to Basic Data to enter the work item text
Save the template and then click on Workflow Builder, to call the builder to design the workflow
STEP 3: Instantiate the Custom Business Object and continue the workflow creation.
Now we will create a background task / activity to instantiate our custom business object ZTRIP_NEW.
In this step we will use a standard task where we will call the method GENERICINSTANTIATE from
BOR SYSTEM as shown
The container element created for this task from method GENERICINSTANTIATE are shown below
OBJECTKEY: Points to SWOTOBJID- OBJKEY. This will contain the TRIP Keys. Has no initial value.
OBJECTTYPE: Points to SWOTOBJID- OBJTYPE. It will contain the Business Object that needs to be
instantiated.
In this case, it is ZTRIP_NEW; hence this will be the default value
OBJECTINSTANCE: This contains no reference to any BOR. This will get the instance of the BOR
specified at runtime.
In
this
case
the
BOR
passed
via OBJECTTYPE is ZTRIP_NEW.
element OBJECTINSTANCE will contain the instance of this custom BOR.
Hence
the
Now the task is created. Save it and come back to the workflow. The workflow prompts for the auto
bindings
In the workflow, mark this container OBJECTKEY as importing. While testing pass the concatenated
string of Employee Number and TRIP No.
(This is done to simplify the demo. In real time, this key can be built from the event call via event
containers)
Now create an element container to store the above instance for ZTRIP_NEW as shown.
Save this element and the workflow
Now go back to the task created and bind this element created as shown
This will pass the run time instance of our custom business object ZTRIP_NEW to the container we
created of the same name.
Now use container operation step to pass this instance to the Standard Workflow container
element _ADHOC_OBJECTS
business
object
to
this
On clicking this link, it executes the Default Method of the BOR. This is the reason why we marked
our method GOS_ATTACH_DISPLAY as default.
You can pass the instance of the standard BOR BUS2089 also to this container as shown
Note under Objects and Attachments, we see both the attachments links.
The first link for the Standard Display Method in standard BOR and second link points to our Custom
BOR for Dynamic Links.
Click the Display Attachments Link
Click on the Display Attachments link again. It should show the new attachment also
Build a custom workflow with just a send e-mail step with the e-mail field as importing. (Simplified for
demo purpose)
Test-run this demo workflow via SWUS T-Code but do not pass the e-mail ID. This will put the
workflow in ERROR status.
We will simply use SWPR T-Code first to try and restart the workflow instance. This will fail.
We will then modify the workflow runtime container and pass the e-mail ID.
We will restart the workflow via SWPR again. It will work this time.
Pre-requisites: To follow and set up this demo, following are the pre-requisites
You should know how to build a basic workflow with the send e-mail step.
The e-mail step will contain this container EMAILID as the e-mail ID variable
After building the custom workflow with the send e-mail step, it will look as shown below
Now we will check the workflow log. We can see that the workflow is in error
The Step History of the work item will tell us that the method to send mail could not execute
The container shows that there is no e-mail ID in the Address Strings field
Now we will run SWPR to attempt to restart this workflow instance. The work item ID is 2733489 for the email step.
The work item ID of the workflow (Parent ID) is 2733488. Enter that in SWPR
Now select the above row and click on Restart Workflow push button on the application tool bar
The application confirms that the restart has been carried out. Press REFERSH button to see if the restart
was a success
We can see the item is still there. Looking at the workflow log and step history, we see that the workflow
went into ERROR even after the restart
Pass this work item ID to the function module as shown. Do not pass anything to the DISPLAY parameter
Now on executing this function module, the complete container list of the work item step is shown in EDIT
Mode!!
This is the Container Instance Editor
Now select the container Recipient Name and pass a valid e-mail ID. In business scenario, you can get it
from user master (SU01) or Info Type 105 Subtype 10.
Select the container and click on APPEND ROW
Now press the ENTER key to accept the changes on the pop-up
AFTER REFRESH: Address Strings has the e-mail ID now (shows as 1 entry and appears on the
overview below)
The item has gone away, indicates a success. We will verify from the workflow log
Note that the workflow has executed the step without errors. Note also that container value change
operation is also captured in the logs.
Conclusion: Thus with this process, we were successfully able to modify and manipulate a workflow
container value from the runtime instance and also successfully restart the workflow instance exactly from
the point where it went into error.
Disclaimer: Use this function module with caution. Be very careful while changing the container values.
Only workflow administrators should do it. Please remember, you activity is logged in the workflow logs,
hence perform the activity only when the workflow is stuck in error and there is no option to restart from
the very beginning.
Create a user decision step with APPROVE and REJECT options and model the Rejection Reason
only for the REJECT Branch.
Capture the rejection reason text and pass to an e-mail sending step via a container.
You should know how to build a basic workflow with the send e-mail step and user decision step.
(SAP Technical.Com already has these tutorials)
You know how to create methods in a custom BOR and call in workflows. (These will not be covered
in details)
Create Custom Workflow and Method to read the REJECTION Reason for Demo
(Please read the tutorials on creation of Custom BOR/Method and Custom Workflow with user decisions
and e-mail sending steps in SAP Technical.Com to get the details)
We create the user decision step and mark the two branches APPROVE and REJECTED as shown
Notice that in the latest SAP version, we have an option to configure the Rejection / Approval reasons.
You can use this for any reason you want as per the branch you have created.
Mandatory: This means, that the Reason has to be mandatorily entered when the corresponding action
is performed, else the user decision work item cannot be completed.
Required: This means, that entering the Reason is optional. The pop-up to enter the reason will appear,
but it is not needed to enter anything to complete the work item.
Here we will mark this Reason as MANDATORY for our REJECT Branch as shown
it
will
get
appended
into
Parameter REASON_TXT:
We will be passing the work item ID of the workflow and this method will read the
container _ATTACH_OBJECTS and pass the Rejection Text to variable REASON_TXT.
The code that you will write in the method is given below: (You can write your own code to read and
process the SOFM Attachment Object as per your need)
begin_method read_rejection_reason changing container.
DATA: reason_txt TYPE swcont-value,
reason TYPE swc_object OCCURS 0,
object_content LIKE solisti1 OCCURS 0,
workitemid LIKE swr_struct-workitemid,
subcontainer_all_objects LIKE TABLE OF swr_cont,
lv_wa_reason LIKE LINE OF subcontainer_all_objects,
lv_no_att LIKE sy-index,
document_id LIKE sofolenti1-doc_id,
return_code LIKE sy-subrc,
The above method will be called in a standard task and called in the REJECT branch of the user decision
step.
Click here to continue..
Predecessor work item will contain the Work Item ID of the User Decision Step.
The user decision step is just the previous step to this background step in this workflow template.
The workflow will look like as shown below after adding the above step in the REJECT branch of the User
Decision
Now we will create an e-mail step after this Read Rejection Reason Text. Here we will pass our text and
send as an e-mail.
For simplicity of the demo, I will be hard-coding a dummy e-mail ID to the send e-mail step.
After this process, the complete workflow template will look as shown below
Now select REJECT to process rejection. Normally the work item would get completed here, but the
system will generate a POP-UP to prompt for the Reason.
This pop-up will appear due to our configuration. We enter the REJECTION Reason text and press OK
(Please note, if you cancel this POP-UP, the work item will still remain in your inbox and not get
completed. This is because we marked the Reason as MANDATORY)
Looking at the workflow log, we can see that the element _ATTACH_OBJECTS (Attachments) contains
the SOFM entry
Now looking at the e-mail step in the log, we will check the task description to see if our text is captured
You can see the Rejection Reason is captured. We can see this in the container also
Now running the SOST transaction to see if the same appears in the e-mail body as well
So we have successfully captured the REJECTION REASON TEXT and displayed it in the e-mail body.
You can use this functionality in multitude of other ways as per your business need in your project.
Thus the APPROVE will correspond to branch 0001 and REJECT will correspond to 0002. If the step had
other decision options, they would get numbered as 0003, 0004 and so on.
Now to process the user decision via an ABAP program without executing the work item from SBWP or
Portal UWL we need to run the following function module
SAP_WAPI_DECISION_COMPLETE
Let us see what importing data this function module needs
Here in the parameter WORKITEM_ID we will pass the work item ID of the User Decision Step.
For USER, the default is SY-UNAME. Hence if this function module is called in an ABAP Program and
that program is executed at the background, it will pass the background system user ID.
The parameter DECISION_KEY decides which branch has to be processed in the User Decision Step. As
explained before, we will pass 0001 for APPROVE and 0002 for REJECT.
This will differ from case-to-case and scenario-to-scenario.
Now fetching the work item IDs of the above two user decision work items from their workflow logs
Work Item ID is 2733503 (We will process APPROVE for this)
Running the function module with work item ID 2733503 (Process Decision Key 0001 for APPROVE)
Now will run the function module with the other work item ID 2733501 (Process Decision Key 0002 for
REJECT)
Now we will look at the workflow graphical log to verify which branch was executed. In this case it should
be REJECT (0002)
AFTER
We can thus call this function module SAP_WAPI_DECISION_COMPLETE in our ABAP Program and
design it for so many different purposes.
We can also call the ABAP Program at the background and process work items accordingly.
Conclusion: We have thus successfully processed a user decision step programmatically without
executing the work item from the business workplace.
Business Scenario: Many times when testing various workflow developments, we need to forward a
work item to our own ID for testing purposes. Sometimes it becomes difficult to maintain our own ID in the
Agent / Approver tables as they might need Customizing Transport Requests or other business
constraints. Standard T-Code SWIA does not allow forwarding the work items to your own ID. On such
situations we either need to forward the work item to some other test IDs or ask someone else to do it for
us.
Not any more, as with this technique you can even forward any work item to yourself while you
are logged in via that same SAP ID and be able to do your testing.
Process: The steps are very simple
We will take a work item and first try to forward it to the current logged in SAP ID (self ID) via T-Code
SWIA. This will not work.
We will then use a special function module to forward this work item to our own logged in SAP ID.
Looking at a work item in the workflow log
Here the following foreground work item currently does not have any agents assigned to it.
The work item ID for the user decision step is 2733499. We will now run transaction SWIA and enter this
work item ID
Now we will select this row and try to forward it to the logged in ID via which this workflow is been tested
and this transaction is being executed
SWIA gives the following prompt when I try to forward the work item to the current logged in ID via which
SWIA is being executed and workflow being tested
The transaction SWIA prompts; You cannot choose yourself as an agent and does not allow
the Administrator Forward.
Click here to continue..
Now execute the function module. We will see the function module returns the work item status as
READY with the selected new agent
To verify that the WI forward worked as expected, we look at the workflow log agents again
We can see now that the log does not say No selected agents, but is showing our own ID to which we
forwarded the work item to.
Also note the e-mail like icon, indicates that the work item came as a forward.
In technical log, the step details also confirms that the Forward was a success
Checking in business work place SBWP, to verify with certainty that the work item did get forwarded
successfully to own logged in ID
Conclusion: Thus we have successfully forwarded a dialog / foreground work item to own logged in ID
even when standard transaction SWIA did not allow the administrator forward to self.
As you can see the SBWP is pretty detailed. The user can display a lot of information related to
Documents, Workflow Work Items, Started and Processing Workflows, Resubmission Entries, and many
more. The end user rarely uses all these. They are mainly bothered to see the work items that they have
to process.
In SBWP the work items to be processed are accessed as shown beloe:
The user can thus select the desired item to process. Similar process is followed for other entries where
the user needs to navigate in the tree and locate the desired item to process.
Simplified way of seeing the Business Workplace or SAP Inbox
Now we will simplify this view. For this we will run the first T-Code called SWLD_INPLACE1
SWLD_INPLACE1 - Embedded Inbox with a View
The entry screen of the T-Code looks as shown below
(Please note you can even filter tasks whose work items you do not want to be shown. Hence you can
create variants for this program and create custom transactions.
Based on business need, those transactions can be given to the end users.)
We can change the Title to something of our need and display just the INBOX section of SBWP as of now
The report shows a very simple ALV output of just the INBOX of SBWP and nothing else.
The user can process the desired work item from here and because of a simple view; it becomes a much
easier task.
Similarly we can display the OUTBOX also.
The first transaction SWLD_INPLACE1 calls the ABAP Report RSWL_INPLACE_INBOX_DEMO and the
second transactionSWLD_INPLACE2 calls the ABAP Report RSWL_INPLACE_INBOX_DEMO_PROFI.
You can copy these programs into custom programs and modify them as needed.
The tool bar allows the user to switch between views, just display the work item without executing and
many other features.
Display Work Item
Other Functions
Thus this program empowers the user with a lot of features while keeping everything simple.
I would suggest you to do a lot of study and research on the classes used in this program that is used to
first fetch the SBWP Details and then passing it to the ALV.
You can create your own custom screens and push buttons and provide a much simple Business
Workplace to the Client / End Users.
Business simply loves this simple view of the business workplace as it makes their work simple.
The major advantages of this process are:
Custom program can be developed very easily and tweaked as per business need.
Advantageous to end users who need a simpler business workplace with lesser navigations,
buttons and menus.
Selective task filtering and feature suppression possible by creating variants and assigning them to
different users as per need.
Conclusion: We were able to regenerate the different views of SBWP (Inbox and Outbox) via a simple
transaction. These views were much simple and easy to use compared to the standard Business
Workplace (SBWP).
We will see that the class we will model later on in this tutorial will contain the methods that can be
implemented for handling the above events.
Here we will send e-mail via this Program Exit once when a work item is created and once when it
is executed.
There will be no e-mail steps modeled in the workflow. They will happen solely from the program exit.
Process to design the Program Exit in a Work Item
Let us look at the tab in a work item where this exit is designed
Note that the SAP Documentation states that the class that will be modeled here must support
theIF_SWF_IFS_WORKITEM_EXIT interface. Please ensure that inside this class we will not be using
any ABAP Instruction that can release the current LUW like COMMIT WORK, ROLLBACK WORK or
using RFC Function Calls.
Now we will design a class via the transaction SE24. We will call this class ZZCL_WORK_ITEM_EXIT.
The Properties tab of the class will look as shown. We will add the type group SWRCO
Once we declare the interface, the attributes related to this interface will appear in the Attributes Tab.
Notice the events that can happen with a work item in the Description column. This is what was
mentioned at the start of the tutorial.
We will now add a couple of custom attributes as mentioned below:
WI_CONTEXT as a type reference to IF_WAPI_WORKITEM_CONTEXT; this interface returns the
various attributes of a work item.
Displaying this interface via SE24 and showing you the methods
To
see
how
to
implement
these
refer CL_SWF_RUN_WORKITEM_CONTEXT.
methods
in
class,
please
This class is very helpful to understand how to do various operations on a work item.
The other custom attribute will be named PROCESS_STATUS. This will contain a default
valuesap.bc.bmt.wfm.process.status.
The attributes tab now looks like as shown below
The only method created by default is EVENT_RAISED. This will be called whenever the Work Item
Events (mentioned at the start of the tutorial) are triggered.
The parameters that appear in this method are
(Note
that
there
is
a
interface IF_WAPI_WORKITEM_CONTEXT)
refers
Now we will create two more methods called AFTER_WI_CREATION and AFTER_WI_EXECUTION as
shown.
*
*
*
*
--------- set sender ------------------------------------------note: this is necessary only if you want to set the sender
different from actual user (SY-UNAME). Otherwise sender is
set automatically with actual user.
sender = cl_sapuser_bcs=>create( sy-uname ).
CALL METHOD send_request->set_sender
EXPORTING
i_sender = sender.
*
*
--------- Add recipient (e-mail address) ----------------------Create recipient - passing a dummy e-mail ID here
recipient = cl_cam_address_bcs=>create_internet_address('anirban@testtest.com' ).
* ----------------------------------------------------------**
exception handling
* ----------------------------------------------------------CATCH cx_bcs INTO bcs_exception.
* Write
own
code
ENDTRY.
to
ENDMETHOD.
Write the following code in the AFTER_WI_EXECUTION method
catch
exception
(This code will send an e-mail to a dummy e-mail ID with the Work Item ID stating that it
was Executed. Will trigger after work item is executed)
METHOD after_wi_creation.
DATA: lcl_v_wi_id
TYPE sww_wiid, "Work Item ID
lv_wid_text
TYPE char12,
send_request
TYPE REF TO cl_bcs,
text
TYPE bcsy_text,
body_text
TYPE so_text255,
document
TYPE REF TO cl_document_bcs,
sender
TYPE REF TO cl_sapuser_bcs,
recipient
TYPE REF TO if_recipient_bcs,
bcs_exception
TYPE REF TO cx_bcs,
sent_to_all
TYPE os_boolean.
* For simplicity of the demo, we are only fetching the work item ID
* You can get the complete work item and workflow details as well
* Please refer class CL_SWF_RUN_WORKITEM_CONTEXT and interface IF_WAPI_WORKITEM_CON
TEXT
* Get the Work Item ID
CALL METHOD wi_context->get_workitem_id
RECEIVING
re_workitem = lcl_v_wi_id.
* Pass WID to text field
CLEAR: lv_wid_text.
lv_wid_text = lcl_v_wi_id.
*----------------------------------------------------------------------------------------*
* Send an e-mail to a dummy e-mail ID stating that the above Work Item has been created
*----------------------------------------------------------------------------------------*
TRY.
* -------- create persistent send request -----------------------send_request = cl_bcs=>create_persistent( ).
*
*
*
*
*
*
--------- set sender ------------------------------------------note: this is necessary only if you want to set the sender
different from actual user (SY-UNAME). Otherwise sender is
set automatically with actual user.
sender = cl_sapuser_bcs=>create( sy-uname ).
CALL METHOD send_request->set_sender
EXPORTING
i_sender = sender.
*
*
--------- Add recipient (e-mail address) ----------------------Create recipient - passing a dummy e-mail ID here
recipient = cl_cam_address_bcs=>create_internet_address('anirban@testtest.com' ).
* ----------------------------------------------------------**
exception handling
* ----------------------------------------------------------CATCH cx_bcs INTO bcs_exception.
* Write
own
code
ENDTRY.
to
catch
exception
ENDMETHOD.
Write the following code in the method EVENT_RAISED. In this method based on the Work Item event
triggered, our corresponding custom method will be called.
METHOD if_swf_ifs_workitem_exit~event_raised.
* Get the Work Item Context
me->wi_context = im_workitem_context.
Now we will call this class in our user decision step in the workflow at the tab Program Exits as shown
below
Now we will test the workflow via SWUS transaction. When the user decision step is created, the first email should go.
Checking in SOST transaction if the Work Item Creation E-Mail has triggered
So we have successfully sent the first e-mail to the dummy e-mail ID, which went After Work Item
Creation via the program exit.
Notice the work item ID is 412083. This is correct as per workflow logs.
Now we will execute the work item. After execution, we will see the workflow log
BEFORE EXECUTION
AFTER EXECUTION
So we have successfully sent the second e-mail to the dummy e-mail ID, which went After Work Item
Execution via the program exit.
Conclusion: Hence we have successfully modeled the Program Exit that can be used in a work item.
With the help of this exit, we can do numerous custom operations at various events, which occur during
the complete life span of a work item.
perform Extended
Use and need: These checks are similar to extended checks and code inspector checks that are
performed on any ABAP Code, Function Module or Class.
Process: SAP has provided standard transactions to execute these checks. We will discuss these
transactions in detail.
These transactions are SWU7 and SWU4.
Transaction SWU7 is used for checking Workflow Templates.
The entry screen of SWU7 looks as shown. We enter the Workflow Template ID of the workflow which we
want to check
We can see the program prompts in this case that there is one INFORMATION message: No start events
or start transactions/forms.
We can run this program with another workflow template that has more steps and see the following output
We can thus see that the program analyses each step of the workflow and displays the results.
The program also displays multiple check results at the same time. Simply enter the range of workflow
template IDs at the select option in selection screen.
We can thus correct and tune the workflow to make its performance much better.
Transaction SWU4 is used for checking Standard Tasks.
The entry screen of SWU4 looks as shown. We enter the Standard Task ID of the Task which we want to
check
We can see that the program returned the Standard Task to be completely consistent. It would have
captured and displayed any errors / warnings / information accordingly.
Advantages of these transactions:
All possible runtime errors are displayed, like loss of data in bindings, data type mismatch, etc.
Containers elements that have been declared and not used are also displayed.
Event linkage and trigger failures are detected and displayed. Hence we can analyze event issues
without executing the workflow or displaying it.
Multiple Tasks and Workflow Templates can be checked at the same time.
These transactions perform many more extended checks which you will get to know when you run them
for different workflow templates and standard tasks that you might have created in the system. These
transactions are very important to analyze with certainty that the workflows will have a stable runtime
environment.
Conclusion: We have demonstrated successfully the standard transactions provided by SAP to perform
Consistency and Extended checks on Workflow Templates and Standard Tasks.
Go to methods tab and and implement the SET_CUTOMER method with I_KUNNR as importing
parameter.
lv_class = 'ZCL_WEBDYNPRO_WF'.
lv_event = 'TRIGGER'.
* Instantiate an empty event container
CALL METHOD cl_swf_evt_event=>get_event_container
EXPORTING
im_objcateg = cl_swf_evt_event=>mc_objcateg_cl
im_objtype = lv_class
im_event = lv_event
RECEIVING
re_reference = lr_event_parameters.
* Set up the name/value pair to be added to the container
lv_param_name = 'I_KUNNR'. " parameter name of the event
lv_id
= i_kunnr.
TRY.
CALL METHOD lr_event_parameters->set
EXPORTING
name = lv_param_name
value = lv_id.
CATCH cx_swf_cnt_cont_access_denied .
CATCH cx_swf_cnt_elem_access_denied .
CATCH cx_swf_cnt_elem_not_found .
CATCH cx_swf_cnt_elem_type_conflict .
CATCH cx_swf_cnt_unit_type_conflict .
CATCH cx_swf_cnt_elem_def_invalid .
CATCH cx_swf_cnt_container .
ENDTRY.
* Raise the event passing the
TRY.
CALL METHOD cl_swf_evt_event=>raise
EXPORTING
im_objcateg
= cl_swf_evt_event=>mc_objcateg_cl
im_objtype
= lv_class
im_event
= lv_event
im_objkey
= lv_objkey
im_event_container = lr_event_parameters.
CATCH cx_swf_evt_invalid_objtype .
CATCH cx_swf_evt_invalid_event .
ENDTRY.
COMMIT WORK.
endmethod.
Go to SWDD transaction and create a new workflow called ZTEST_WF
event container
Go to header and Start events tab and enter the below details
Now if we call the SET_CUSTOMER method it will trigger the ZTEST_WF workflow.
Offline Workflow Approval in ECC R/3 without SAP Logon from E-Mail
(Outlook)
By Anirban Bhattacharjee, KPIT Cummins and Infosystems
Purpose: This document will demonstrate how you can set up a DEMO that will allow a user to
APPROVE or REJECT (Process as per requirement) a workflow work item directly from Outlook E-Mail
without logging into SAP. The approver does not need to have SAP GUI Installed in the system from
where the approval is being carried out. The approver also does not need to enter the SAP user ID and
password. These approval links are not SAP Shortcut links as generated by the RSWUWFML2 program
that is normally used for approval from outlook. These are normal MAILTO links and works on almost all
e-mail environments and internet browsers. This will also work on hand held devices like iPhone or
Blackberry if adequately configured with Exchange Server. Since the MAILTO links will work on the Web
Mail version of outlook as well, so normal browsers running on the handheld devices can also assist in
carrying out the Workflow Processing Offline.
Hence using this concept, you can now process work items, run ABAP programs, do any SAP activity
Offline remotely, without having to log into SAP.
Business Requirement: Business needs a way by which they can process workflow work items
completely offline. They want to be able to do this even when they are not in the SAP Network. The user
will not enter the SAP User ID and password, nor will they have SAP GUI in the system from where the
approval is being carried out. They should be able to directly process from Outlook which should work
across different browsers and handheld devices that run internet browsers.
How the DEMO Will Work, its features and ADVANTAGES
The various working steps, features and advantages of this demo are mentioned below
The workflow template consisting of a single user decision step with a work item exit will generate a
HTML Notification E-Mail to the Approver who also has received the User Decision Work Item for
processing.
This HTML E-Mail will demonstrate the data in Tabular Format and provide two links to the approver;
APPROVE and REJECT.
These links are typical MAILTO links. On clicking either of these links, the system will generate an auto email to send to the SAP System.
This e-mail will have the TO field auto-populated with the Offline System SAP ID and the Subject also
auto-populated with the action (A or R, for APPROVE or REJECT) and the Work Item ID of the User
Decision step that was sent to the approver.
The Inbound Exit Class will read this e-mail subject and process the work item.
User will not have to enter the SAP User ID or Password to send this auto email.
The user thus does not need to log on to the SAP System.
The user need not be in the SAP Network or VPN to send this email.
The user does not need to have SAP GUI present, since these links are not SAP Short Cut Links that
need SAP GUI.
Any application that can process MAILTO links can send these auto e-mails. Hence this works even in
handheld devices like iPhone, Blackberry, etc.
This works in various Internet Browsers. I have tested this in various versions of Microsoft Internet
Explorer, Google Chrome, etc.
Works on both Web Mail version of Microsoft Outlook and Normal Outlook
Using this concept you can run any SAP Transaction, schedule batch jobs, get report summary and
output in your e-mail from a remote system without logging into the SAP Network.
Inbound E-Mail Receiving configurations in SAP
We need to first create a user ID in Outlook along with a sub-domain that will point to the desired SAP
System. So for example if your company domain is www.yourdomain.com then the sub-domain would
be something like ecc-dev.yourdomain.com (This will be created by your Network and Infrastructure
People). You should be able to ping this domain.
Now let us name the Offline System User as ECCOFFLINE and then after a user is created in Microsoft
Outlook with above sub-domain, the e-mail ID will be eccoffline@ecc-dev.yourdomain.com. Please
note that this is a very critical step in this development and hence needs to be configured correctly. This
e-mail ID and sub-domain choice is completely your own. You can plan your own ID as per your choice.
This is the only configuration outside SAP on the Network / Exchange Server Side.
Create Offline User in SAP (SU01)
To receive e-mail in SAP, you need to first create a System User ID that will receive these e-mails. This
will be a system user with SYSTEM as the User Group. The user ID created is named ECCOFFLINE.
The Logon Data tab is shown below
This user must have three mandatory Profiles: S_A.SCON, SAP_ALL and SAP_NEW as shown below
The e-mail ID created in the first step, is also entered here in the Address tab as shown
(eccoffline@ecc-dev.yourdomain.com)
Select the SAP-Connect Node and click the DISPLAY-CHANGE button as shown
In the LOGON Data Tab, mention the ECCOFFLINE user and set the password
Offline Workflow Approval in ECC R/3 without SAP Logon from E-Mail
(Outlook)
...Previous
Configure and activate the SMTP Service via SMICM transaction
Run transaction SMICM or Report RSMONICM_STANDARD
This displays the Services as shown. Mention the SMTP port (normally 25, your Basis consultant will
provide you the port number, this is similar to the port settings done in SCOT transaction for SAP Connect
Outbound E-Mail Configuration) and activate the service. The GREEN check will indicate the service is
active. The Host Name will also be provided by your Basis / Security Consultant. This Host is also similar
to the host maintained in SCOT for the SMTP node
Activate and change the service via the menu as shown below
We have to write an Inbound Exit Class that will process the Inbound E-Mails. That class should be
mentioned here. (We will see later how to create this class)
The CREATE_INSTANCE method is called by standard SAP (via SO50 Configuration) to create a unique
instance for each inbound e-mail. The code is written below
METHOD if_inbound_exit_bcs~create_instance.
DATA: ref TYPE REF TO zzzcl_process_inbound_workflow.
* Check if the Instance is initial
IF ref IS INITIAL.
CREATE OBJECT ref.
ENDIF.
* Return the Instance
ro_ref = ref.
ENDMETHOD.
The interface of the method CREATE_INSTANCE is shown
The PROCESS_INBOUND method is the place where we write the exit logic. This is where we will
process the desired work item of the workflow and process it based on the e-mail action / reply created by
the automated e-mail. The interface of method PROCESS_INBOUND is shown
ENDTRY.
*--------------------------------------------------------------------*
* YAAAAAHHHHHHOOOO at this point I have the Subject and the Body
*--------------------------------------------------------------------*
* Now read the subject and process the work item
* Condense the subject to remove blank spaces
CONDENSE l_mail_attr-subject.
* Read the action
lv_action = l_mail_attr-subject+0(1).
* Read the work item ID
lv_wid
= l_mail_attr-subject+1(12).
* Pass to variables
lv_wid_num = lv_wid.
lv_wid_func = lv_wid_num.
* First check the status of the work item, process only if READY or IN-PROCESS
SELECT SINGLE *
FROM swwwihead
INTO ls_swwwihead
WHERE wi_id = lv_wid_num.
* If data not found, indicates an invalid e-mail sent to offline ID
IF sy-subrc NE 0.
lv_wid = 'INVALID WID'.
ENDIF.
* Check the status, if COMPLETED, send the notification
IF ls_swwwihead-wi_stat = 'COMPLETED'.
TRY.
*
-------- create persistent send request -----------------------send_request = cl_bcs=>create_persistent( ).
*
-------- create and set document ------------------------------*
Build the e-mail Body
CLEAR: body_text.
CONCATENATE 'WORK ITEM ID : '
lv_wid
'is in status "COMPLETED"' INTO body_text SEPARATED BY
space.
APPEND body_text TO ltext.
CLEAR: body_text.
CONCATENATE 'This has already been processed '
'and cannot be processed again.' INTO body_text
SEPARATED BY space.
APPEND body_text TO ltext.
document = cl_document_bcs=>create_document(
i_type
= 'RAW'
i_text
= ltext
i_length = '510'
i_subject = 'Work Item has already been
processed' ).
*
Add document to send request
CALL METHOD send_request->set_document( document ).
*
--------- set sender ------------------------------------------*
note: this is necessary only if you want to set the sender
*
different from actual user (SY-UNAME). Otherwise sender is
*
set automatically with actual user.
sender = cl_sapuser_bcs=>create( 'ECCOFFLINE' ).
CALL METHOD send_request->set_sender
EXPORTING
i_sender = sender.
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
--------- Add recipient (e-mail address) ----------------------Create recipient - passing the receipient e-mail ID
recipient = cl_cam_address_bcs=>create_internet_address( lv_email ).
Add recipient with its respective attributes to send request
CALL METHOD send_request->add_recipient
EXPORTING
i_recipient = recipient
i_express
= 'X'.
---------- Send document --------------------------------------CALL METHOD send_request->send(
EXPORTING
i_with_error_screen = 'X'
RECEIVING
result
= sent_to_all ).
COMMIT WORK.
CATCH cx_bcs INTO bcs_exception.
ENDTRY.
ELSEIF ls_swwwihead-wi_stat = 'READY' OR
ls_swwwihead-wi_stat = 'STARTED'.
First process the Work Item Based on the action
IF lv_action = 'A'.
Set the ACTION Text
lv_action_text = 'APPROVED'.
If APPROVED
CALL FUNCTION 'SAP_WAPI_DECISION_COMPLETE'
EXPORTING
workitem_id
= lv_wid_func
language
= sy-langu
user
= sy-uname
decision_key
= '0001' "Approval Node
do_commit
= 'X'
IMPORTING
new_status
= lv_new_status
TABLES
MESSAGE_LINES
=
MESSAGE_STRUCT
=
.
ELSEIF lv_action = 'R'.
Set the ACTION Text
lv_action_text = 'REJECTED'.
If REJECTED
CALL FUNCTION 'SAP_WAPI_DECISION_COMPLETE'
EXPORTING
workitem_id
= lv_wid_func
language
= sy-langu
user
= sy-uname
decision_key
= '0002' "Rejection Node
do_commit
= 'X'
IMPORTING
new_status
= lv_new_status
TABLES
MESSAGE_LINES
=
MESSAGE_STRUCT
=
.
ENDIF.
After the action now send the e-mail
TRY.
Offline Workflow Approval in ECC R/3 without SAP Logon from E-Mail
(Outlook)
...Previous
Creation of the workflow template
I will not discuss in details on this step. The SAP Technical site has a huge number of tutorials that will
show you how to do this. For our demo, we are creating a very simple workflow template with a single
User Decision Step. The template is shown (Notice there is no SEND MAIL step. E-Mail is sent via the
Work Item exit)
The work item exit is mentioned in the user decision step as shown
To know how to create a work item exit, please follow this LINK in SAP Technical to learn and follow the
steps in the tutorial.
(If
that
does
not
open
copy
and
paste
browserhttp://saptechnical.com/Tutorials/Workflow/Exit/Index.htm)
this
link
in
your
In the exit, we write our e-mail logic in the method AFTER_WI_CREATION. This method is triggered the
moment the User Decision Work Item is created and sent to the approver. Our e-mail is also created and
sent almost at the same instant. The code in this method is shown. The system e-mail ID will depend on
the ID created by your infrastructure team.
(Note: I have shown two different ways to send the e-mail; one via the BCS Class and the other the
SOFM Function Module. Please select whichever way you prefer. Remember to comment out one of the
ways, else you will get two e-mails on Work Item Creation )
Code for method AFTER_WI_CREATION
METHOD after_wi_creation.
DATA: lcl_v_wi_id
TYPE sww_wiid, "Work Item ID
lv_wid_read
TYPE sww_wiid, "Work Item ID to read container
data
lv_wid_text
TYPE char12,
l_it_father_wis
TYPE STANDARD TABLE OF swwwihead,
l_wa_father_wis
TYPE swwwihead,
send_request
TYPE REF TO cl_bcs,
text
TYPE bcsy_text,
body_text
TYPE so_text255,
document
TYPE REF TO cl_document_bcs,
sender
TYPE REF TO cl_sapuser_bcs,
recipient
TYPE REF TO if_recipient_bcs,
bcs_exception
TYPE REF TO cx_bcs,
sent_to_all
TYPE os_boolean.
* Declare the Work Item Container data
DATA: l_it_wi_container TYPE STANDARD TABLE OF swcont,
l_wa_wi_container TYPE swcont,
l_wa_wi_header
TYPE swwwihead.
* Declaration for the Dynamic Values in text
DATA: lv_belnr
TYPE belnr_d,
lv_bukrs
TYPE bukrs,
lv_gjahr
TYPE char04,
lv_email
TYPE comm_id_long,
lv_lines
TYPE i,
lv_so_obj_len
TYPE so_obj_len.
* Other e-mail technique to do the declarations
DATA : it_message
TYPE STANDARD TABLE OF solisti1,
wa_message
TYPE solisti1,
it_attach
TYPE STANDARD TABLE OF solisti1,
wa_attach
TYPE solisti1,
t_receivers
TYPE STANDARD TABLE OF somlreci1,
wa_receivers
TYPE somlreci1,
w_doc_data
TYPE sodocchgi1.
* For simplicity of the demo, we are only fetching the work item ID
* You can get the complete work item and workflow details as well
*
Please
refer
class
CL_SWF_RUN_WORKITEM_CONTEXT
and
interface
IF_WAPI_WORKITEM_CONTEXT
* Get the Work Item ID
CALL METHOD wi_context->get_workitem_id
RECEIVING
re_workitem = lcl_v_wi_id.
* Pass WID to text field to concatenate to the e-mail body for MAILTO link
CLEAR: lv_wid_text.
lv_wid_text = lcl_v_wi_id.
* Fetch the parent work item ID
REFRESH: l_it_father_wis[].
CALL FUNCTION 'SWW_WI_FIND_FATHER_WIS'
EXPORTING
wi_id
= lcl_v_wi_id
TABLES
father_wis = l_it_father_wis.
* Read the Father WID, if not found then running WID is Father WID
CLEAR: l_wa_father_wis, lv_wid_read.
READ TABLE l_it_father_wis INTO l_wa_father_wis INDEX 1.
* If Father Work Item ID found pass to the WID Variable else pass the Original
WID
IF sy-subrc = 0.
lv_wid_read = l_wa_father_wis-wi_id.
ELSE.
lv_wid_read = lcl_v_wi_id.
ENDIF.
* Read the work flow container data with WID Populated
REFRESH: l_it_wi_container[].
CLEAR: l_wa_wi_header.
lv_wid_read = lcl_v_wi_id - 1.
CALL FUNCTION 'SWW_WI_CONTAINER_READ'
EXPORTING
wi_id
= lv_wid_read
TABLES
wi_container
= l_it_wi_container
CHANGING
wi_header
= l_wa_wi_header
EXCEPTIONS
container_does_not_exist = 1
read_failed
= 2
OTHERS
= 3.
* If the call is a success
IF sy-subrc = 0.
CLEAR: lv_belnr, lv_bukrs, lv_gjahr, lv_email.
* Read the container values and pass them to generate the dynamic e-mail body
* Read the Company Code from Workflow WS91000120
CLEAR: l_wa_wi_container.
READ TABLE l_it_wi_container INTO l_wa_wi_container
WITH KEY element = 'BUKRS'.
IF sy-subrc = 0.
CONDENSE l_wa_wi_container-value.
lv_bukrs = l_wa_wi_container-value.
ENDIF.
* Read the Invoice Number from Workflow WS91000120
CLEAR: l_wa_wi_container.
READ TABLE l_it_wi_container INTO l_wa_wi_container
WITH KEY element = 'BELNR'.
IF sy-subrc = 0.
CONDENSE l_wa_wi_container-value.
lv_belnr = l_wa_wi_container-value.
ENDIF.
* Read the Fiscal Year from Workflow WS91000120
CLEAR: l_wa_wi_container.
READ TABLE l_it_wi_container INTO l_wa_wi_container
WITH KEY element = 'GJAHR'.
IF sy-subrc = 0.
CONDENSE l_wa_wi_container-value.
lv_gjahr = l_wa_wi_container-value.
ENDIF.
* Read the Company Code from Workflow WS91000120
CLEAR: l_wa_wi_container.
READ TABLE l_it_wi_container INTO l_wa_wi_container
WITH KEY element = 'EMAIL_ID'.
IF sy-subrc = 0.
CONDENSE l_wa_wi_container-value.
lv_email = l_wa_wi_container-value.
ENDIF.
ENDIF.
*---------------------------------------------------------------------------------------*
* Send an e-mail to a dummy e-mail ID stating that the above Work Item has
been created
*---------------------------------------------------------------------------------------*
TRY.
*
-------- create persistent send request -----------------------send_request = cl_bcs=>create_persistent( ).
*
-------- create and set document ------------------------------*
Build the e-mail Body
*
CLEAR: body_text.
*
CONCATENATE 'Work Item Created. WID:'
*
lv_wid_text INTO body_text SEPARATED BY space.
*--------------------------------------------------------------------*
* Start the Mail Body
*--------------------------------------------------------------------*
CLEAR: body_text, wa_message.
CONCATENATE body_text
'<html><body>Dear User'
INTO body_text.
APPEND body_text TO text.
wa_message-line = body_text.
APPEND wa_message TO it_message.
CLEAR: wa_message.
CLEAR: body_text.
CONCATENATE body_text
'<h3>What you need to know:</h3>'
INTO body_text.
APPEND body_text TO text.
wa_message-line = body_text.
APPEND wa_message TO it_message.
CLEAR: wa_message.
CLEAR: body_text.
CONCATENATE body_text
'Below is the invoice waiting for your approval.'
INTO body_text.
APPEND body_text TO text.
wa_message-line = body_text.
APPEND wa_message TO it_message.
CLEAR: wa_message.
CLEAR: body_text.
CONCATENATE body_text
'<h4>Invoice Information</h4>'
INTO body_text.
APPEND body_text TO text.
wa_message-line = body_text.
APPEND wa_message TO it_message.
CLEAR: wa_message.
*--------------------------------------------------------------------*
* Start Invoice Information in Table
*--------------------------------------------------------------------*
CLEAR: body_text.
CONCATENATE body_text
'<table border = "1" bgcolor = "skyblue">'
INTO body_text.
APPEND body_text TO text.
wa_message-line = body_text.
APPEND wa_message TO it_message.
CLEAR: wa_message.
CLEAR: body_text.
CONCATENATE body_text
'<tr><td>Invoice Number</td><td>'
lv_belnr
'</td></tr>'
INTO body_text.
CONDENSE body_text.
APPEND body_text TO text.
wa_message-line = body_text.
APPEND wa_message TO it_message.
CLEAR: wa_message.
CLEAR: body_text.
CONCATENATE body_text
'<tr><td>Company Code</td><td>'
lv_bukrs
'</td></tr>'
INTO body_text.
CONDENSE body_text.
APPEND body_text TO text.
wa_message-line = body_text.
APPEND wa_message TO it_message.
CLEAR: wa_message.
CLEAR: body_text.
CONCATENATE body_text
'<tr><td>Fiscal Year</td><td>'
lv_gjahr
'</td></tr>'
INTO body_text.
CONDENSE body_text.
APPEND body_text TO text.
wa_message-line = body_text.
APPEND wa_message TO it_message.
CLEAR: wa_message.
CLEAR: body_text.
CONCATENATE body_text
'<tr><td>Gross
Invoice
(USD)</td><td>200,000.00</td></tr></table>'
INTO body_text.
APPEND body_text TO text.
wa_message-line = body_text.
APPEND wa_message TO it_message.
Value
CLEAR: wa_message.
*--------------------------------------------------------------------*
* End Invoice Table
*--------------------------------------------------------------------*
*--------------------------------------------------------------------*
* Start Multiline Table
*--------------------------------------------------------------------*
CLEAR: body_text.
CONCATENATE body_text
'<h4>Line Item Data displayed in tabular format</h4>'
INTO body_text.
APPEND body_text TO text.
wa_message-line = body_text.
APPEND wa_message TO it_message.
CLEAR: wa_message.
CLEAR: body_text.
CONCATENATE body_text
'<table border="1" bgcolor = "lightgreen">'
INTO body_text.
APPEND body_text TO text.
wa_message-line = body_text.
APPEND wa_message TO it_message.
CLEAR: wa_message.
CLEAR: body_text.
CONCATENATE body_text
'<tr>'
'<th>Header 1</th>'
'<th>Header 2</th>'
'<th>Header 3</th>'
'<th>Header 4</th>'
'<tr>'
'<td>row 1, cell 1</td>'
'<td>row 1, cell 2</td>'
'<td>row 1, cell 3</td>'
'<td>row 1, cell 4</td>'
'</tr>'
INTO body_text.
APPEND body_text TO text.
wa_message-line = body_text.
APPEND wa_message TO it_message.
CLEAR: wa_message.
CLEAR: body_text.
CONCATENATE body_text
'<tr>'
'<td>row 2, cell 1</td>'
'<td>row 2, cell 2</td>'
'<td>row 2, cell 3</td>'
'<td>row 2, cell 4</td>'
'</tr>'
INTO body_text.
APPEND body_text TO text.
wa_message-line = body_text.
APPEND wa_message TO it_message.
CLEAR: wa_message.
CLEAR: body_text.
CONCATENATE body_text
'<tr>'
CONCATENATE body_text
'To process directly from e-mail, make your selection here
'
INTO body_text.
APPEND body_text TO text.
wa_message-line = body_text.
APPEND wa_message TO it_message.
CLEAR: wa_message.
CLEAR: body_text.
CONCATENATE body_text
'<a href="mailto:eccoffline@ecc-dev.yourcompany.com?
subject=A'
lv_wid_text
' - Approve Document">APPROVE</a> '
INTO body_text.
APPEND body_text TO text.
wa_message-line = body_text.
APPEND wa_message TO it_message.
CLEAR: wa_message.
CLEAR: body_text.
CONCATENATE body_text
'<a href="mailto:eccoffline@ecc-dev.yourcompany.com?
subject=R'
lv_wid_text
' - Reject Document">REJECT</a>'
INTO body_text.
APPEND body_text TO text.
wa_message-line = body_text.
APPEND wa_message TO it_message.
CLEAR: wa_message.
* Start DISCLAIMERS and WARNING Notifications
CLEAR: body_text.
CONCATENATE body_text
'<br><h4>Please Note: The links will send an e-mail via
MICROSOFT OUTLOOK.'
'Please do not change the subject, body or any information
in that e-mail.</h4>'
INTO body_text.
APPEND body_text TO text.
wa_message-line = body_text.
APPEND wa_message TO it_message.
CLEAR: wa_message.
CLEAR: body_text.
CONCATENATE body_text
'<h4>MICROSOFT Outlook must be installed in your
system.</h4>'
INTO body_text.
APPEND body_text TO text.
wa_message-line = body_text.
APPEND wa_message TO it_message.
CLEAR: wa_message.
CLEAR: body_text.
CONCATENATE body_text
'<span style="color:#FF0000">' "This is color for RED.
Browser Safe colors mandatory to prevent broswer crash.
INTO body_text.
APPEND body_text TO text.
wa_message-line = body_text.
APPEND wa_message TO it_message.
CLEAR: wa_message.
CLEAR: body_text.
CONCATENATE body_text
'<h4> <style="color: red"> CAUTION! Please do not reply to
this e-mail.'
'For approval via e-mail, please click the links provided
only. </h4></br>'
INTO body_text.
APPEND body_text TO text.
wa_message-line = body_text.
APPEND wa_message TO it_message.
CLEAR: wa_message.
CLEAR: body_text.
CONCATENATE body_text
'</span>'
INTO body_text.
APPEND body_text TO text.
wa_message-line = body_text.
APPEND wa_message TO it_message.
CLEAR: wa_message.
CLEAR: body_text.
CONCATENATE body_text
'</body></html>'
INTO body_text.
APPEND body_text TO text.
wa_message-line = body_text.
APPEND wa_message TO it_message.
CLEAR: wa_message.
*--------------------------------------------------------------------*
* End of HTML Code Body
*--------------------------------------------------------------------*
* Calculate the Document Size
CLEAR: lv_lines, lv_so_obj_len.
DESCRIBE TABLE it_message LINES lv_lines.
lv_so_obj_len = 255 * lv_lines.
* Create the Document
document = cl_document_bcs=>create_document(
i_type
= 'HTM' "Send HTML E-Mail and not 'RAW'
i_text
= text
i_length = lv_so_obj_len
i_subject = 'E-Mail sent AFTER Work Item Creation' ).
*
Add document to send request
CALL METHOD send_request->set_document( document ).
*
--------- set sender ------------------------------------------*
note: this is necessary only if you want to set the sender
*
different from actual user (SY-UNAME). Otherwise sender is
*
set automatically with actual user.
sender = cl_sapuser_bcs=>create( sy-uname ).
CALL METHOD send_request->set_sender
EXPORTING
i_sender = sender.
*
--------- Add recipient (e-mail address) ----------------------*
Create recipient - passing the e-mail ID here
recipient = cl_cam_address_bcs=>create_internet_address( lv_email ).
*
Add recipient with its respective attributes to send request
The
work
flow
is
triggered
with
work
item
ID
2735147
(Parent
Father
Work
Item)
Now running SOST, we see the e-mail is triggered via the work item exit (there is no SEND MAIL step in
our workflow)
We push this e-mail from SOST (Not needed if SCOT Batch Job is set up)
The APPROVAL and REJECTION links in the e-mail will look as shown
We click on APPROVE as of now, the following auto e-mail is generated. Notice that the TO field is auto
populated with the ECC-OFFLINE approval ID.
The subject is a concatenation of the Processing Action (A = Approve) and the Work Item ID
Offline Workflow Approval in ECC R/3 without SAP Logon from E-Mail
(Outlook)
...Previous
I am now clicking on SEND. I am not changing the SUBJECT or TO Field in this e-mail. This is crucial. I
can see the e-mail is in the SENT ITEMS in OUTLOOK Web-Mail
Now I am running the transaction SOIN for Inbound Send Requests (SMTP). This can also be substituted
by Report RSBCSIN
I can see the e-mail has been received at SAP . If you can see this, that your Inbound E-mail
Configuration is correct. You have crossed a big hurdle here.
Display the trace of this e-mail (Note: I have activated TRACE in SCOT, this is mandatory to know what
has happened in system)
The trace can be displayed from the SOIN screen. Notice the toolbar in that screen shot, the trace button
is shown
The trace screen opens as shown below (If trace is not active in SCOT, this screen will show no entries)
Now the moment the e-mail was received by the system, our Inbound Exit should have triggered and
processed the work item.
We can verify this from the trace. If we double click on the trace entry, it will show us all the details, our
exit was instantiated and triggered as shown in the highlighted entries below. Also we can see that the
RETURN Code was 0 which indicates that the method PROCESS_INBOUND was called correctly
So now we will check in SOST. We should see a reply from the Workflow System that the work item has
been approved. This was processed in the methodPROCESS_INBOUND coded in the Inbound Exit
Class ZZZCL_PROCESS_INBOUND_WORKFLOW
This e-mail was triggered by the Inbound Exit Class (notifying the processing). Displaying the e-mail
body
Checking the workflow log, the work item should have been processed as APPROVED
BEFORE Status IN PROCESS
(Note the work item was not processed manually in Business Workplace SBWP, but was
processed in the Inbound Exit Class via function module SAP_WAPI_DECISION_COMPLETE.
Please
study
the
code
in
method
PROCESS_INBOUND
in
class
ZZZCL_PROCESS_INBOUND_WORKFLOW. So you can process any code, transaction, etc offline
via e-mail using this concept. Simply create specific SUBJECT line in the auto e-mail and model
your code on that)
Offline Workflow Approval in ECC R/3 without SAP Logon from E-Mail
(Outlook)
...Previous
The OUTLOOK E-mail as seen in outlook. So the effect is; the moment the approver clicked on
APPROVE link in the first Workflow Notification HTML e-mail, a few seconds later he receives a system email informing him of the action carried out and stating the success.
We open the e-mail to see the details and also to verify if the e-mail opens OK
Now what happens if the user clicks on APPROVE or REJECTED link on the approval e-mail again?
The work item will not be re-processed or processed multiple times. The system will receive the e-mail
and send a notification back to user that the work item was already processed.
(You can design your own system response and code to handle this case where the approver might click
on the links multiple times and send multiple e-mails to the system. The system will always process the
first e-mail it receives on a first-come-first-served basis)
Let us see how this works. User clicks on REJECT link on the System Notification e-mail. This process
the user does after he has already clicked on APPROVE and has sent the auto e-mail to the SAP
System. The concerned work item has already been processed as APPROVED so system cannot
process it again. Hence system should inform this to the user
On clicking REJECT, we get the below e-mail, notice that the work item ID is same as before of the
already approved item.
The e-mail is sent by Outlook and received by the SAP system as shown, highlighted in YELLOW
Now the Inbound Exit will trigger again and find that this item is already processed, so system will send
back the notification e-mail. Notice that the system response is very fast. The system received the e-mail
at time 03:15:41 and sends the auto reply at 03:15:41 (see SOIN and SOST screen shot). This is
because in this case, it did not need to spend time to process the work item, which has already been
processed by the first e-mail
The e-mail is opened to check the contents and validate if it opens correctly
We have successfully processed a work item via e-mail without logging into SAP System. We also
managed to get the system respond to the e-mails and do the desired processing and reply back with the
correct status. We did not require SAP GUI to do any processing. Also SAP Login ID and Password was
not needed to do the Workflow Processing..
Constructor method has the import parameter IM_KEY (the key for the instantiation).
And also the class has the event TRIGGER with two parameters:
ENAME
TYPE PA0001-ENAME
Next, we need to create a Workflow template and use the ABAP class as its trigger. Notice that the
workflow has the same parameters as the event -ENAME and DESCRIPTION-.
TYPE
Declarations
TO if_swf_cnt_container.
STANDARD
TABLE
OF swc_value.
DATA l_event_ref
TYPE
REF
TO if_swf_evt_event.
DATA l_objtype
TYPE sibftypeid VALUE 'ZCL_TRIGGER_MULTILINE'.
DATA l_event
TYPE swo_event VALUE 'TRIGGER'.
DATA l_objkey
TYPE swo_typeid.
DATA l_selected_handlers TYPE
i.
DATA l_event_container
TYPE
REF
TO if_swf_ifs_parameter_container.
DATA vl_returncode
TYPE sysubrc.
DATA l_return
TYPE swf_return.
DATA lex_root
DATA l_string
TYPE
TYPE string.
REF
TO cx_root.
***
PARAMETERS p_name
TYPE pa0001-ename.
*
Instantiate
the
specific
TRY.
CALL
EXPORTING
im_objcateg = g_obj_category
im_objtype = l_objtype
im_event = l_event
RECEIVING
re_container = g_evt_param_container.
CATCH cx_swf_evt_exception.
ENDTRY.
*
TRY.
CALL
Aggregate
single
container
for
the
class
event
METHOD cl_swf_evt_utilities=>get_specific_container
parameter
to
event
container
METHOD g_evt_param_container->if_swf_ifs_parameter_container~set
EXPORTING
name
= 'ENAME'
value
= p_name
IMPORTING
returncode = vl_returncode.
CATCH cx_swf_cnt_cont_access_denied
cx_swf_cnt_elem_not_found
cx_swf_cnt_elem_access_denied
cx_swf_cnt_elem_type_conflict
cx_swf_cnt_unit_type_conflict
cx_swf_cnt_elem_def_invalid
cx_swf_cnt_invalid_qname
cx_swf_cnt_container.
ENDTRY.
Aggregate
APPEND 'This
APPEND 'for
APPEND 'to
APPEND 'in
multiline
is
a
passing
a
order
test
a
container
to
parameter
to
with
ABAP
multiline
of
an
execute
a
event
classes'
parameter'
event'
Workflow.'
container
TO it_description.
TO it_description.
TO it_description.
TO it_description.
TRY.
CALL
METHOD g_evt_param_container->if_swf_ifs_parameter_container~set
EXPORTING
name
= 'DESCRIPTION'
value
= it_description
IMPORTING
returncode = vl_returncode.
CATCH cx_swf_cnt_cont_access_denied
cx_swf_cnt_elem_not_found
cx_swf_cnt_elem_access_denied
cx_swf_cnt_elem_type_conflict
cx_swf_cnt_unit_type_conflict
cx_swf_cnt_elem_def_invalid
cx_swf_cnt_invalid_qname
cx_swf_cnt_container.
ENDTRY.
*----------------------------------------------------------------------*Check
the
Container,
if
all
*----------------------------------------------------------------------IF g_evt_param_container IS
TRY.
CALL
EXPORTING
obligatory
elements
are
filled
BOUND.
METHOD g_evt_param_container->check
check_oblig_parameters = 'X'
check_oblig_not_initial = 'X'.
CATCH cx_swf_cnt_elem_check_failed.
ENDTRY.
ENDIF.
*---move
the
event-parameters
IF g_evt_param_container IS
IF g_evt_param_container->get_element_count(
l_event_container
?=
ENDIF.
ENDIF.
(only
if
they
exist)
BOUND.
) > 0.
g_evt_param_container.
l_objkey = '12345'.
*---get
a
CALL
EXPORTING
im_objcateg
= g_obj_category
im_objtype
= l_objtype
im_event
= l_event
im_objkey
= l_objkey
im_event_container = l_event_container
RECEIVING
re_event
= l_event_ref.
instance
for
the
event
METHOD cl_swf_evt_event=>get_instance
*----------------------------------------------------------------------*
RAISE
*----------------------------------------------------------------------TRY.
* Refresh
the
cl_swf_evt_services=>reset_buffers(
*
Trigger
the
CALL
CATCH cx_root INTO lex_root. "
IF lex_root IS
l_string = lex_root->get_text(
MESSAGE l_string TYPE 'I'.
ENDIF.
ENDTRY.
COMMIT WORK.
buffers
).
should
event
METHOD l_event_ref->raise.
never
occur
BOUND.
).
And then, we review the workflow log, and data within the workflow container looks like this.
Workflow development.
Creating rules
Development objects:
The development has a custom database table created in SE11 which will store approver id's.
Create
a
global
IF_WORKFLOW
class
ZCL_WORKFLOW_DEMO
Define the new structure and table Types in the types tab.
in
SE24
assign
the
interface
FIND_BY_LPOR implementation
CATCH cx_swf_cnt_unit_type_conflict .
CATCH cx_swf_cnt_elem_def_invalid .
CATCH cx_swf_cnt_container .
ENDTRY.
Usually for determining dead line date, time we use factory calendar id, as my intension is only to show
the Re-evaluate agent's concept hence ignored the complex logic of determining dead line date and time.
I have hard coded the dead line time = start time + 1 hour.
NEW_APPROVER event will be assigned towards Receiver type "Re-evaluate rules of active work
items". This event does not have any parameters.
Design a screen in SE80 as shown below and assign a t-code. ZTRAVEL.
Create a new workflow template in PFTC with the start event START_WORKFLOW of the business class
ZCL_WORKFLOW_DEMO. Assign start events as shown below.
Create the WF container elements compatible to the event parameters and bind and shown.
Create workflow container element WF_ZCL_WOKFLOW_DEMO selecting object type class and value
as ZCL_WOKFLOW_DEMO.
Create workflow container element WF_START_DATE selecting SYST for structure and DATUM for field
as shown below.
Create workflow container element WF_START_TIME selecting SYST for structure and UZEIT for field
as shown below.
As the workflow container element WF_START_TIME need to be populated from Event binding set the
properties as Import as shown below.
Create workflow container element WF_DEADLINE_REACHED with type FLAG as shown below.
Properties selection is not required for this parameter.
Click on the Version-Dependent (current workflow version) tab in the workflow template header. Click on
events tab and assign the NEW_APPROVER event towards Receiver type "Re-evaluate rules of active
work items" as shown below.
Click on details button, a new pop-up screen will appear and fill the fields as shown below.
Create a container step and call the functional method GET_DEADLINE_DATE_TIME to populate
WF_TIME. To call the functional method from expression write the below code
%ZCL_WORKFLOW_DEMO.GET_DEADLINE_DATE_TIME(IM_TIME=&WF_START_TIME&)%
Create a rule function module ZFM_APPROVER in SE37 and paste the code as shown below.
In the latest end tab select, select expression for Refer.date/time, modeled for ACTION and assign
WF_START_DATE for Date and WF_START_TIME for time fields. Provide a meaning full outcome name.
This will create a new branch for the user decision step.
Create a event creator step and pass the values as shown below. Once the process reach the event
creator step all the active work items will reset, active work items will disappear from the inboxes and will
be reprocessed.
Here ends all the development. The workflow definition looks as shown below.
Open the transaction ZTRAVEL pass the values as shown below pass date, time and click on SUBMIT.
After clicking on Submit button the function code assigned to the Submit button will trigger the event and
workflow will start. As per the logic a work item should go to the line manager's inbox.
Check your Line manager's inbox for the work item.
Note: Do not perform any action on the work item.
In the workflow log we can see the deadline time and date. Once the deadline time is reached the new
branch will start processing will populate the DEADLINE_FLAG with X in the first step and once the
second step is reached all the work items will be re-initiated and the existing active work item will
disappear.
Login into platform manager system. Go to SAP Inbox you will find the work item waiting.
Login to line manager system. Go to SAP Inbox. The work item will de disappeared.
Now how to determine which Release Code needs to be released. The Release Code will be released
sequentially in table T16FS. In table T16FS, 8 Release codes can be stored for a particular combination
of Release group and Release Strategy. The field FRGZU (Release status) determines which Release
Codes needs to be released. If the Release Status field value is X and there are 3 Release Codes in
Table T16FS corresponding to the Release group and Release Strategy then the Release Code that
needs to be released is the value that is assigned to field FRGC2 in table T16FS. After the Release has
been done for Release code assigned to field FRGC2, we have to again pick the value of field FRGC3
and Release it.
Lets take an example of Purchase Order 4500017173. The Release group for this Purchase Order is ZR
and Release Strategy is GM. Initially the Release status is blank, as none of the Release Code has been
released.
Lets find out how many Release codes are there for the combination of Release group ZR and Release
Strategy GM. There are three Release Codes for this combination. They are PA,PM and GM
respectively.
After we have released the Purchase Order for Release Code PA the Release Status should be X in
table EKKO for this Purchase Order number. Let us check.
We should now try to Release the purchase order for Release Code PM by going to Transaction Code
ME29N.
After we have released the Purchase Order for Release Code PM the Release Status should be XX in
table EKKO for this Purchase Order number. Let us check.
After we have released the Purchase Order for Release Code GM the Release Status should be XXX in
table EKKO for this Purchase Order number. Let us check.
Now if we want to reset the Release of this Purchase Order then we can reset the Release for any
Release Code and that would be reflected in the field Release Status of table EKKO for that Purchase
Order number we are dealing with.
Let us reset the Release for Release Code PM of purchase Order
After we have reset the Release for Purchase Order for Release Code PM the Release Status should be
X in table EKKO for this Purchase Order number. Let us check.
Now in Order to release the Purchase Order we have again follow the above method to find out the
Release Code in Table T16FS using the Release group and Release Strategy of that Purchase Order.
This method is very useful when a Purchase Order requires approval when its is Released for the
changes in the following fields of a Purchase order:
Material code
Delivery Address
Delivery Date
Tax Code
For changes in the above field the Event SIGNIFICANTLYCHANGED of Business Object Bus2012
does not gets triggered. So in order to filter the Changes we have to have Change Event of Business
Object BUS2012 as the Triggering event of the Workflow and we have to determine the Release code by
using the method mentioned above, as Change event does not pass the Release Code of the purchase
Order.
Step 3:
Choose Material management Purchasing Purchase order
Release Procedure for Purchase order Define release Procedure for Purchase Order.
On double-clicking the record, the following screen appears. Here you need to set the conditions.
Step 10 :
Finally you need to set the workflow strategy.
2) To tailor the workflow definition as per our requirements, let us take a copy of the standard workflow
definition and modify the same.
7) Select the tab Triggering events. (The alternative method for getting into this screen is by selecting
Basic data (Hat symbol on the application toolbar) in the workflow definition)
Step 9 :
The standard workflow template provided by SAP for PR Release is WS00000038. This information
could be retrieved from the SAP help.
2.
It is assumed that the release procedure has been setup in the system by the functional consultant,
as shown below:
3.
The customization of the PR Release Strategy could be verified at the following location:
SPRO SAP
Reference
IMG Material
Requisition Release Procedure Procedure with
classification
4.
5.
Now define the recipients of the PR Release work item as per the release group (refer to screenshot
below). For testing purposes, the recipient type is taken as US, instead this can also be taken as
Position, Organization Unit and others.
6.
Now go back to the previous screen and click on Release Codes. Here enter the value 1 in the
workflow column for the release groups the workflow has to be configured.
7.
8.
Mark all the tasks (unless background tasks) as General Task in the agent assignment and
generate.
Now check for the records with release strategy not equals to SPACE and release indicator as Blocked.
We should also give the creation Date during which this issue was faced.
These are the list of POs for which Workflow might have triggered and assigned to approver who has not
released it or for which Workflow has not been triggered.
We have a standard Transaction Code SWI6 to check the Workflow Overview individually but how to
check in a massive manner.
The above method is cumbersome and will take a lot of time. There is a table SWIWIOBJCT
If it has any entries, it implies that Workflow has been triggered for it. This table can be utilized to check
Workflow for multiple key fields having same business object and is a very handy way to handle this crisis
situation.
The Production order is created. Now go to either CO02/CO03 to understand the statuses set for the
document created.
Click on i button.
Switch of the event trace and check for the events triggered during the production order
creation.
Now the requirement is to trigger a custom event, when the status MANC is set (please refer to the
above screens for details).
Steps to trigger a custom event whenever the production order status is set to MANC:
Go to transaction SWO1.
Create a custom business object by taking BUS2005 (Production Order) as Super type.
Implement and Release the business object component and the business object.
Press SAVE and select the above row and click on Status restrictions.
Now create a production order (Tcode CO01) and if the status of the document is MANC, then the above
event would be triggered.
Following is the screenshot from event trace:
Next,
navigate
to
SPRO SAP
Reference
IMG Quality
Notifications Notification Processing Activate Workflow Template.
Management Quality
3.
Click on Activate event linkage. Here activate the event linkage for Quality Notification INFO
(Screenshot shown below):
4.
Now go back and click on Assign agents to tasks. Here make the quality notification tasks as
General task as shown below:
5.
Now create a quality notification using the transaction QM01. The work item would reach the
coordinator (User) that is mentioned/specified during the notification creation.
Select the task type Workflow template and enter the workflow number in the task number. Click on
Copy task.
Following popup appears. Click on Copy task
Now go to Basic data Agent assignment for task (see the screenshot below):
Now ensure that the agent assignment for all the steps in the workflow is as per your requirement. If not,
you can modify the same to meet your requirements. (Please take a copy of the standard tasks as well, if
they are to be modified).
Configuration Settings:
The configuration settings are to make the standard SAP leave application to trigger the custom workflow
application for the leave requests instead of standard workflow.
Please note that the configuration settings are covered only from a Workflow perspective and not
elaborative.
Go to transaction PTARQ.
Now double-click the leave request types for which we need to trigger the custom workflow.
Now to have the workflow to process the leave request, check the check box as highlighted in the above
screenshot.
When the checkbox is highlighted, following fields appear:
Click on Save.
Testing:
To test the application, we need to create a leave request from the portal. Alternatively, we can use the
transaction PTARQ to create a leave application.
Click on Test Application in the transaction PTARQ.
Enter the Employee number (PERNR) and click on the tab Create Request
Enter the Infotype number 2001, the sub-type (leave type), Date and other information as required.
For testing purpose, you can use the function module PT_ARQ_REQUEST_EXECUTE to approve the
leave request and to complete the work item.
In order to obtain the PR from the PO we have create a virtual attribute PR that calculates the PR linked
to a PO.
This is the PO on which we will do our testing. First check whether the PR is getting retrieved in the
Business
object.
Now lets do the design on how to accomplish. There is a standard Business Object SYSTEM which has
a Method GENERICINSTANTIATE.
In this method if we pass the Object Key and Business Object name we get the Object Instance.
Lets
us
make
the
binding.
Here is our design. Now we will test by going to SWUS transaction code.
The status is completed. Now let us check the Workflow Overview of PO from ME23n Transaction code.
Here is the workflow log in PO. But actual test is in the respective PR screen. Let us check.
Here is the result. The workflow Log of PO is getting showed in the PR it is linked to.
In this case the BO refers to a standard BO already existing in the SAP system.
Lets suppose we have a BO BUS2014 which is Purchase contract. Now if I want to add my own
attributes /methods in addition to the standard, I will create ZBUS2014 which has all the items in
BUS2014 plus my own attributes and methods. In this case BUS2014 is called Supertype of my
BO ZBUS2014.
Here my BO is completely customized. It does not refer to any standard BO available in the SAP
system.
Now in the slides down we will see step by step approach to create a BO without a supertype.
Scenario
We have a Z table by the name ZEMPDETAIL. This table has three fields, Employee Number (PERNR),
start date(BEGDA) and end date(ENDDA).Whenever a record is entered in this table ,the start date
(BEGDA) should be saved as the sy-datum (current date) automatically and mail should be triggered
stating that a new entry has been created into the table to a particular user .
We will first see the creation of the table and its table maintenance step by step
1.) The table is created as per the below screenshot via SE11.
2.) The table maintenance is also created for the table in the same transaction
4.) There are many events available for table maintenance and we will choose the event create new entry to
suit a purpose and write a code for the same
6.) The code is to change the start date to sy-datum and create an event using the function module
SAP_WAPI_CREATE_EVENT. Once the event is created it is linked to workflow.
Now the table part is over. We will see the step by step approach to create a business object and the
linkage to a workflow.
Step 1 Creating a business object
Step 4 Creating an event in the Business object so that it can be linked to the table maintenance event
and called as workflow start event.
STEP 5 The business object has to be implemented. First the object components are implemented and
then the business object is implemented.
STEP 6 - The business object has to be released. First the object is released and then the business
object components are released.
The business object ZTAB_CHG is ready for and can be used in the workflow.
Step 1 -> Workflow builder SWDD
Step
binding
->
Set
the
default
Step6 -> Event linkage is now available from our workflow definition side
Step 10 -> Now we have to notify the system whenever the event ZCHANGE_DATA occurs this workflow
should be called.
The Transaction code is SWETYPV
Step 11 -> Check for a duplicate entry for the same object BO type.
OUTPUT
Output at the business workplace (Transaction SBWP) of user specified in the workflow:
And the mail content in the inbox of the user is shown in the screenshot below.
3.) Give the relevant Business object BUS2012 and the method RELEASESTEPCREATED in the start
events.
4.) Activate the starting conditions
5.) Give the binding (Event container to the workflow container)
We apply this rule to the agent determination of the task display PO in our workflow
The Purchase order needs to be sent for approval to an approvers inbox to be either approved or
rejected. So we need to have a decision step for the same
Now to test the workflow, we can trigger the event manually using the SWUE transaction
Blocks could be treated as folders combining a group of dependent work items. They are shown
as folders in the workflow log.
Following are the screenshots representing how a Block appears in the workflow definition and in the
workflow log:
Enter the step name and leave the block type as Standard. Press Enter. The workflow definition
would be appearing as follows:
All the dependent steps could be defined with in the Block start and Block end.
Contd..
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:
In SWITCH, each branch of it carries a condition definition. We can visualize Multiple Condition with
SWITCH as a group of Condition steps.
Small scenario using Multiple Condition with SWITCH is shown below:
Create a new workflow definition with a container element CARRID (Well known example for training
purposes).
Select
the
Switch
option
in
the
Type
field.
Contd..
If none of the condition is TRUE, a default branch is taken (Other values in the definition).
Following
are
the
conditions
used
in
our
example:
Insert an email step for each branch and check the output for various Carrid values.
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.
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.
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)
The description or the help for each of the above steps are available on the right side of the screen.
Configure RFC Destination
This can be done automatically or manually. If done automatically, as mentioned on the right side frame,
the logical RFC destination WORKFLOW_LOCAL_XXX is created (if not available). XXX is the client
number. Also the user WF-BATCH is also created if not already available.
The advantage of executing the above step manually is we can maintain another user and password as
required.
Select the step Configure RFC destination and click on F9.
If you happen to get the following popup, click on Yes.
Once the RFC destination, you can see the Green Tick mark beside Configure RFC Destination (as
shown in the screenshot below)
To resolve this, you need to maintain the default printer in your user profile of WF-BATCH or change the
printer to a valid one. Go to SWU1 and enter WF-BATCH. Navigate to tab Defaults.
In the above screenshot, the output device is maintained as LP01 which is not valid. Here I am modifying
the same to LOCL. Also the check box Output immediately is marked X.
Depending on the business requirements, we can change the interval to the desired level. However 3
minutes is the minimum duration the system accepts.
Click on Save and Schedule. You would get the prompt for the customization request.
Now similarly schedule the jobs Work items with errors and Condition evaluation.
For the step Schedule Background job for Event Queue, click on F9 (Automatic execution).
See the screenshot below:
Now we can observe the green tick mark beside Maintain Runtime Environment.
Now lets move to Maintain Definition Environment
Click here to continue...
Click on Display<->Change.
Click on create.
Enter a prefix number which is not allocated to any other client in the system.
please
After completion of the above step, we can now observe that the steps regarding Maintain Runtime
Environment and Maintain Definition Environment are in green now.
Unless you plan to use the Guided Procedures, the above configuration should be fine to work with the
workflows in SAP R/3.
Now to test the workflow configuration, click on Start verification Workflow (F5). We would get the
following popup message:
Now go to your SAP Inbox to check the work item (Transaction SBWP)
We can choose one of the two options to test the workflow configuration. Let us chose the first one.
You would now receive two emails in your SAP inbox:
Description
OOAW
Evaluation paths
PFAC_CHG
Change roles
PFAC_DEL
Delete roles
PFAC_DIS
Display roles
PFAC_INS
Create roles
PFOM
PFOS
PFSO
PFTC_CHG
Change tasks
PFTC_COP
Copy tasks
PFTC_DEL
Delete tasks
PFTC_DIS
Display tasks
PFTC_INS
Create tasks
PPOCW
PPOMW
PPOSW
SWDA
SWDD
Workflow Builder
SWDS
SWDD_CONFIG
Workflow configuration
SBWP
SWDC_DEFINITION
SWDC_RUNTIME
SWNCONFIG
SWDM
SWEINST
Evaluation
linkages
Continued...
and
maintenance
of
instance
Transaction Code
Description
SWEINSTVC
Evaluation
linkages
and
SWE2
SWE3
Evaluation
linkages
SWE4
SWEL
RSWELOGD
SWEC
SWED
SWEQADM_1
SWEQBROWSER
SWETYPV
SWI1
and
maintenance
maintenance
of
of
instance
instance
SWI2_FREQ
SWI2_DEAD
SWI2_DURA
SWI11
Tasks in workflows
SWI13
Task profile
SWI5
Workload analysis
SWL1
SWLV
SWFVISU
SWO1
SWO6
SWR_WEBSERVER
SWU_CONT_PERSISTENC
E
SWU_EWCD
SWU_EWLIS
SWU_BTE
SWU0
Event simulation
SWU2
RFC monitor
SWU3
SWU4
SWU5
SWU6
SWU7
SWU8
SWU9
SWU10
Continued...
Transaction Code
Description
SWUD
Diagnostic tools
SWUE
Trigger event
SWUI
Start workflows/tasks
SWUS
Testing workflows/tasks
SWXML
SWUY
SWWCOND_INSERT
SWWCLEAR_INSERT
RSWWCOND
RSWWCLEAR
WF_HANDCUST
WF_EXTSRV
WFWS