Skip to Content
0
May 28, 2018 at 10:51 AM

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

690 Views

As all good things come in threes (or so I'm told!) here is a third question related to a simple workflow I'm trying and having a hart time to implement. The earlier questions were "How to identify what the actual error is when a new workflow doesn't work when tested in SWDD?" and "How to switch the default priority of a Workflow to "1" and to then get the express-notification?"

The gist of what I set up is available here and it almost does what I'd like it to do. But one issue is basically a showstopper because each created workitem is not just visible in the intended recipient's inbox but in everybody's:

So User 1 sees all four of them as does User 2 and even User 3 who I didn't even trigger the work item for gets to see them as well and could potentially process them.

As this mini-Workflow is intended to get new developers to actually look at our development guidelines and then "sign off" by using the "Confirm task" button, it needs to go to exactly the developer it's intended for, anything else doesn't make much sense.

As outlined in the workflow book's chapter, I defined the task as general:

Reading up on "general tasks" in the book, I get why this then causes the workitem to show up in everybody's inbox, but I thought that the expression in the task definition should take care of that:

The code for ZCL_USER is copied from the information provided in the Workflow book. To not make this post too long, I put it into the attached txt-file:

utility-wf-user-determination-zcl-user.txt

In my wrapper-program I trigger the work item creation via FM SAP_WAPI_START_WORKFLOW and already tried with either just the user-ID or with it prefixed by "US" but the result is the same:

    clear lt_container_simple.

    ls_container_simple-element = 'ACTUAL_AGENT'.
    CONCATENATE 'US'
                i_agent
           INTO ls_container_simple-value.
*    ls_container_simple-value   = i_agent.
    APPEND ls_container_simple TO lt_container_simple.

    ls_container_simple-element = 'USER'.
    CONCATENATE 'US'
                i_agent
           INTO ls_container_simple-value.
*    ls_container_simple-value   = i_agent.
    APPEND ls_container_simple TO lt_container_simple.

    CALL FUNCTION 'SAP_WAPI_START_WORKFLOW'
      EXPORTING
        task            = p_task
        language        = sy-langu
        do_commit       = abap_true
        user            = sy-uname
      IMPORTING
        return_code     = lv_returncode_wfl
        workitem_id     = lv_workitem_id
        new_status      = lv_new_status
      TABLES
        input_container = lt_container_simple
        message_lines   = lt_messages_wfl.

The result looks okay judging what my wrapper program tells me (I switch the prio of the work item to 1 and also trigger an express message):

The container information of the work items look okay as each shows the expected user-IDs in the relevant fields:

I have both container elements filled in the binding via the same expression (one of my trials was to actually add a line for USER even though this isn't mentioned in the book - it didn't seem to have a negative effect but it also didn't solve my issue)

So, what am I still missing?

Thanks much and Cheers

Baerbel