Skip to Content
author's profile photo Former Member
Former Member

Last approver of purchase requisition linked to workflow

Hi Guys,

Im writting a report to display retrospectively the usernames of the last approvers of a company's purchase requisitions for auditing purposes.

After searching the forum I found a way to do this:

1) use SAP_WAPI_WORKITEMS_TO_OBJECT to retrieve the Workitem Id of PR.

2) read table SWWWIHEAD with TOP WI_ID as the workitem id and WI_TYPE as W and WI_STAT not equal to Completed

3) use SWWWIHEAD-WI_ID from previous step in SAP_WAPI_WORKITEM_RECIPIENTS to get the recipients.

Does this sound right to you?

should not wi_stat be EQUAL to 'completed' instead?

why can I not just do select wi_agent from SWWWIHEAD after getting wi_id from the first step?

Thanks in advance for your help.

Add a comment
10|10000 characters needed characters exceeded

Related questions

2 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Sep 05, 2011 at 03:41 PM

    Hi Christian,

    Yes you are on the right path

    It should be equal to COMPLETED otherwise you cannot get agent name who executed the work item, I mean decision step.

    An alternative way could be displaying the user name who actually executes the decision step, i.e. AABBCC, instead of WF-BATCH. With this way you will see actual user name at the change document of the PR.

    You can use below method at your BAP (BAPI_REQUISITION_RELEASE)I;

    DATA:

    lv_name LIKE sy-uname.

    lv_name = ACT_APPROVER .

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      Thanks for your quick answer Melih.

      I thought it should be equal to 'completed' as well.

      Regarding your alternative I'm a bit confused. How can I get the user name of the releaser from BAPI_REQUISITION_RELEASE?

      Sorry, I'm actually new to ABAP 😊

  • author's profile photo Former Member
    Former Member
    Posted on Sep 07, 2011 at 05:54 PM

    after tracing SAP_WAPI_WORKITEMS_TO_OBJECT and SAP_WAPI_WORKITEM_RECIPIENTS I found a few tables but I dont know exactly what they are used for.

    Could I maybe get the last approver from table SWWVEAGENT (AGENT_ID) coming from swiwiobjct like this:

    SELECT SINGLE wi_id

    INTO ls_wi_id

    FROM swiwiobjct

    WHERE

    objtype = 'BUS2105' AND

    objkey = l_objkey AND

    wi_stat = 'COMPLETED' AND

    wi_lan = 'E' AND

    wi_type = 'F'

    SELECT SINGLE wi_id

    INTO ls_wi_id

    FROM swwveagent

    WHERE

    wi_id = ls_wi_id

    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.