cancel
Showing results for 
Search instead for 
Did you mean: 

How to switch the default priority of a Workflow to "1" and to then get the express-notification?

BaerbelWinkler
Active Contributor
0 Kudos

Hi Folks,

I'm still struggling with the implementation of a simple workflow/task to show a pop-up to a new developer to make her/him aware of our development guidelines.

In parallel to working on the issue detailed in another question - which I marked as answered as it works now, even though we haven't been able to really pinpoint the root-cause/difference between the sandbox and the dev-system yet - I was trying to find a way to change the workflow's or task's priority from the default value of "5" to "1" to make this an express delivery to the developer's inbox. The pop-up will only serve it's purpose if the developers get the prompt directly with their first or next action, otherwise it'll go unnoticed and linger forever in their business workspace.

I tried finding a solution but the search-results I got weren't helpful or not really about the topic at hand. So, I'm wondering: is there a simple option to update the default value shown in the container?

I already found a workaround to change the priority of the work-item with function module SAP_WAPI_CHANGE_WORKITEM_PRIO which I can call from my wrapper program after successfully creating the workitem via SAP_WAPI_START_WORKFLOW. This already works and is an acceptable option.

But, there's another snag:

Even though the workitem then has priority "1" the user doesn't get a prompt for the express workitem. I have a hunch that some field assignment for the username/agent is missing in the process but I can't pinpoint where and how to correct this.

Here are some clues:

The task gets triggered via the program with prio 1 and immediately shows up as "Ready" in my business workspace inbox

My expectation had been that I'd first get a prompt to alert me of this item but I didn't get it.

When I run my wrapper program again with the option to list the latest available work item for my user via FM SAP_WAPI_WORKITEMS_BY_TASK this last one does not show up but the previous one which I had already clicked on once and which has status "Executed" at the moment.

When I go to SWI1 to look for the work-item in READY-status, I get this information, where the column for Agent shows "No current Processor":

I don't quite understand why the Agent is empty but the system still makes it show up in my inbox - so it has to know who this is intended for (I guess?).

Once I click on the item from my inbox and just close the pop-up again, it shows status "COMMITTED" and then has my name in the Agent column:

And when I then open the item yet again to click on the "Commit" button, the item shows up as COMPLETED:

So, my questions are:

  1. Should the "Agent" already be filled while the item is in status "READY"?
    Update May 17: thanks to Rob's response, I now understand why the agent is empty
  2. If the answer is "Yes" how do I get it to be filled and will that then also prompt the express-notification for the user?
    Update May 17: thanks to Rob's response, I now know where to set the priority. Unfortunately, this only works when I test this via SWDD but not when I create the work-item via my wrapper-program.
  3. If the answer is "No" how do I get the express-notification in front of the developer's face?
    Update May 17: I'm still not able to get the "Express notification pop-up" displayed even when a priority "1" workitem is waiting with status "Ready" in a user's inbox. This is actually the crucial part of this implementation. Without this notification working properly, it won't make much sense to role it out.

Please let me know which information from the workflow and task definition is also needed to find where something might be missing and I'll add some screenshots in the comments. At the moment I don't really know where to look and what to look for so would just add unneccessary clutter to this already (too?) long question.

Thanks much and Cheers

Baerbel

Accepted Solutions (1)

Accepted Solutions (1)

BaerbelWinkler
Active Contributor
0 Kudos

After some more trial and error and thanks to the clarifying information provided by rob.dielemans and mike.pokraka I now have a solution to my question.

