13 Replies Latest reply: Jan 31, 2012 11:05 PM by Rick Bakker RSS

Agents of a completed workitem.

Karthik Vidupankal
Currently Being Moderated

Hi experts,

 

If i have to find the agents of workitem I can get it from SAP_WAPI_GET_WI_AGENTS. But when the workitem is completed this fm does give me the resposible agents since its a runtime one.

 

I want to find who all were the responsible agents of a workitem which has been completed considering passive substitutions also.

 

Your hep is appreciated.

 

Regards,

Karthik

  • Re: Agents of a completed workitem.
    Susan Keohan
    Currently Being Moderated

    Hi Karthik,

     

    Unfortunately, I don't know of any one place where you can get this info. 

    Typically, I tend to retrieve my agents and store them in the container prior to delivering the task - which allows you to drill into the workflow log to gather the list of agents after workitem execution.  Then you'd need to take those users and see who substitutes for them, whether it's via HRUS_D2 or position substitutes.

    At any rate, I suspect what you are asking is not a one-off question, but a more systematic approach, and for that, you'd need to write your own report, based on your particular workflows and substitution methods.

    hth,

    Sue

    • Re: Agents of a completed workitem.
      Rick Bakker
      Currently Being Moderated

      Hello,

       

      "Typically, I tend to retrieve my agents and store them in the container prior to delivering the task "

       

      That's what I do too. SAP has enough tables, no need for any more custom ones!

       

      regards

      Rick Bakker

      hanabi technology

      • Re: Agents of a completed workitem.
        Karthik Vidupankal
        Currently Being Moderated

        HI All,

         

        I am thinking like: When the workitem(user decision) is created and in READY status I will pass this workitem id to SAP_WAPI_GET_WI_AGENTS fm and get the agents (including passive) and store it in a Ztable.

         

        But exactly where do I put this piece of code after writing it in a BOR method, can i do in user decision step or suggest me if anythign else.

         

        Regards,

        Karthik

        • Re: Agents of a completed workitem.
          ANIK SIRCAR
          Currently Being Moderated

          Hi Karthik,

           

          "Typically, I tend to retrieve my agents and store them in the container prior to delivering the task "

           

          Just before delivering the task you can add another activity with a method in it to save the Agents in the container into a Z Table. (If at all you want to save them in a Z table).

        • Re: Agents of a completed workitem.
          Rick Bakker
          Currently Being Moderated

          Hello,

           

          No need for SAP_WAPI_GET_WI_AGENTS. No need for custom tables.

          Create a method to deduce the agents given the information that is present in the workflow when it is being run, just before it gets to the workitem. Use that method to store that list of agents in the workflow container. Done.

           

          regards

          Rick Bakker

          hanabi technology

          • Re: Agents of a completed workitem.
            Karthik Vidupankal
            Currently Being Moderated

            Hi Rick,

             

            In that case I cannot get the substitutes, I even have to get the active and passive subsitutes.

             

            Regards,

            Karthik

            • Re: Agents of a completed workitem.
              Karthik Vidupankal
              Currently Being Moderated

              Hi All,

               

              I even tried a program exit with SAP_WAPI_GET_WI_AGENTS fm, but it was not giving the agents at the right time I wanted.

               

              AFTER_CREATION method cannot give any agents and rest of them will give the agent only when the agent starts processing the workitem.

               

              I want the agents info when the workitem is in READY state and no action is taken by agent.

               

              Regards,

              Karthik

              • Re: Agents of a completed workitem.
                Rick Bakker
                Currently Being Moderated

                Hello,

                 

                Then you will have to figure out how the active and passive substitutes are determined and run the same code yourself.

                 

                An alternative could be to have the workitem in a 2-from-2 fork and in the other branch you run an fm which fetches the agents from the workitem. SAP_WAPI_GET_AGENTS, perhaps? You'd have to get the timing right.

                 

                regards

                Rick Bakker

                hanabi technology

            • Re: Agents of a completed workitem.
              Karri Kemppi
              Currently Being Moderated

              >In that case I cannot get the substitutes, I even have to get the active and passive subsitutes.

               

              Have for example another method to get the substitutes from the substitution table (read them from the table directly or check if you can use some SAP_WAPISUBSfunction). Put them to another container element, or whatever.

               

              But just remember (like I said in my previous answer) if you just get the agents (+substitutions) during the work item creation, and store them somewhere, this will not be absolutely accurate data. The substitutions can change, etc. between the work item is created and when it is completed.

               

              Regards,

              Karri

              • Re: Agents of a completed workitem.
                Karthik Vidupankal
                Currently Being Moderated

                Hi Karri,

                 

                It will be enough for me if i can get the agents immediately after workitem creation and store - workitem id, agents in a Ztable.

                I have different logic if the workitem is forwarded or when agents change.

                 

                But how do I get these 2 : workitem id and agents just after the creation of workitem.

                 

                Regards,

                Karthik

                • Re: Agents of a completed workitem.
                  Imthiaz Ahmed
                  Currently Being Moderated

                  Karthik,

                    Look at this problem in a different angle. The agents are manipulated using a specific logic prior to Workitem creation right, use the same logic. Just make sure if the WI is FWD, then find who it was forwarded. and so on.

                   

                  Regards,

                  Imthiaz

                • Re: Agents of a completed workitem.
                  Rick Bakker
                  Currently Being Moderated

                  Hello,

                   

                  "But how do I get these 2 : workitem id and agents just after the creation of workitem."

                   

                  Just before creation isn't good enough?

                   

                  regards

                  Rick Bakker

                  hanabi technology

                  • Re: Agents of a completed workitem.
                    Karthik Vidupankal
                    Currently Being Moderated

                    Hi Rick,

                     

                    Scenario: When a user parks a document it will go for an approval to atleast 2 different levels.

                    Also a document can be changed again and in that case the previous approval workitems for the doc should be deleted and new approval workitems should be created.

                     

                    I want a log which says when a document was changed/created and to whom all it had went for approval including the date and time. Hence I want all the workitems related to a particular document and I can use the workitems to populate other info like creation date, time, forwarding info etc.

                     

                    Since I can't get workitem id before creation, i wil not be able to store workitem id,agents before creation.

                     

                    Regards,

                    Karthik

                    • Re: Agents of a completed workitem.
                      Rick Bakker
                      Currently Being Moderated

                      Hello,

                       

                      "I want a log which says when a document was changed/created and to whom all it had went for approval including the date and time."

                       

                      Yes, that's called the workflow log.

                       

                      "Since I can't get workitem id before creation, i wil not be able to store workitem id,agents before creation."

                       

                      You don't need the workitem id. You need the workflow log. I have never found the need to store a workitem id anywhere, ever.

                       

                      If the worflow log doesn't store the information you need then change the workflow so that it does. It really is that simple.

                       

                      regards

                      Rick Bakker

                      hanabi technology

      • Re: Agents of a completed workitem.
        Currently Being Moderated
        Rick Bakker wrote:

         

        Hello,

        >

        > "Typically, I tend to retrieve my agents and store them in the container prior to delivering the task "

        >

        > That's what I do too. SAP has enough tables, no need for any more custom ones!

        >

        > regards

        > Rick Bakker

        > hanabi technology

         

        As an aside, I have approval steps that are optional and role-based via cost center.  So I must populate an actor-tab container element prior to the step to know whether to actually deliver it or move on.

         

        ...not to mention how helpful this container table can be when debugging recipient problems after the fact

  • Re: Agents of a completed workitem.
    Karri Kemppi
    Currently Being Moderated

    This information is not available afterwards! The responsible agents might have changed (people move in organization, etc.), substitution rules might have changed (in the table that Susan mentioned). users might have forwarded items, etc. So, even if you write your own report, it will not be enough - at least you cannot be absolutely sure that the data in the report is correct.

     

    The only way is to start making some kind of custom log in your workflow. Perhaps you can utilize the workflow programming exits (there is a nice blog about them by Pavan Bhamidipati). For example when creating the work item, you could make entries to a custom table about who are the responsible agents. Even in that case you still need to think about the substitutions (you could store them also in a custom table) and forwarding, etc. Not an easy and straightforward task at all!

     

    Regards,

    Karri

Actions