Skip to Content

Change &_WF_INITIATOR& at runtime

Hello Experts,

I have a requirement where I have to determine &_WF_INITIATOR& at runtime. Is it possible to set the &_WF_INITIATOR& at the beginning ?

This may sound a bit odd. You may ask me "Why on earth you're changing the &_WF_INITIATOR& ?"

The requirement goes like this. If the Initiator of the workflow has left the company, a replacement initiator would be maintained in some table. This replacement would behave as the new initiator.

Regards,

Kiran

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

4 Answers

  • Best Answer
    Posted on Jul 18, 2016 at 10:28 PM

    My not simply use substitution? no need to change the workflow, and all workitems which belong to the user who left are immediately shown in the new user's business workplace. any new workitem which will be crated for the user who left will also be seen.

    https://help.sap.com/saphelp_nw70ehp2/helpdata/en/8d/25f558454311d189430000e829fbbd/content.htm

    You can set the substitution for other users in transaction RMPS_SET_SUBSTITUTE.

    Add a comment
    10|10000 characters needed characters exceeded

    • Hi Ronen,

      That's a good option. My workflow container &_WF_INITIATOR& has my USER ID as USJKK. (I am not sure why it has US appended to my UID.)

      Now, if the substitute has been maintained as JMM for my User ID which is JKK, will the substitute be the new initiator ?

      Regards,

      Kiran

  • Posted on Jul 19, 2016 at 08:34 AM

    Hi,

    Usually you just use substitution when someone has left the company. In some cases where you need to redirect workitems you can also use SWIA to use an administrator forward (Shift+F12) to make sure that work continues.

    You can use transaction SWI2_ADM1 to find out if workitems exist without an agent.

    Kind regards, Rob Dielemans

    Add a comment
    10|10000 characters needed characters exceeded

    • Hi Rob,

      Thanks for the explanation. I have interactions like user decisions. That will solve the problem.

      I am sending a reminder mails based on the Initiator. I am getting the initiator's mail ID.

      Now, in this case if the substitute is maintained, will the mail reach to substitute?

      Thanks,

      Kiran

  • Posted on Jul 18, 2016 at 02:13 PM

    To determine &_WF_INITIATOR& use below logic

    Call FM SAP_WAPI_WORKITEMS_TO_OBJECT for particular BO & Object Key

    Then find your relative Workflow Id and do below

    CALL FUNCTION 'SAP_WAPI_READ_CONTAINER'

    EXPORTING

    WORKITEM_ID = L_WI_ID

    TABLES

    SIMPLE_CONTAINER = LT_CONTAINER

    EXCEPTIONS

    OTHERS = 1.

    READ TABLE LT_CONTAINER WITH KEY ELEMENT = '_WI_OBJECT_ID'.

    IF SY-SUBRC EQ 0.

    MOVE LT_CONTAINER-VALUE TO LS_POR.

    SELECT SINGLE * FROM SWXFORMABS

    WHERE FORMNUMBER = LS_POR-OBJKEY.

    IF SY-SUBRC EQ 0.

    SWXFORMABS-PROCSTATE = L_INPUT.

    IF SY-SUBRC EQ 0.

    EXPORT L_PREPROCESSED TO MEMORY ID 'PREPROC'.

    L_OKAY = 'X'.

    ENDIF.

    ENDIF.

    ENDIF

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jul 20, 2016 at 12:53 PM

    Hello All,

    I solved this by creating a new task. This will fetch the workflow initiator name stored in some Z-Table.

    I am filling a container similar to Initiator and using this wherever the agent is Initiator.

    Rob Dielemans and Ronen Weisz, thanks for sharing the info on using substitutes. I would definitely try that in future.

    Thanks,

    Kiran

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.