Skip to Content

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

WD_WF1.JPG

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.WD_WF2.JPG

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

WD_WF3.JPG

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.

WD_WF4.JPG

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.

WD_WF5.JPG

Then double click to create the same.

WD_WF6.JPG

Also select both import and export parameter in properties.

WD_WF7.JPG

Now go to binding as below.

WD_WF8.JPG

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

WD_WF9.JPG

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

WD_WF10.JPG

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.

WD_WF11.JPG

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.

WD_WF12.JPG

WD_WF13.JPG

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

WD_WF14.JPG

Go to tcode SWE2 and create linkage as below.

Linkage_activation.JPG

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.

WD_WF15.JPG

WD_WF16.JPG

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.

WD_WF17.JPG

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

WD_WF18.JPG

WD_WF19.JPG

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

WD_WF20.JPG

WD_WF21.JPG

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.

WD_WF22.JPG

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

WD_WF23.JPG

References:

saptechnical

To report this post you need to login first.

Be the first to leave a comment

You must be Logged on to comment or reply to a post.

Leave a Reply