cancel
Showing results for 
Search instead for 
Did you mean: 

Provide the url in mail step of workflow to launch dynamic view of webdynpro application

Former Member
0 Kudos

Hi all

I have come up with a requirement where in the link to the webdynpro application needs to be passed in the mail step of workflow.

The webdynpro application provides the agent the interface where in he can assign some options of a user id and on clicking submit custom table updates are performed.

Please could you provide with the best way it could be achieved have thought of couple of options but facing challenge in the same.

Options tried / thought of are as below:

1.SWFVISU - But this will directly launch webdynpro application we want only mail to go to agent and then when he clicks the link the webdynpro to launch. The details to launch the webdynpro can be fetched to mail id.

2. Mail step : we can pass the workitem id which could help launch webdynpro on link click and allow user to perform operation but then as soon as mail is sent, the step will get completed and also the workflow we need to only allow the agent to take action within 30 days and also restrict user performing changes once he submits.

For deadline monitoring :

1. Thought of using decision step but decision will halt workflow processing so how can the workitem id of decision be passed to mail step?

Sugestions/solution invited. Its a bit urgent so will quick response will be appreciated

Please let me know if further details are needed.

Accepted Solutions (1)

Accepted Solutions (1)

SandySingh
Active Contributor
0 Kudos

Hello Sakshi,

Since the webdynpro application needs to be executed by the user, it makes a lot of sense to make this activity as 'User Decision Step' . You can call the webdynpro application with SWFVISU settings. You can create custom events - TABLE_UPDATED under the WF BOR or Class object and use this as terminating event for user decision step. You can fire this event in Webdynpro application once the table is updated.

If you think that user decision would halt the workflow processing, then you can use a fork in the workflow and do parallel processing. Normal workflow process will run under branch 1 and Webdynpro approval step will be called in branch 2. You can also create a 30 day modelled deadline escalation on this Webdynpro approval step and cancel the work item so that both branches or fork are completed and the main workflow is completed.

Sending mail to user for this activity would have following issues:

  • This activity would be outside the on-going workflow process and no interaction with current workflow instance
  • Single sign on issue. Once the link is invoked from Outlook mail,User will have to sign on to SAP.
  • It is not possible to terminate the activity after 30 days.

Regards

Sandy

Answers (7)

Answers (7)

Former Member
0 Kudos

Hi all,

Thank you for your responses.I am working on it will mark/update the correct answer and also will share the approach implemented may be by next week.

In the meantime if you come up with any other approach please do share.

pokrakam
Active Contributor
0 Kudos

You could create a custom message generator for Extended Notifications. Just copy the standard one and add a line with your URL in there. The bonus here is that you'll get a nicely formatted HTML mail.

Getting the URL has already been described in this thread, all you need is to append an additional parameter. This can be done by adding appropriate Name-Value pairs into the URL generator method.

Be aware that the approach of passing the ID in the URL is insecure. Anyone with a moderate amount of savvy can see it in the URL bar and try to launch other items that they may not be agents for. Thus you should always validate the user is an actual agent of the task.

Regards,

Mike

Former Member
0 Kudos

Hi all

Sorry for the confusion :

rephrasing my last comment :

"

The step will be an activity step with task as copy of standard user decision task.Can i make use of Program exit in workflow step to send mail as i need to pass the webdynpro application link in mail to the person from whom action is needed?

Along with dynproapplication link will have to pass workitem id of the activity as its needed to validate and intialise the view using values from the task container and secondly to check if action has already been taken by user or no

Wanted to confirm  :

1. if this appoach works fine with UWL as well.

2. Also can i read the contents of the container as the mail that needs to be sent need to take some contents from workflow container.

"

The details of the requirement is a bit extensive so will try to explain in brief.

you are right i need to pass workitem id as parameter

User decision is needed so that i can halt the workflow completion i am trying to avoid using the wait step.

Will be passing the workitem id of the user decision step (made a copy of Stnd decision decision task ).as parameter in the webdynpro application url.

When user route to application :

1. After action is complete then will complete the workitem of decision using standard FMs available.

2. If user again clicks on the link then in default start event will place a logic which will look at the status of work item id it receives as parameter if its executed it will display message that 'action is already performed'.

Today i tried having program exit in the activity whose task is a copy of user decision step task so was able to pass the workitem id in the url generated in the mail.

Mail sending logic was placed in exit and was able to prepare the URL of webdynpro application along with parameters.

So wanted to confirm if its fine to go with this approach ?

Also would like to mention , really appreciate you all for your quick responses.

SandySingh
Active Contributor
0 Kudos