Most of the logic happens in my wrapper-program which does the following:

  1. Select user(s) based on selection-screen input with FM BAPI_USER_GETLIST
    Next steps are done within a loop for the selected users
  2. Determine who actually has S_DEVELOP with FM SUSR_USER_AUTH_FOR_OBJ_GET and only proceed for those that do
  3. Fill the relevant data and trigger the task with FM SAP_WAPI_START_WORKFLOW
  4. If the task was triggered successfully, change the newly created task's priority to "1" (express) with FM SAP_WAPI_CHANGE_WORKITEM_PRIO (just setting the status in the workflow/task definition doesn't seem to be enough)
  5. If that also worked, trigger a short internal express message to the developer via methods in CL_BCS to alert her/him about the new work item waiting to be processed in the SAP Business Workplace. I found this class via an old discussion thread which mentioned example programs being available for how to utilise it. Program BCS_EXAMPLE_3 had the applicable code which I only needed to slightly modify and drop into a method in my program.
  6. The result of steps 3 to 5 gets reported in a concatenated message field in an ALV-list
  7. As an alternative to steps 3 to 6, the program can also just list the status of the latest work item for the selected user(s) via FM SAP_WAPI_WORKITEMS_BY_TASK

Bottom line: this turned out to be more involved than I had first thought but it also gave me the opportunity to dabble a bit with SAP workflow and a bit more with ABAP-OO logic. It may not be the most straightforward solution to the requirement I wanted to tackle but as long as it works I can live with that!

Thanks again and cheers

Baerbel

BaerbelWinkler
Active Contributor
0 Kudos

Upon further testing, I hit another snag - and it may just be due to by ignorance about most things Workflow .....

I triggered 3 workitems - 1 for me and 1 each for two colleagues - via my wrapper program which got created as expected:

But, when I then go into my SBWP-inbox I find all three of them there - my expectation had been that I'd just see mine and my colleagues each see also just their own but they also see all three:

When I check the logs for them, I see that the container has the correct user-ID in the ACTUAL_AGENT field for each of them.

So, why are we all seeing all three work items and not just the expected one?

If I just create one work item for one of my colleagues, I also see it in my inbox.

Is this expected behaviour and if yes, can I avoid it and how? Each work item should always just end up in one inbox. At the moment, I don't know if I have to look in SWDD or in my wrapper program for the reason of why it happens the way it does.

Does anybody have some clues of where to look and how to fix this?

Thanks & Cheers

Baerbel

pokrakam
Active Contributor
0 Kudos

We've veered far off the topic of this question, but how are you assigning the agents?

You should start the WF with an ID in a container element, which you then enter as the agent in the step definition. The ACTUAL_AGENT only gets filled on task completion and will contain the ID who actually executed it.

BaerbelWinkler
Active Contributor
0 Kudos

Hi Mike,

regarding off-topic: I actually was debating with myself whether or not to create yet another question for this but then went with using this already existing one as it seemed "related enoough". If you think it's better to have this latest issue I'm running into as a separate question I can create a new thread and add some more screenshots and context to it.

Update: some more trial and error makes it look as if this is related to the task being defined as a general task (the workitems are also visible in colleagues' inboxes who I don't trigger it for) and that the expression to determine the actual user doesn't do what I think it should do. So, if this is "worthy" of its own question, I'll create one - I'm still hoping that there's an easy solution for this, though.

pokrakam
Active Contributor

Hi Bärbel,

While it's related within your application, I think as topics go, priority and receiver are pretty different 🙂

WF is not usually as difficult as you're encountering, really 🙂

Post the piece of code and how you route the item and we can try to help.

BaerbelWinkler
Active Contributor
0 Kudos

Thanks for your patience, Mike!

I created another thread with lots of screenshots:

How to have a general task workitem only show up in one specific user's inbox?

Answers (2)

Answers (2)

former_member186746
Active Contributor

Hi Bärbel,

1. agent is empty because it has not yet been executed by an agent. Through SWIA, or substitution the actual agent of a workitem can be different than the one assigned initially.

3. maybe some setting in the system.What happens when you create an express message (system-->short message) to a user. If this does not create the popup then it is some office setting.

You can change the prio of any step in the workflow in the workflow developer, just double click the workflow step, then go to the second last tab - Miscellaneous and change the prio to 1.

Kind regards and have fun in your workflow endeavours!

Rob Dielemans

BaerbelWinkler
Active Contributor
0 Kudos

Thanks, Rob!

Ah, okay, now I understand why the agent is empty at first.

When I create an express message directly and send it to myself the notification pop-up gets displayed as expected.

