Custom report to know the workflow approval status

Schumacher, Margaret mschumacher at teleflexmedical.com
Wed Aug 27 12:48:43 EDT 2008


Another FM to try is SAP_WAPI_WORKITEMS_BY_TASK and then
SAP_WAPI_READ_CONTAINER to get the result.  If you know up front the
requirement to report on the results I think having Z tables would work
better (but do we ever know all the requirements at the design phase?).

 
  * get the tasks that qualify from selections
    call function 'SAP_WAPI_WORKITEMS_BY_TASK'
      exporting
        time                     = ls_time
        selection_status_variant = p_ss_var "<- closed tasks so you can
see the results
      tables
        task_filter              = lt_tasks  "<- prefill with the tasks
to look for
        worklist                 = lt_worklist. 
 
    * for each entry need to read container info 
  loop at lt_worklist assigning <lfs_wihdr>.

    refresh: lt_cntr, lt_borobj, lt_allobj.
    call function 'SAP_WAPI_READ_CONTAINER'
      exporting
        workitem_id              = <lfs_wihdr>-wi_id
      tables
        simple_container         = lt_cntr
        subcontainer_bor_objects = lt_borobj
        subcontainer_all_objects = lt_allobj.

*   Determine the object of the wf task and set keys
    loop at lt_cntr assigning <lfs_cntr>.
      if <lfs_cntr>-element = '_WI_RESULT' or <lfs_cntr>-element =
'APPRDESC'. 
        gs_tbl-wi_result = <lfs_cntr>-value.
      endif. 
 
...
I never got a way to interpret the -value to the defined outcome so I
coded the mapping of the result value to a text description.  any
feedback on how to get the wf definition text would be good to know.
 
Now I know we don't want to read tables directly but I had to get the
Date of execution for the report so I did the following: 
  * For completed tasks get who and when the task was completed.
* Date isn't returned by the WAPI so we have to read it.  Option
* to read the table SWWLOGHIST exists but there are more entries
* then reading header table.
  if not lt_worklist[] is initial.

    select wi_id wi_aed wi_aagent from swwwihead
      into table lt_loghist
      for all entries in lt_worklist
      where wi_id = lt_worklist-wi_id.

    sort lt_loghist by wi_id.

*   need to get the wf initiator
    select wi_id wi_aagent wi_text wi_cd wi_ct wi_stat wi_rh_task
wi_chckwi
       from swwwihead
       into table lt_wf
       for all entries in lt_worklist
       where wi_id = lt_worklist-wi_chckwi.

    sort lt_wf by wi_id.

    "for subflows get the parent wf initiator
    loop at lt_wf assigning <lfs_wf> where wi_chckwi <> ' '.
      select single wi_aagent from  swwwihead into <lfs_wf>-wi_aagent
        where wi_id = <lfs_wf>-wi_chckwi.
    endloop.

  endif. 
 

Regards

 

Margaret Schumacher


________________________________

From: Mike Pokraka [mailto:wug at workflowconnections.com] 
Sent: Thursday, August 21, 2008 3:47 AM
To: 'SAP Workflow Users' Group'
Subject: RE: Custom report to know the workflow approval status



Please AVOID accessing tables directly if you have an alternative. Use
FM SAP_WAPI_WORKITEMS_TO_OBJECT.

 

 

From: sap-wug-bounces at mit.edu [mailto:sap-wug-bounces at mit.edu] On Behalf
Of Ibrahim Khan
Sent: 21 August 2008 06:31
To: SAP Workflow Users' Group
Subject: Re: Custom report to know the workflow approval status

 

I am working on the Appropriation Request workflow for PS.
The information is not stored in standard tables because the approvers
are dynamic and selected while creating the Appropriation request.
In this case I need to explore the workflow related tables to create
this custom report.

On Thu, Aug 21, 2008 at 11:58 AM, Rahul Shukla <rahul_ariean at yahoo.com>
wrote:

Pls go to se12 and search for swww*, there are header and workitem
tables from where based upon ur object name and task names, you can
retrieve such information.

You may need to join ur custom tables too to get the next level of
approvers , if you are maintaing there.

Regards,
Rahul
Something that can't be re-cycled is Wasted Time.


--- On Thu, 8/21/08, Ibrahim Khan <ikhansap at gmail.com> wrote:

> From: Ibrahim Khan <ikhansap at gmail.com>
> Subject: Custom report to know the workflow approval status
> To: "SAP Workflow Users' Group" <SAP-WUG at mit.edu>
> Date: Thursday, August 21, 2008, 8:44 AM

> Hi Friends,
> For one of my custom workflow the client needs a custom
> report to know the
> approval status. This custom workflow will be a multilevel
> approval and they
> want to know the status based on the object key(document
> number) like who
> has approved it at what time, who else has to approve etc
> which standard
> workflow tables can be used for this? Please advice.

> _______________________________________________
> SAP-WUG mailing list
> SAP-WUG at mit.edu
> http://mailman.mit.edu/mailman/listinfo/sap-wug



_______________________________________________
SAP-WUG mailing list
SAP-WUG at mit.edu
http://mailman.mit.edu/mailman/listinfo/sap-wug

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.mit.edu/pipermail/sap-wug/attachments/20080827/ad850121/attachment.htm


More information about the SAP-WUG mailing list