Hello Sakshi,

I wont recommend use of programming exit. You are making the design bit complex.

If you are finding it difficult to link a webdynpro to User decision task then refer to document link below

http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/70648e99-4cc1-2c10-879d-9c61003c6...


Still I would recommend using User Decision task with 30 day deadline in parallel processing with main approval activity. Refer to my 1st post

Since the webdynpro application needs to be executed by the user, it makes a lot of sense to make this activity as 'User Decision Step' . You can call the webdynpro application with SWFVISU settings. You can create custom events - TABLE_UPDATED under the WF BOR or Class object and use this as terminating event for user decision step. You can fire this event in Webdynpro application once the table is updated.

If you think that user decision would halt the workflow processing, then you can use a fork in the workflow and do parallel processing. Normal workflow process will run under branch 1 and Webdynpro approval step will be called in branch 2. You can also create a 30 day modelled deadline escalation on this Webdynpro approval step and cancel the work item so that both branches or fork are completed and the main workflow is completed.

Example – Implementing Parallel Processing in Workflow using a Fork – Step by Step Tutorial

Usage of Step type Fork

Sending mail to user for this activity would have following issues:

  • This activity would be outside the on-going workflow process and no interaction with current workflow instance
  • Single sign on issue. Once the link is invoked from Outlook mail,User will have to sign on to SAP.
  • It is not possible to terminate the activity after 30 days.

Regards

Sandy

Former Member
0 Kudos

OK, now I see where you are coming from. You got me confused when you said that you want to create a user decision step from the programming exit.

First of all, I think that using the user decision step is wrong approach. What are the decisions options? Who is the agent of this step? If the task is meant to be executed from email, then you should not have a user decision waiting for anyone's inbox. Otherwise someone could go to complete the task without actually launching the web dynpro and doing the needed stuff for the custom table(s). Yes, you can possible hide the task or you can send it to some dummy user or whatever, but this is just workaround for something that could easily be done in a "correct" way.

I am not saying that you should use the wait step. Just create a dummy method (take a look to CL_PT_REQ_WF_ATTRIBS->DUMMY for reference). Create a task for it. Put this into your workflow instead of the user decision. You can even send this task to the correct agents. If they happen to click it, they will just get a message saying whatever you want ("Please execute this from your email").  Or what could be even better is that now you can configure this task to work in UWL (with the help of SWFVISU) if you are using it. IF the user clicked the work item from UWL, it would open the web dynpro application (work item ID can be given as parameter easily).

Sending the email from programming exit: Maybe not the best possible approach, but if you did it already, it is not plain wrong either from my point of view. It can be a bit of a problem, if your application needs the work item ID as a parameter. Then you just cannot use the standard email step (without using some kind of trick for example by using two parallel branches in the WF template (with fork step). In general when developing a solution, I would try to avoid using work item ID as a parameter for an application. Most probably there is always a better "key" on the application - the key field(s) of the table.

Kind regards,

Karri

Former Member
0 Kudos

Hi Karri,

Thank you for the suggestion of referring CL_PT_REQ_WF_ATTRIBS->DUMMY.

Now one more query it can be a silly one - but how can i hold the work item or control completing work item only after appropriate action is taken by user in webdynpro application.

Yes i agree key should ideally be passed but the design is such that there is no provision for key.There will be a report run which will determine the list of users along with action details whom the action items need to be sent.

Action is to be performed is on the webdynpro application it could be creating new records in table or de-limiting exisiting ones.

Regards

Sakshi Sawhney

Former Member
0 Kudos

>Now one more query it can be a silly one - but how can i hold the work item or control completing work item only after appropriate action is taken by user in webdynpro applicatio

You could take a look to leave request workflow template WS12300111 and its step "Approval process". This one uses the method I was talking about. If you don't select the "background processing" option for the task, then the task will "stop" in the users inbox. If you add the error message thing to the method, then it cannot be executed/completed from business workplace by just clicking the work item.


You can just call for example SAP_WAPI_COMPLETE_WORKITEM from your application, and this will complete the work item, so the control will be in your WD application.

Regards,

Karri

Former Member
0 Kudos

Hi Sandy,

Here my mail sending step is linked with the user decision step/ or any activity step used to halt the workfow as i need to pass the workitem id of that activity in url which i provide the receipient of the mail.

In fork i may not be able to get the workitem id of task all the time.

I am unable to open the link:

http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/70648e99-4cc1-2c10-879d-9c61003c6...

Former Member
0 Kudos

Hi all,

Can i make use of workitem exit it will generate a decision step and at the same time will also we can get the work item id ?

Wanted to confirm  :

1. if this appoach works fine with UWL as well.

2. Also can i read the contents of the container as the mail that needs to be sent need to take some contents from workflow container.

Former Member
0 Kudos

Can you please give a detailed explanation of what you are tying to achieve? Why do you need to use a decision step?

I am quite sure that there is no need to use programming exit - or at least it should not be used for creating a user decision. That sound absolutely wrong.

Do you need the work item ID for the web dynpro application (to give it as a parameter)?

Regards,

Karri

SandySingh
Active Contributor
0 Kudos

Hello Sakshi,


Looks like you are mixing two things: Do you need a email step OR  Do you need a decision step for webdynpro application execution.


Refer to my last post for decision step for webdynpro application execution.


Karri explained a way to use email step for webdynpro application execution.


Regards

Sandy

Former Member
0 Kudos

Hi,

If I understand you correctly, from my point of view the best approach would be something like this:

1) Put a email sending step to workflow. In the email text you should have the URL to your web dynpro application, right? You can construct the URL dynamically with method cl_wd_utilities=>construct_wd_url. This parts should be then clear.

