Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
cancel
Showing results for 
Search instead for 
Did you mean: 
jayanthi_jayaraman
Active Contributor

Objective:

To trigger workflow based on certain condition from webdynpro. In this document, we are going to consider a scenario in which from Web Dynpro, Trip details are entered in database custom table and when the ticket count reaches 10 for a specific day, workflow will be triggered with the specific date details to the specified user.

Prerequisite:

  1. Basic Knowledge in Web Dynpro.

  2.    ZZZ_TRIP table as below

Procedure:

Step 1: Creating Object type in SWO1

Step 2: Building workflow using SWDD and linking

Step 3: Triggering workflow from webdynpro

Step 4: Executing the WebDynpro and Verifying the workflow in SBWP

Step 1: Create object type in SW01

First let us see how to create Object in SWO1 tcode. We need to assign it in appropriate Package.

Use Create button to create event and then click parameters button to create parameter for the event.

Make a note of the parameter which we require to pass from Web Dynpro. Then select the Event TRIGGER and then go to Edit->Object Type component->To implemented.

Now select the Event TRIGGER and then go to Edit->Object Type ->To implemented. Save the details when pop up appears.

Then select Edit->Object Type->To Released. Repeat the same for Object Type component as well.

Now generate the Object type ZZZ_JAY3.

Step 2: Building workflow using SWDD

Go to SWDD and then create workflow as below. Select Goto->Basic Data and enter details as mentioned below.

Go to Start Events tab and then enter the details as below and then save it in package. For doing the binding between SWO1 and container, we need specific parameter in Container.

Then double click to create the same.

Also select both import and export parameter in properties.

Now go to binding as below.

In Binding, drag and drop the parameter from event and workflow container element as below.

Then do syntax check and then activate it after saving it in package. And then go to step and select Send Mail.

Then in the User input mention the User who needs to receive mail and then use insert expression to insert the parameter from workflow container.

Now click control tab and then enter task name and save it package. Now we will get the task populated automatically. Click Binding(Exists) button to do binding. Check the binding appears automatically, if not use drag and drop.

Do syntax check and then click Steps in left pane and activate.

Go to tcode SWE2 and create linkage as below.

Step 3: Triggering workflow from webdynpro

Define Node as below in component controller. Design a view with values from table ZZZ_TRIP after defining the context with mapping.

Message Area is defined to pass the message if the total ticket count is greater than 10 for a day.

If total count is exactly 10 for a day, workflow will be triggered. Create an event for SUBMIT button in view and do as below.

Then define a method Check in component controller as below for checking the number of tickets.

Use code wizard for message and then put appropriate logic as required. If the exact count is 10, ‘F’ is passed in ot_flag.

Also write the code as below in Submit Method of component controller.

Step 4: Executing the WebDynpro and Verifying the workflow in SBWP

Once the details are entered, click the submit. After that workflow should reach the user’s inbox.

Once the tickets are booked(total 10 for a date) is booked, further entry for the same date will throw message in webdynpro screen.

References:

saptechnical

Labels in this area