cancel
Showing results for 
Search instead for 
Did you mean: 

Web Dynpro - Workflow integration

ameya_kulkarni3
Participant
0 Kudos

Hello,

Can someone please tell me what are the methods we can use for integrating Web Dynpro and Workflow. I have to create a custom Business Object for this purpose.

I have found out that we can use the FM 'SAP_WAPI_CREATE_EVENT' to trigger an event from the WD screen code. Please let me know if anyone has used the same and kindly share the experience.

Many thanks in advance.

Regards,

Ameya Kulkarni

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Ameya,

You are going to use any events to trigger your workflow?

if you need to trigger the workflow from web dynpro you can use the Function module SAP_WAPI_START_WORKFLOW.

In this FM just pass your workflow ID.

Also you can pass the data's from webdynpro to workflow using this function module.

After approval you can save the data's from the workflow.

Thanks,

Viji.

ameya_kulkarni3
Participant
0 Kudos

Hello Viji,

Thanks for replying. Yes I will be using a Custom WD screen,Custom Business Object,Custom Workflow and Custom events.

Once the event is triggered,a mail will be sent to the user who will receive the URL and will use the WD screen to make modifications and Accept/Reject the application.

Do u have any idea how I can achieve this using Business Objects and Custom events?

Former Member
0 Kudos

Hi,

Can you please provide more information?

Do you want to save the data and based on that you need to trigger the workflow?

Thanks,

Viji.

ameya_kulkarni3
Participant
0 Kudos

Hello,

There would be a Web Dynpro screen as front end ,which has several fields and a few buttons.The users would enter the data on the WD screen and press on submit. The data will be stored in a Custom table and a custom workflow event would be triggered.

The workflow would send the approval mail to the next person in the hierarchy with the WD component link.The Receiver would then Approve/Reject the request on the WD screen .Statuses would be updated on each stage indicating the level of the workflow.A Custom Business Object would be created which would integrate the Web Dynpro and Workflow.

I want information on the integration part mainly.

Please let me know if you require any further details.

ameya_kulkarni3
Participant
0 Kudos

Hello,

There would be a Web Dynpro screen as front end ,which has several fields and a few buttons.The users would enter the data on the WD screen and press on submit. The data will be stored in a Custom table and a custom workflow event would be triggered.

The workflow would send the approval mail to the next person in the hierarchy with the WD component link.The Receiver would then Approve/Reject the request on the WD screen .Statuses would be updated on each stage indicating the level of the workflow.A Custom Business Object would be created which would integrate the Web Dynpro and Workflow.

I want information on the integration part mainly.

Please let me know if you require any further details.

Regards,

Ameya Kulkarni

Former Member
0 Kudos

Hi Ameya ,

Just create a custom event in the business object.

Then in the webdynpro screen under submit button call the FM SAP_WAPI_EVENT_CREATE and pass your Business object and Event.

Also in the workflow template > basic data> you need to maintain the start event and activate it.

When ever the submit button clicked the FM will trigger the Event and the Event will trigger your workflow.

Thanks,

Viji.

Answers (1)

Answers (1)

vijy_mukunthan
Active Contributor
0 Kudos

Hi

The very important thing to integrate the WDA with workflow is task registration where you are sending work item to SAP inbox with url once the url is clicked the WDA page will open and where the user will take action. These are few guidlies i would suggest for your scenario:

1) If there are approval process then go for workflow if only simple mail sending with validation do go for workflow. Everything can be handled in your screen itslef.

2) If you want to determine the approver based on some validation then go for workflow ex. travel request based on employee group <= condition go for this level of approver else go for this level of approver.

3) For your scenario fellow this way.

a) Use FM SAP_WAPI_CREATE_EVENT OR SAP_WAPI_START_WORKFLOW but strictly advise to use event create FM rather than start workflow where you are hardcoding the workflow template no. So avoid it.

b) After triggering the workflow need to validate the condition use some custom FM or class to do this. Do Not write entier code in your method of BOR which will not be helful if you want to call that method somewhere other then your workflow you cannot call it. So always write the business logic in ZFM and call inside your method which will be robost.

c) To communicate the values from workflow and WDA use SAP_WAPI_WRITE_CONTAINER AND SAP_WAPI_READ_CONTAINER.

d) To determine the approver create new FM write the logic for approver. Usually we will create rule but for your case its not adviced you are calling WDA screen. In the task(activity) of the workflow in the express field pass the approver user id in the workflow container element which will send the workitem to the SAP inbox.

e) Once the workitem received the workitem to inbox once clicked it your WDA screen has to open for that need to do TASK regestration from SWFVISU t-code just check thsi its been long for me

f) After approving by clicking on approve button the send back the data if comments are there by using the above mentioned FM.

g) Then finally use send mail step to send mail.

For task registartion and data exchange from workflow and WDA see the blog for BSP the same requirement is done using the BSP. Check that which will give excat idea.

Regards

Vijay

ameya_kulkarni3
Participant
0 Kudos

Thanks a lot Viji and Vijay. Your answers have been very helpful.

I will try the solutions out and let you know if any problems. Many thanks again.

Regards,

Ameya Kulkarni

ameya_kulkarni3
Participant
0 Kudos

Hi,

Can you please let me know how to use the SAP_WAPI_WRITE_CONTAINER and SAP_WAPI_READ_CONTAINER. From where do we get the Workitem Id required?

And how do we receive the data in the workflow container.

Regards,

Ameya Kulkarni