I changed the step-priority for the task to 1:

When I then test the workflow from within SWDD, the priority gets set to "1" but the pop-up doesn't get shown. When I create the task via the FM in my wrapper program this setting seems to be ignored as the work item gets created with priority "5". I already executed SWU_OBUF and also exited and re-entered SE80 to run the program but to no avail. The FM doesn't seem to have a means to influence the task's priority so I'm wondering if I'm still missing some piece of the puzzle.

Oh, and not sure if "fun" is the operable word here!

Cheers

Baerbel

BaerbelWinkler
Active Contributor
0 Kudos

I'm still struggling with some stuff I don't understand and don't seem to get to work. These are:

  1. Setting the priority of the work-item to "1" via the defined Step Priority only seems to work when I test the Workflow via SWDD
  2. When I create the work-item via my wrapper program and SAP_WAPI_WORKITEMS_BY_TASK the priority stays at the default "5"
  3. I can change the priority of the newly created work item to "1" via SAP_WAPI_CHANGE_WORKITEM_PRIO in my wrapper program
  4. Even if the work items end up with priority "1" the recipient isn't prompted by an express message to access her/his inbox which renders this whole exercise rather pointless as the sole purpose is to get the information in front of new developers to increase the chances of them reading our development guidelines.

My initial expectation had been that the complete work-item text with the link to the guidelines would get "shoved" into the developer's face upon first login or next activity in the system but this - if I'm not missing something - won't be happening. So, at least the pop-up about an express document waiting in the inbox should get displayed.

How can I get this to work?

Cheers

Baerbel

pokrakam
Active Contributor

The express notification is not a part of workflow, but a SAPOffice function. It can be enabled/configured in SO16, tab User, box User Notifications.

Either way I would not consider this an ideal primary notification, an email to their main address as a first step would be better - but by all means keep the priority 1 as backup. Popups come and go, even if it works, people don't always read them.

As an alternative: are you using extended notifications for your other workflows? If so, just include this task and an email will be generated automatically, with a link to the task. Talk to your WF people.

BaerbelWinkler
Active Contributor

Thanks, Mike!

I somehow thought that the express notification also automatically works with workflow as both WF- and SAPOffice notifications end up in the same "bin", namely the SAP Business Workplace.

With the setup we have, emailing the developers a notification will not work in most cases as that email will just end up in an inbox they will not (yet) know anything about and will therefore not check. My targets for this messaging are mostly external developers who come and go so they won't have internal email-accounts linked to their SAP-user. I therefore have to find a solution to get this information in front of them when they access one of our SAP development systems. I think I'll look for a means to in addition to triggering the work-item from my wrapper program to also send an express messsage to their SAP-user to make sure they check their SAP-inbox.

Cheers

Baerbel

pokrakam
Active Contributor

Yes you thought correctly. The express notification is just a popup that there is something in your business workplace.

One could start discussing whether outsourcing really is cheaper, but let's not go there.

It is generally good practice to maintain a valid email address in the user master, even (or especially!) for externals. I guess this is not the case?

BaerbelWinkler
Active Contributor
0 Kudos

It's a bit of a catch-22: even if external developers have their external company address in their user-settings (which is not necessarily the case for all of them), they'll not get emails from the dev-system as that - AFAIK - only allows sending to internal domains (a setting which makes sense to avoid accidentally sending test-output to actual business partners). And, if the email-address goes to an internal address, the external developers/consultants won't be checking that particular account with any regularity. Sending email notifications would be possible from the prod-system but most of the external developers do not get access to that.

Bottom line: I don't see an alternative to poke the developers right within our SAP-development systems.

pokrakam
Active Contributor
0 Kudos

You could (should?) enable your integration partners' domains.

But the express notification is a good backup. You still didn't say whether it was switched on in SO16? Maybe someone disabled it because too many of them were generated.

BaerbelWinkler
Active Contributor
0 Kudos

Thanks, Mike.

Yes, (express) notifications are enabled and work.

I was actually writing a longer answer below while you put up your latest comment. I figured out a way to do this and describe the basics there.