2) Put some kind of "wait for" step just after the email sending step. The best option would be to put a "wait for event" step. The workflow will stop into the step and start waiting. Now I don't know if your solution is based on an object/events, so I am not sure if you can use the "wait for event" step, If not, you could perhaps use "wait for condition" (=wait a value in a WF container to change).

3) You possibly need do small changes to the your web dynpro component. Its job will be to fulfill the "wait for" condition. So basically when the custom tables would be updated, you would e.g. trigger an event (function SAP_WAPI_CREATE_EVENT), which the workflow would be waiting, and then the workflow would continue.

Deadline: You can set the deadline for the "wait for" step. If the waiting condition would not be met in 30 days, you could do whatever you want with the modeled deadline.

Restrict user from doing changes after submit: You need to build this into your web dynpro application & Z-tables. For example when the user clicks the submit and the tables get updated, you could update some kind of status table in the table (status=submitted). Then you need to build a check in the web dynpro component, which checks whether the table is already submitted, and if yes, then you would raise an error or whatever. This is important, because the user will have the email even after submitting, and he can click the link over and over again, and thus make changes, if you do not build some kind of status check or whatever.

Kind regards,

Karri

Former Member
0 Kudos

Hi Karri,

As per point 1 , cl_wd_utilities=>construct_wd_url will generate URL but how will i be able to pass the Work item id of the user decision step?

As i plan controlling 30 day deadline monitoring as well as checking if the action is already taken or no from that work item id.

Former Member
0 Kudos

For what do you need the user decision step? I didn't mention user decision step at all. I thought that you just need to send an email with a link to a web dynpro application.

Regards,

Karri

Former Member
0 Kudos

Hi Karri,

The details of the requirement is a bit extensive so will try to explain in brief.

User decision is needed so that i can halt the workflow completion i am trying to avoid using the wait step.

Will be passing the workitem id of the user decision step (made a copy of Stnd decision decision task ).as parameter in the webdynpro application url.

When user route to application :

1. After action is complete then will complete the workitem of decision using standard FMs available.

2. If user again clicks on the link then in default start event will place a logic which will look at the status of work item id it receives as parameter if its executed it will display message that 'action is already performed'.

Today i tried having program exit in the activity whose task is a copy of user decision step task so was able to pass the workitem id in the url generated in the mail.

Mail sending logic was placed in exit and was able to prepare the URL of webdynpro application along with parameters.

So wanted to confirm if its fine to go with this approach ?

ronen_weisz
Active Contributor
0 Kudos

If you want to send a mail with html tags (the link to your webdynpro application) you can use class cl_bcs see for example Send email from ABAP with class CL_BCS - Code Gallery - SCN Wiki use it in a method of the workflow object/class and call it as an activity task.

You can still maintain other texts (without html) in the workflow task if you wish and read them using the sap_wapi_workitem_description FM. 

Former Member
0 Kudos

Hi,

just a suggestion:

send mail with the web dynpro information, after that, make a step wait for workflow event.

When your Web Dynpro Application is finished, fire the event and the workflow will continue.

I think i implemented something similar before, but don't remember completely...

hope that hint helps you.

regards

Alex

Former Member
0 Kudos

Hi Alexander,

How can i monitor 30 day deadline with this approach then ?

Former Member
0 Kudos

As Karri said:

Deadline: You can set the deadline for the "wait for" step. If the waiting condition would not be met in 30 days, you could do whatever you want with the modeled deadline.

regards

Alex