PO List Retrieval for which Workflow isn't triggered due to Event Linkage deactivation ( More details)
Triggering of events/Workflow upon status changes (More details)
Quality Notification Configuration (More details)
Triggering a Workflow whenever a PO is changed (More details)
Configuration of Leave request workflow for ESS/MSS (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
Advanced Features in SAP® Workflow from version 6.40
Exception Handling in Workflow (more details)
SWITCH in "Multi-condition" step (more details)
Demo on "Local Workflow" (More details)
General information on Workflow
SAP Workflow customization settings (How to do) (More details) NEW
Transactions related to Workflow (More details)
Developing a simple application using steps "User Decision" and "Mail" By Suresh Kumar Parvathaneni
Basic terminology used in the workflow: The workflow definition is the set of rules that determine the path that the process takes. For example, how a purchase requisition is processed, from the initial request to the creation of the purchase order A Workflow Instance, which is often simply referred to as the workflow, is a single workflow run. For example, the processing of a single purchase requisition for computers. The Tasks are the steps in the process, which have to be performed either by people or automatically by the software. For example, to check for the availability of the spare computers in the company. A Work item is the task instance that is performed as a single workflow step. For example, check that there are no spare computers available in the company. Agents are the people who process the tasks (via the work items). For example, requisitioner and a member of the purchasing department. Container is the place where all the data used in the workflow is collected.
Binding is the set of rules that define which data is passed to which part of the process.
Building a simple workflow application The central tool for creating, displaying and processing a workflow is the workflow builder (Transaction SWDD). Within the workflow builder you can create all components of a workflow, including all the containers you need for getting the data from one step to another. Generally, most of the workflows are started by an event (for example, when a material is created or when a new purchase requisition arrives). You define which data from this event needs to be passed to the workflow via binding. However you can also start any workflow directly. Let us create a simple workflow and start the workflow directly, using the testing tools. Call transaction SWDD. When the workflow builder is called for the first time, a newly created initial workflow definition appears or else last created workflow appears. In such cases you can opt to create a new workflow by pressing “Create New Workflow”(ctrl + shft + F5). The following screen appears.
The initial workflow screen has the following parts:
a. The start of the workflow definition, indicated by
b. The end of the workflow definition, indicated by
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.
Developing a simple application using steps "User Decision" and "Mail" Previous Now enter the title for the user decision “ Please make a decision”. Also enter the decision texts as Approve and Reject. On pressing enter, the outcome values default to the Decision texts but you can specify your own names, if desired. Now we need to select the agent. Agent is the person to whom the work item needs to be sent.. Since this is just a beginning, we would hardcode the user name. Select the User from the drop down list and enter the user name to whom the work item needs to be sent. In general, this type of agent assignment is not done. Agents are generally assigned using the expression, agent assignment rule or organization object (job, position etc.).
Now select
Transfer and to graphic button. Following screen appears:
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.
Now select the step “Send Mail” from the list.
Developing a simple application using steps "User Decision" and "Mail" ...Previous Now enter the subject and the body of the message for the mail to be sent.
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 wouldn’t be using this variable in real time scenarios. We would discuss about this in the coming documents. Now select
Transfer and to graphic button.
A popup appears requesting for the abbreviation and the name for this task. Enter the same and press enter.
Now enter the package as local object and press enter. Follow the steps 5 through 9 for the step “Reject”. The following screen appears:
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.
Developing a simple application using steps "User Decision" and "Mail" ...Previous To execute the workflow, activate it by choosing the activate button. Test the workflow by choosing
Now choose
Test. The following screen appears.
Execute to start the workflow.
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.
Including custom text in the step "User Decision" Whenever we create a step “User Decision” (For creation of User Decision step, click here) and provide with our own options like approve or reject, the work item would appear as follows:
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.
Identify the task being used in the step “User Decision”. In the step “User Decision”, click on the tab “Control”:
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”.
Click on “Copy task”. 3.
Enter the abbreviation and the name as required.
Click on “Copy Task”. 4.
Enter the package name as required.
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.
Now go back to workflow definition, transaction SWDD.
8.
Click on “User decision” and then click on the tab “Control”.
9.
Here replace the standard task number with the custom task created above.
10. Do the agent assignment and generate the same. It is always advisable not to change any of the standard texts. The change would reflect in all the workflow definitions the task is being used.
Creating a Container element By Suresh Kumar Parvathaneni This document details about creation of a container element in workflow and using it in the step "Mail". Pre-requisites: It is assumed that the reader of this Tutorial is aware of creating a workflow definition with the step “Mail”. If not, please go through the document on creating the same available, by clicking here. Steps: 1.
2.
Create a workflow definition using the transaction SWDD.
Let’s 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.
Now double-click on “Double-Click to Create”
4.
Enter the details pertaining to CARRID here.
5.
Click on tab “Properties” and select “Import”.
6.
Click on “Confirm (Enter)”.
7.
Now the element created could be seen on the left side, below the “Workflow Container”.
Creating a Container element Previous 1.
Create a “Mail” step by double-clicking on “Undefined” step in the workflow.
2.
Enter the recipient details in the “Recipients” box.
3.
In the subject line, enter “Carrid value entered is:” and click on “Insert Expression”.
4.
Select the element “Carrid” from the list.
5.
Similarly enter the content in the “Body” area.
6.
Save and activate the application.
Testing the Workflow application: 7.
Test the workflow by clicking F8.
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
Create custom workflow
Create container element
Fill Data in above created container element
Create Send Mail Step
Insert above container element in send mail step
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)
Workflow configurations using SWU3 is already done
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:
Keep the Recipient as &_WF_INITIATOR&
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 >>
Step 4: Go back to workflow & send mail step >>
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
Press OK button & save the Workflow & activate Step 5: Test the Workflow by pressing Test button as shown below
You will get following screen where press on execute button – Note: You can see the entries in container element DIS_TXT which we created earlier.
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.
Create a new workflow definition.
2.
Create a container element, CARRID (as demonstrated in tutorial 2).
3.
Now click on undefined step and create the step “Condition”.
4.
Enter the step name of your choice.
5.
We would have the following condition here: If carrid = ‘AA’. Do this. Else. Do this. Click on “Click here to create a new condition”. Following screen appears.
Double click on “Carrid”. Next click on “=” and enter the value “AA” in the constant field and press ENTER.
Enter the outcome names of your choice as shown above. Click on “Transfer and go to graphic”.
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.
Create a new workflow definition.
2.
Create a container element, CARRID (as demonstrated in tutorial 2).
3.
Now click on undefined step and create the step “Multiple Condition”.
4.
Enter the step name of your choice.
5.
We would have the following condition here: If carrid = ‘AA’.
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.
Using "Container Operation" step By Suresh Kumar Parvathaneni Agenda: Usage of step “Container Operation”. Pre-requisites: It is assumed that the reader of this tutorial has worked in the concepts that are dealt in earlier tutorials. (click here for more details) Scenario: In this tutorial, we would deal about how to work with the step “Container Operation” with an example of calculating the available seats by subtracting occupied seats from themaximum seats at the workflow level. Procedure: 1.
Create a new workflow definition using the transaction SWDD.
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.
Return to the main screen.
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.
Result would be as follows:
Demo on working with step "Loop (Until)" By Avinash Palavai, StraVis IT Solutions Prerequisite : Should have basic idea of worklow and usage of container elements, container operation and Send Mail Steps. 1) Go to the t.code SWDD ( Workflow Builder ). By default, it opens the last developed workflow. So click on create
to create a new Workflow. Below screen appears.
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,
4) Now create a step “Loop (Until)”.
5) Now the following screen of step “Loop Until” opens and set the condition as below, i.e. the loop runs until
6) Now your workflow appears as below,
Demo on working with step "Loop (Until)" ...Previous 7) Then create a “Send Mail” step on the “False” branch of step “Loop Until” as shown below,
8) Enter the following details in “Send Mail” step and click on Transfer and to graphic
9) Give an abbreviation and name to the Task.
.
10) Now your workflow would look like below,
11) Then create a “Container operation” step on the same “False” branch of step “Loop Until” after the Send Mail step.
12) Build the below condition, to increment the counter element.
13) Now your workflow appears as below,
14) Save and activate the entire workflow and test it 15) Click on
.
in the below screen,
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.
Using the step "Form" in workflow By Saumik Bhattacharya, Capgemini Form is an important step type of workflow builder. We can use forms to enter data for processing in Business Workflow, or to display and edit data. Using the Forms step type we can generate a form from the workflow system with a structure that is saved in workflow container. This form can be used for displaying and editing the form data. It can also contain additional control elements that can be used, for example, for the approval of form content. First of all we are creating a workflow container element in transaction code SWDD. You can use a form to display or edit data of a container element of the workflow container that refers to a structure. The element should be of type reference to an ABAP dictionary.
Then we will insert the forms in workflow:
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.
Finally we had attach two mail on approve and on reject.
After completing this, we will execute this workflow and will get the form:
We will go for approve this form and we will get description
And here is the approved mail:
Using the step "Form" in workflow By Sai Kumar B, Enteg Infotech In the need of input from the user other than mere clicking of accept and reject actions, we can use the Form Step in workflow. The form step presents the user a form (User interface) thus by enabling the workflow developer to capture the required input from the user. The form used here is just like classic Dynpro screen, which can be designed in Screen Painter (SE51). To Begin with lets start with Workflow builder, SWDD. In this tutorial I was just showing how to include a form step inside a workflow.
1. Right click on the activity and select create.
2. Select the form step type.
3. In the next screen provide Step Name and agent assignment 4. Select the form type and action 5. Then click on Create (Before clicking on Create make sure that you have declared a structure in container which can be used as the structure for the form / Screen you are going to include.
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.
8. Coming back to the form step click on the create button.
9. This will start a wizard, Click on continue
10. Give your form a name and select the structure for which you are building the form . 11. And click on continue.
12. Then click on complete
13. Save the object
Using the step "Form" in workflow ...Previous 14. Now you can change the form as per your need. You can use the form as it is, as the logic will be handled automatically. The changes that were made in the form at runtime will directly reflected in the container element. If you need more complex logic you can modify the form as per your requirements by clicking on change button.
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.
Finally activate everything and test.
Triggering Events Programmatically By Suresh Kumar Parvathaneni Purpose: This document details the procedure in triggering the business object events programmatically. Pre-requisites: It is assumed that the reader of this document is aware of the business object concepts and good in ABAP. Procedure: In this document, we would take an example of the business object BUS1001006 (Material) and the event CREATED. In general, this event is triggered whenever a material is created using a standard procedure like MM01 or any others. Now we would trigger this event from our own programs. Following are the screenshots of the business object BUS1001006 and the event CREATED. Go to transaction SWO1 for more information of the business object.
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:
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.
Press ‘Switch On”. Now execute the program developed earlier. Now switch-off the event trace using the same transaction SWELS. Now go to transaction SWEL. Here you can list out the events triggered in the particular period of time. Here is the event-trace list:
Deadline Monitoring in SAP Workflow (Working with Latest end) By Suresh Kumar Parvathaneni A major advantage of workflow is the ability to monitor the workflow steps according to a predefined schedule. Following are different deadlines that can be monitored against each workflow step:
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:
We would extend this example to the deadline monitoring. In the User Decision step, click on the “latest end” tab.
By default, No deadline monitoring is active (as seen in the above screenshot). Choose the “Work Item Creation” from the list box.
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.
Deadline Monitoring in SAP Workflow ...Continued Enter recipient details to whom the message to be escalated, if the work item is not executed with in 5 minutes after work item creation.
Save and activate the workflow definition. Testing the workflow application:
Execute your workflow.
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.
Don’t worry if the deadline message doesn’t 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).
Deadline Monitoring in SAP Workflow (Working with Requested Start) By Ravi Aswani In this tutorial, we would look into implementation of “Requested Start” in the step “User Decision”. This is common for the step “Activity” and others as well. Go to transaction SWDD and create a step User Decision. Click on the tab “Requested Start”.
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).
Dynamic Parallel Processing in Workflow By Punit Jhanwar, YASH Technologies This blog is a step-by-step approach for using dynamic parallel processing in Workflow (For the concept of dynamic parallel processing, please click here). For our demo purpose, we have taken a simple example. A multiline element ‘Material’ is passed on to workflow and our step ‘Activity’ has to be executed n times (n denotes the number of materials in the multiline container element ‘Material’). In simple words, if 10 materials are passed to the workflow, then 10 work items are to be generated. Following is the step-by-step approach in achieving the same: 1. Create workflow using the workflow builder.
2. Create a Multiline container element for Material number .
3. Create a step ‘Activity’ in the workflow definition.
4. Click on the tab ‘Miscellaneous’.
In the field “Multiline Element”, click on F4 and select MATNR.
5. Now go back to the tab ‘Control’. From the list box, select ‘Create task’
Enter the abbreviation and name for the 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).
Dynamic Parallel Processing in Workflow ...Previous In the properties, click on Import.
7. Insert the container element MATNR in the work item text .
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’.
9. Define the binding between the activity and the task.
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.
11 . Activate the workflow .
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.
Personal Substitute in Workflow By Suresh Kumar Parvathaneni Requirement: Need to have at least one substitute who can act upon work items in your absence. Important: The appointed substitute would be able to see all your work items. A substitute cannot be assigned for only particular area of organization or any other item. So need to ensure that the substitute have the necessary authorizations to act upon the work items. Procedure: 1.
Go to SAP Business Work Place (TCode: SBWP)
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.
List of users available in the system are displayed.
“Create
5.
Select the required substitute user name. Following screen appears.
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 user’s inbox. 6.
Save the entries
7.
Click Enter to leave the screen.
For information on how to adopt a substitution, click here.
Adopting a Substitute in Workflow By Suresh Kumar Parvathaneni If you have been designated as an “as-needed” substitute, you must manually adopt the substitution. If you are designated as a “permanent” substitute, the work items would automatically appear in the inbox. Before adopting a substitution, there are 19 work items in the inbox. See the screenshot below:
To adopt a substitution, select Settings Workflow settings adopt substitution.
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 user’s 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.
Notification of Work Items via e-Mail By Suresh Kumar Parvathaneni SAP provides us with a facility of notifying the user via the email address of your choice when there are any pending work items in the SAP Inbox.. 1.
Go to Transaction SO13.
2.
Click on Automatic Forwarding tab.
3.
Click on Create icon .
4.
Enter the details in the above screen.
5.
Click ENTER to complete the entries.
6.
Now the notification would be received at the provided email address if there are any pending work items in the inbox.
Filtering the Work Items in the SAP Inbox using BADI This document details about the procedure in filtering some of the work items from the SAP inbox using a BADi. Following is the screenshot of the SAP inbox, before implementing BADi:
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 the implementation name and press ENTER
Enter any meaningful short text for the implementation and click on the tab “Interface”
The implementing class, ZCL_IM_BWP_SELECT_FILTER, is automatically proposed. Double click on the implementing class name.
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 wouldn’t 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.
Inserting the logo in the Work item preview To upload the logo: 1.
Go to transaction SMW0
2.
Select “Binary data for Web RFC applications”.
3.
Execute screen)
the
transaction
(No
need
to
fill
any
values
on
the
selection
4.
Click
on
“Create”.
The
following
screen
“Descriotion”. 5.
Click on “import”. Select your company logo.
appears.
Enter
the
“Obj.
Name”
and
6.
Your screen.
entry
is
now
available
in
the
table
control
on
the
Embedding this logo in the Work item preview 1.
Create a workflow definition with a simple step “User decision”.
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”.
Inserting the logo in the Work item preview Previous 5.
Copy the function module “SWL0_PREVIEW_DEMO_TEXT_AND_GIF” to a ‘Z’ function module.
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.
Save and activate the function module. 7.
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.
Tracing the events executed in a transaction By Suresh Kumar Parvathaneni In the article triggering events programmatically, we learned about triggering the events programmatically in our custom programs. But SAP has already provided with many events in almost all the standard SAP transactions like: 1.
When a material is created, a standard event is triggered
2.
When a Purchase Order is created, an event is triggered.
3.
When the status of a production order is changed, an event is triggered.
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.
A
pop-up
screen
as
shown
below
would
appear: 2.
Click
on
“Switch
on”.
The
event
now. 3.
Keeping this event trace on, create a material using MM01.
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.
Click on "Transfer and to Graphic" (Green tick button).
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.
Now go back to the main screen.
The above screenshot is of the step "Loop (Until)". Now double-click on the "Undefined" step above and create an email step.
Enter the recipient name and other details as shown above. ....To continue click here
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.
Click on "Create new task"
Provide the details as shown below:
Don't forget to check the checkbox "Background processing". SAVE and click on Back button. In the activity step, switch to "Requested start" tab and provide details as shown below:
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):
Ad Hoc agent assignment in Workflow By Sathis Kumar R, Quintegra Solutions This Article is about the Adhoc Agent Assignment for workflow. The workflow initiator assigns a recipient to the steps in the workflow at runtime. Scenario: Assigning Adhoc Agent for the task " create the leave form". Step by step: Create the new workflow named as "wf_4adhoc "
Drag and drop the activity from the step type.
Now create a new task for leave form. In that give your own abbreviation and name for the task. Object Category : BOR Object Object Type
: FORMABSENC.
Method
: CREATE.
Now save the task and go back .Now the binding between the task and the workflow was shown like.
Click ok (Tick mark) button. Now the task complete option was active.
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...
Ad Hoc agent assignment in Workflow ....Previous
Now choose the task and click the attributes button.
Choose the General Task and click the Transfer button.
You go back to the workflow builder now the Agent Assignment was active.
Click the Ok button. Now Go to the Extras -> Ad_hoc functions -> Enable the Adhoc Agent Assignment. Now the enable the Adhoc Agent Assignment Wizard will be opened.
Click the Continue Button. Now it shows your Task Number and Name and check whether the "insert the workflow constructor and workflow destructor" will be selected or not. If not means now you select that option.
Click the Continue Button. Click here to continue...
Ad Hoc agent assignment in Workflow ....Previous
Now the wizard was completed click the Complete Button. You check the task it will automatically filled the agent name as: &Agent_0001.Agents& Now you can Save the Workflow and activate it. Execute the Workflow. Now its looks like the following figure.
You click the Ad_hoc Agent tab.
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.
Triggering workflow to send an email whenever a material is created By Chandrasekhar V, EDS This example focuses on triggering a workflow whenever a material is created using MM01. TCode SWDD(Workflow builder) -> Click on “Create” 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.
Drag and drop “Activity” step into branch YES, Create new task click on the “Display task” -> Create task
Enter the “work item text” in the same screen as follows:
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”
Click on back 2 times.
Click here to continue...
Triggering workflow to send an email whenever a material is created ....Previous Click
on
Select “Workflow initiator” as Agents and click on “Transfer and to graphic” button
“continue”.
To create the workflow container
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 “transfer and to graphic” Right click on branch “No” to send a mail
Click here to continue...
Triggering workflow to send an email whenever a material is created ....Previous Double click on “send mail”. Enter the following details as in the below screen
Click on “Transfer and to graphic”
Save in a local package Click on the “Basic data(ctrl+F8)” from application toolbar and select “Start events” tab
Enter the details as in bellow screen
Click on “Binding”
Click on ok Save and come back to graphic, the following screen will appear
Save, activate and execute.
Go to TCode “MM01” to create the material Enter the details in MM01 and click on “Select view” -> “Basic data1” Enter the details in Second screen as below:
Save and come back.
Check
your
SBWP. Double click on “Work item executable”
inbox
by
using
TCode
Defining Custom Rules for use in SAP Workflow By Raghava Vakada, Mouri Tech Solutions “I would like to explain about creating custom rules in SAP Workflow. The rules can be created or changed using the standard SAP transaction PFAC. Once the rules are created you can call these rules in any workflow via the rule container”. In this article I am creating a rule, which will find the users based on Position id. I have created a custom function module ZWF_FIND_USERS which will return me back a position under Asset Analyst (HRP1001SOBID). The custom function created should have the same interface as that of the SAP standard function module RH_GET_ACTORS. The following table parameters have to exist in the custom function module. “ACTOR_TAB STRUCTURE SWHACTOR” “AC_CONTAINER STRUCTURE SWCONT” Following is the function module code: FUNCTION ZWF_FIND_USERS. *"----------------------------------------------------------*"*"Local Interface: *" TABLES *" ACTOR_TAB STRUCTURE SWHACTOR *" AC_CONTAINER STRUCTURE SWCONT *" EXCEPTIONS *" NOAGENT_FOUND *"----------------------------------------------------------INCLUDE . DATA : POSITION_ID LIKE ZBUSAREA-OBJID, LT_HOLDERS TYPE STANDARD TABLE OF SWHACTOR, LWA_HOLDERS TYPE SWHACTOR, LWA_USERS TYPE STANDARD TABLE OF HRP1001, WA_USERS TYPE HRP1001, NUM_LINES TYPE I. *Read values assigned to the rule criteria SWC_GET_ELEMENT AC_CONTAINER 'POSITION_ID' POSITION_ID. SELECT * FROM HRP1001 INTO table LWA_USERS WHERE OBJID = POSITION_ID. IF NOT LWA_USERS IS INITIAL. REFRESH LT_HOLDERS[]. loop at LWA_USERS into WA_USERS. Condense WA_USERS-SOBID. LWA_HOLDERS-OTYPE = 'US'. LWA_HOLDERS-OBJID = WA_USERS-SOBID. APPEND LWA_HOLDERS TO LT_HOLDERS. APPEND LINES OF LT_HOLDERS TO ACTOR_TAB. endloop. ENDIF. DESCRIBE TABLE ACTOR_TAB LINES NUM_LINES. IF NUM_LINES IS INITIAL. RAISE NOAGENT_FOUND.
ENDIF. ENDFUNCTION. Creating
a
rule
using
the
PFAC
Transaction
Assign the function module ZWF_FIND_USERS in the "Rule Definition Tab"
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.
Enter the Position Id, which is created in (PPOCW)
It displays Asset Analysts (users) in the “Rule resolution result”
Now you can use this rule in any of your workflow definitions.
Maintaining Translations for Work item texts and Outcome names In this tutorial, we would look into a simple method of translating Work item texts and step names to the desired language. Let us open any existing workflow definition.
Check the same workflow definition by logging in German Language:
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):
Following pop-up appears: Select German from the list box.
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.
Save and activate. Now logon in German Language and check the workflow definition. You can observe that for the two step types, the text is available in German.
Raising exceptions in a method and handling the same in the workflow By Suresh Kumar Parvathaneni This document details the procedure in defining exceptions in a method and using the same in a workflow. Let us first look at raising exceptions in a method: Go to Business Object Builder (Transaction SWO1). Create a business object.
Now create a method.
Now select the method you have created and click on button “Exceptions” available on the toolbar. Following screen appears:
Now click on Create. Following popup 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.
Go back to the main screen. Now in the method, provide the following code:
Save the business object and release the same.
Try executing the method by clicking on Test/Execute (F8). The exception would be raised as shown below:
Capturing the exception raised by the method in the workflow: Go to Workflow Builder (TCode: SWO1). Create the step “Activity”
Create a task and provide the following details in the new task:
Save your entries and return to the previous screen.
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
ALE - Error handling through workflow By Abhijit Daptary & Siddharth Samal, Capgemini India Pre-requisites. It is assumed that the reader of this article has some knowledge in SAP workflow BOR objects and ALE Idoc process like process code, Partner Profile etc. Description Here, we will be discussing in details the Error handling of an Inbound Idoc through triggering an event, which in turn will be triggering a workflow attached to the workflow. Steps:1. Create custom BOR object with the events, Start and Stop event 2. Create a workflow for the error handling, like generating a notification whenever an error occurred in the Inbound Idoc. 3. Creation of Function Module and attachment with the Process Code 4. Create the settings for the Inbound Process of the Idoc through the Process Code. Creation of BOR objects. Go to the transaction SWO1.
Enter a name for the Object type and click ‘CREATE’ button for creating the custom BOR object.
Enter the details required for creating the BOR objects...
Create the Key fields and events of the BOR object. For creating the Key fields place the cursor on the Key fields and Click on the Create Button
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.
Now, Generate the BOR object through the generate button
Release the EVENTS and subsequently release the BOR object.
After the creation of BOR object Create a workflow for the generation of notification whenever an error is reached in the Inbound Idoc. Execute the transaction SWDD.
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
ALE - Error handling through workflow ...Previous Activate the Workflow and test it whether it is working as per the requirement. After the successful completion it is required to attach the workflow with the event. Go to the Header section (Denoted by CAP).
Go TAB.
to
the
Start
Events
Enter the details of the event with which the workflow should be linked like the category, BOR object type and the event with which that should be linked. Enter here the BOR object that has been created and give the name of event created for starting the workflow. Click on the Binding Button for generating the binding between the event and the workflow.
Generate the binding and click OK button to save the binding.
Click on Activate / deactivate button for activating the linkage.
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
ALE - Error handling through workflow ...Previous The process code is being created through the transaction WE42 Go to the change mode and click the New Entries button for creating new process code.
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.
Enter the process code for the corresponding message type.
Click SAVE button for saving the changes.
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
ABAP Classes in Workflow By Anwesha Bhattacharya , Capgemini India 1.
ABAP Classes and Business Workflow:
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.
What is Class Builder and its purpose?
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.
How to reach Class Builder?
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.
How does it integrate?
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 Builder’s 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.
How to use the Class Builder?
Use the Class Builder to:
Display an overview (in the Class Browser) of global object types and their relationships.
Maintain existing global classes or interfaces.
6.
Create new global classes and interfaces.
Implement inheritance between global classes.
Create compound interfaces.
Create and specify the attributes, methods, and events of global classes and interfaces.
Define internal types in classes.
Implement methods.
Redefine methods.
Maintain local auxiliary classes.
Test classes or interfaces in a simulated runtime environment.
What are the constraints?
We cannot define object types on the basis of graphical object modeling. 7.
Note before creating global classes and interfaces:
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.
Naming Conventions in ABAP Objects:
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.
Conventions for Object Types:
Class in the class library
CL_
Interfaces in the class library
IF_
Local classes in (recommendation)
programs LCL_
Local interfaces (recommendation)
programs LIF_
in
10. Conventions for Components: Method name
Events
Local type definitions within a TY_ class (recommendation) Data definitions (variables)
Data definitions (recommendation)
(constants) CO_
To Continue....Click here
ABAP Classes in Workflow ...Previous 11. Local Conventions within Methods: For parameters: IMPORTING parameters
IM_
EXPORTING parameters
EX_
CHANGING parameters
CH_
RESULT
RE_
12.
Using ABAP Classes in Workflow:
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?
Go to transaction SE24 and create a customized class.
Next the pop up appears where we need to mention the detail as follows:
Save it and the class is created.
Now the class is to implement IF_WORKFLOW interface. For this go to the tab and declare the IF_WORKFLOW as the interface there and press Enter; two sub-interfaces appear: BI_OBJECT and BI_PERSISTENT. Save the Class.
14.
The ZCL_TEST interface.
class
now
contains
the
existing
methods
of
IF_WORKFLOW
Lights on Key Attributes and Attributes:
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.
tab page as shown
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 use the BOR macros in a class, two INCLUDES must be included.
Include ……………contains the local types Include ……………contains the BOR macros An example to show how to define Attributes:
To Continue....Click here
Attributes
and
Key
ABAP Classes in Workflow ...Previous 15. Why IF_WORKFLOW Interface? The IF_WORKFLOW interface is necessary when using an ABAP class within the SAP WebFlow Engine. The interface contains methods that allow the object to be used within the SAP WebFlow Engine. The SAP WebFlow Engine handles all objects generically. Objects have to be saved in the event of a context change. Therefore, it is necessary to convert object references in such a way that they can be saved persistently. Conversely, we have to be able to generate the corresponding instance of an ABAP class from the persistently saved key. There are also a number of SAP WebFlow Engine components, for example, the Workflow Log that can display objects. In this case the object has to provide corresponding functions. The IF_WORKFLOW interface puts a logical parenthesis round the BI_PERSISTENT (instance management) and BI_OBJECT (object behavior) interfaces. The IF_WORKFLOW interface contains the following methods:
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
Describes the object type ( CL for ABAP classes)
TYPEID
ABAP class name
INSTID
Object key. The key is limited to 32 characters.
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:
Inconsistency in the data display
Instance data being overwritten by another instance Locking conflicts
There is an implementation example in the CL_SWF_FORMABSENC demo class.
17.
BI_PERSISTENT~LPOR Method:
The BI_PERSISTENT~LPOR method is the counterpart to the BI_PERSISTENT~FIND_BY_LPORmethod. It provides the persistent display for an existing instance of an ABAP object. Features: The method returns the persistent display of an object reference as a SIBFLPOR type structure as described earlier.
There is a close relationship between the BI_PERSISTENT~FIND_BY_LPOR method and theBI_PERSISTENT~LPOR method. If we call the BI_PERSISTENT~FIND_BY_LPOR method first and then the BI_PERSISTENT~LPOR method, the BI_PERSISTENT~LPOR method must return the same value as was previously used to call the BI_PERSISTENT~FIND_BY_LPOR method. There are also several ways of implementing this method in this case. There is an implementation example in the CL_SWF_FORMABSENC demo class.
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
ABAP Classes in Workflow ...Previous 19. BI_OBJECT~DEFAULT_ATTRIBUTE_VALUE Method: The BI_OBJECT~DEFAULT_ATTRIBUTE_VALUE method returns the display name of the object. Features: We can display references to process objects or process step objects at different positions within the SAP WebFlow Engine (for example, in Business Workplace and in Workflow Log). The object key is normally displayed here. If, for example, we want to display a descriptive text instead, the BI_OBJECT~DEFAULT_ATTRIBUTE_VALUE method has to return the corresponding value. If the method does not contain implementation or does not return a value, the object key is displayed. 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.
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.
How to use ABAP Classes in Process Steps of Business Workflow?
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:
Simple types (string, integer, and so on)
Data Dictionary types (structures, tables, complex types)
References to objects from the Business Object Repository
References to ABAP classes (supporting the IF_WORKFLOW interface)
We can transfer method parameters that represent a persistent object (IF_WORKFLOW orBOR Object) in the following ways:
ABAP classes (with IF_WORKFLOW interface)
TYPE SIBFLPORB Object is transferred using the persistent display
TYPE REF TO Object is transferred as object reference
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).
Exceptions Not Based on Class: We can also trigger exceptions not based on class. The SAP WebFlow Engine can differentiate between the two exception categories (temporary and permanent) by the name. If the exception begins with TMP or TEMP, it is a temporary exception; otherwise it is a permanent exception.
Using Document Template in Workflow By Madhavi This tutorial details about the usage of the step “Document from Template” in workflow. Sometimes, it becomes a necessity to work with the documents (Word, Presentation, excel and others). Go to Transaction SWDD and create a new workflow definition. Before we go ahead and create a document template, we need to save the workflow definition. Save your workflow definition. Now select “Document templates” from the list as shown below (You can find this on the left side bottom of the screen)
Click on “Double-click to create”
Click on “Change document class” and then select “Document” from the list provided (see the screenshot below):
The following screen appears:
Enter some text in the document:
Save your document.
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”:
Enter the step name.
To continue...click here
Using Document Template in Workflow ...Previous In the section, Doc. Template(s), select the document we created earlier using the F4 help. Also enter the agent details.
Save your entries. The workflow definition would look like this:
Activate your workflow and execute the same. Your work item would look as follows:
Execute the work item. The document would open as shown below:
Modify the document and Save.
Your work item is executed.
Demo on using Workflow Wizard By Nihar Ranjan Barik & Sunil Ojha, Capgemini Workflow wizards are one of the very strong tools available in workflow builder. Dialog-oriented user guide that simplifies the definition of workflows in standard situations. There are wizards that just create step sequences within a workflow definition. These can be found in the Workflow Builder. Wizards that create a new workflow definition are located in the Workflow Wizard Explorer. You can, however, also use these wizards in existing workflow definitions. In this case, a new workflow definition is not created. For example I want to attach a report in a workflow, workflow wizards will make this very easy and effective. Step1. Go for the transaction SWDD (Workflow Builder) Click on “Step type that can Be inserted” and the select Workflow Wizard (see the screenshot
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.
Enter the work Item text.
Continued...
Demo on using Workflow Wizard ....Previous Edit the basic data of the task that the new step references.
With this we are into the last step of this process. Press the complete step from the screen.
In the further step agent assignment is done
In the general Task we are selecting for General task.
Now it is the time to test our work Flow
In Result to the work flow execution the following screen of the report program will result
The simple output for this testing workflow is shown.
Steps to transport the Agent assignment from one system to another By Vijayendra Krishnamurthy Rao, Hewlett-Packard Problem Statement: I have developed a workflow that I want to transport to a production client. After much testing I changed the agent assignment to general task and then transported to QA but the agent assignment did not actually got transported. How do I get my agent assignment into a transport so that I can move the agent assignment from one system to another system? Solution: Step 1: Go to transaction RE_RHMOVE30
Step 2: Select Plan version: 01 Select Object Type: TS Select Object ID
: your 8 digit task id number e.g. 99999999
Also, In the Transport section enter or create your change request
Select "Transport Objects" and Deselect "Test" and "With Lock"
Step 3: Execute and go to next screen.
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 won’t 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.
Defining Custom Rules using responsibilities in SAP Workflow By Geethanjali K, Kaavian Systems “In this tutorial, we would discuss about creating custom rules using responsibilities in SAP Workflow. The rules can be created or changed using the standard SAP transaction PFAC. Once the rules are created you can call these rules in any workflow via the rule container”. First go to PFAC transaction and enter the rule name like znew_rule. Click on create icon. It will show you the screen like as follows:
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.
Go to the container tab and create a container element
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.
Enter the abbreviation and press ENTER.
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.
Click here to continue....
Defining Custom Rules using responsibilities in SAP Workflow ...Previous Now go back to the ‘Responsibilities’ tab. Choose insert agent assignment (see the screenshot below).
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.
Try simulation run for this
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’.
Using Start Conditions in Workflow By Geethanjali K, Kaavian Systems Go
to
transaction
SWDD
and
create
a
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.
Using Check Function Module in SAP Workflow By Geethanjali K, Kaavian Systems Following is a custom function module created for our demo purpose, which will check the conditions before triggering the workflow. FUNCTION ZGEE_SALES_ORG. *"---------------------------------------------------------------*"*"Local Interface: *" IMPORTING *" VALUE(OBJTYPE) TYPE SWETYPECOU-OBJTYPE *" VALUE(OBJKEY) TYPE SWEINSTCOU-OBJKEY *" VALUE(EVENT) TYPE SWETYPECOU-EVENT *" VALUE(RECTYPE) TYPE SWETYPECOU-RECTYPE *" EXPORTING *" REFERENCE(RESULT) TYPE C *" TABLES *" EVENT_CONTAINER STRUCTURE SWCONT *" EXCEPTIONS *" NOT_TRIGGERED *"---------------------------------------------------------------TABLES: VBAK. DATA VKORG LIKE VBAK-VKORG. SELECT SINGLE VKORG INTO VKORG FROM VBAK WHERE VBELN = OBJKEY. IF VKORG = '3000'. RAISE NOT_TRIGGERED. ENDIF. ENDFUNCTION. Now go to transaction SWE2 and insert your object type, event, and the receiver type.
Double click on your entry, following screen appears:
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.
Retrieving the Work item information for the deleted users By Arghadip Kar, IBM India The request can be that a particular User has been deleted from the SAP system as he is no more in the company and we need to retrieve the work item Ids that are present in the inbox. First approach check whether the user Id exist in system using SU01D.
The corresponding User-id does not exist in the system. We generally used to ask the Security Team to activate the user Id to retrieve the workitem id, which is a long process and may be misleading to other users, as the user will be activated for sometime. Now go to transaction SE16 and enter the table name as SWWORGTASK. Here you need to give the User Id along with the Object Type (US) in the field ORG_OBJ as shown in the screenshot.
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 Id’s 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.
Transporting Organizational Structure from one system to another By Ribhu Ahuja, Tata Consultancy Services Scenario: We have two systems – DEV (Development) and QA (Quality) – These are CRM 2007 systems or they can be SAP R/3 systems as well. We have an org structure created on the DEV system and we want to replicate it in the QA system. Steps and reports used: First of all, let us see the organizational structure in the dev server. Use T code PPOMA_CRM to see the same. In R/3 systems, the TCode would be PPOME.
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 Plan version, choose 01 – current plan version. In Sequential file box, in file type choose P – for physical file and PRESS ENTER.
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 choose this file and return to the previous screen.
Now execute the transaction. It shows the list of entries exported:
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
button and specifying the client to which we want to transfer the
scenario,
where
we
are
copying
data
from
one
server
to
another,
this task won’t 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 here to continue...
Transporting Organizational Structure from one system to another ...Previous
Click on the
button. We get the following screen:
Execute the report and we see the following screen:
Press the
button and we are on the batch input session screen (SM35)
Choose our entry – PD and click on the see the data being updated in the screens as shown:
button. If we choose foreground update, we can
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:
Click select all -
and then click
. It asks for the transport request number:
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.
Configuring events for HR Workflow By Sri lakshmi Lavanya Koduganti, CSC Scenario: Suppose you have created a Custom Infotype (Say 9048) and you want to trigger an event (Say ZRTW_INS event on the Business Object BUS1065) whenever a new record is inserted into this Infotype. Step 1: Go to TCode SWEHR1.
Click on New Entries tab Step 2: Enter the following details
This links the Infotype with the Business Object.
Step 3: Go to TCode SWEHR3. Click on create “New entries” tab. Enter the following details.
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
Trigger Workflow from Messages By Suresh Kumar Parvathaneni This document details about the procedure in triggering the workflows from a message (For e.g., error or warning message). For our demo purpose, let us consider the transaction ME21 (Create Purchase Order). Without entering any values on the screen, press ENTER. You would get the error message “Enter Purchasing Org.” (as shown below)
Now double-click on the message, to get the long text and the message details.
Now click on the technical information.
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”.
Enter the message details, as obtained earlier. Click on “Continue”. Continued...
Trigger Workflow from Messages ...Continued
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, let’s create a simple email step in our workflow definition. (To know about how to include an email step in the Workflow definition, click here)
Activate the Workflow definition. Testing the application Go to transaction ME21. Without entering any values, press ENTER. The error message “Enter Purchasing Org.” appears. Doubleclick on the message and the long text appears. See the screenshot below.
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.
Triggering Workflow using Business Transaction Events (BTE) What are Business Transaction Events?
The enhancement technique (Open FI) that were developed for Financial Accounting Component.
Open FI is based upon the following principles: o
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.
Basic steps in configuring the Business Transaction Events: Company A would like to fill the Assignment field with custom value ‘Demo BTE’ when an accounting document is posted for a certain Company Code for accounting purposes to analyze the data. To accomplish this requirement, Company A will use the Business Transaction Event 1120, Post Document: SAP Internal Field Substitution. Depending on the business scenarios, generally the reference document number field and assignment number field will be populated with a unique identifier for analyzing the accounting data. For the purpose of this document, I have used a scenario of populating the text field while creating accounting document.
IMG Menu Path: Financial Accounting ->Financial Accounting Global Settings-> Business Transaction Events-> Environment-> Infosystem (Processes).
Execute the search with the defaults.
Find the correct interface for updating the document.
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
Click on copy button.
Specify the function module name and the function group.
Now in the SE37 screen, click on change button and enter the following code:
Save and activate the function module
Go back to the first screen by multiple clicking on BACK.
Click here to continue...
Triggering Workflow using Business Transaction Events (BTE) ....Previous
To assign function module to the event, we need to create a product, say ZPRODUCT. Click as shown below:
Click on New entries.
Ensure that the Active check box is checked, otherwise BTE wouldn’t trigger.
Now we need to assign the function module created earlier to the event
Click as per the following screenshot:
Click on new entries and create the following entry for 00001120:
Test the BTE by creating a document through FB01 transaction.
To check whether the assignment field is filled with “Demo BTE”, display the created accounting document from FB03 and check for the Assignment value.
Double click on the item.
Triggering business object events: Update the Z function module that is created earlier by calling the function module SWE_EVENT_CREATE to trigger a business object event. Link this event to the workflow. To know about triggering an event programmatically, click here.
Triggering an event using Function Module Enhancement By Saumya Govil, Infosys
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.
Go to Application -> Opportunities -> IBPO Qualification
3.
Go to Extras -> Settings
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.
Go to SE37 and open the CRM_SVY_OPPORT_PAI function module.
5.
Go to Edit -> Enhancement Operations -> Show Implicit Enhancement Operations.
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.
Click here to continue....
Triggering an event using Function Module Enhancement ...Previous
6.
Click on the Enhance button
on the top of the FM.
7.
Go to the end of the FM and click on the yellow line. Now go to Edit -> Enhancement Operations -> Create Enhancement.
8.
Now you would get a popup. Select ‘Code’.
9.
Now enter the details of the new enhancement.
10.
A new enhancement would be created ad the following code would be added to the end of the FM.
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" "" A *$*$-Start: (2)------------------------------------------------------------------$*$*
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.
Save the Function Module. Associate the Z business object ZBO_TEST -> OQTSaved event as a triggering event of a workflow and do the required processing. (BO creation and event association with the workflow is out of scope of this document).
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.
Passing a hyperlink in a Work item By Sourav Roychowdhury, Capgemini India In this scenario, we will check how a hyperlink is passed in a work item text. It will appear as hyper link. When we click on the same, it will take you to the corresponding website. For the same we will prepare a simple Workflow for leave request. The workflow will have a user decision task step and following that email steps for confirming the approval/rejection of leave request. In the decision task text, the URL will be passed as hyper link.
After saving the WF, click the Builder button.
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.
Lets us now create the new decision task.
Click here to continue...
Passing a hyperlink in a Work item ...Previous Let us create a container element here for the hyperlink and then prepare the description. In description, remove the already existing text.
Here ‘HYEPERLINK’ is the task container element which contains the URL. Save the task and go back to the WF and complete the binding.
Activate the WF and it will finally look like this.
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.
The URL comes as hyperlink. Let us click on it and check.
Working with Business Objects in SAP By Swetabh Shukla, Infosys Business Object type contains methods, attributes and events which give a component based view of any Business Process. For example we have a Purchase Order business process. This process includes various small functionalities. It will have process of changing Purchase orders based upon requirements, functionality to retrieve the details of purchase order etc. Each of these functionalities is encapsulated inside a method. The method can call the function modules present in R3 system or can have there own code to execute some functionality. So if we consider Purchase Order as a Business Object then it will be identified by key field Purchase Order number. Each purchase order business object based upon key field purchase order number is different. It’s so because each purchase order is different and will contain different details. So the methods contain business functionality. Attributes are just like properties of the Business object. For example for any purchase order Purchasing Group, Purchasing Organization etc are attributes. Technically we can say that business object types are just like any template. At runtime we instantiate or create runtime objects for any BO (Business Object) type based upon the key fields we pass. Two runtime Business objects of same BO type are different from each other based upon the key fields we pass. So the key field is the differentiating factor for two or more runtime business objects of same BO type. To Browse for BO open tcode SWO2 (Path -> Tools ->ABAP Workbench->Overview->Business Object Browser).
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
Working with Business Object in our programs
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 = i_objkey = 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 INCLUDE . 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
Lets take an example to check what Container is
For example let’s 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.
Step 2 : Now create a method READ
Save the method. Now we will create the parameters of the method.
Import Parameters
PurchaseDocument
EKKO-EBELN
Export Parameter
ITEM
EKKO-EBELP (multi line)
PurchasingDocument will be a import parameter of type EKKO_EBELN. ITEM will be a export parameter of type EKKO_EBELP and will be a multi line variable(internal table )
Click here to continue...
Working with Business Objects in SAP ...Previous Save the method and then Click on the Program button to implement the method. In the method just read all ebeln (Purchase line items) corresponding to PO number into internal table ITEM and pass it on to container in the method. Check the snapshot below.
Check the whole code of the BO program here. ***** Implementation of object type ZSWE1 INCLUDE