cancel
Showing results for 
Search instead for 
Did you mean: 

How to retrieve status/data from workflow?

Former Member
0 Kudos

Hello Experts,

I have seen that saving the data in custom database table is not recommended but i got a requirement where i need to know the status of the workitem depending on the 3 fields. I need to generate a report which gives status depending on the 3 fields.How can i do it without using z-table?

Suggestions are highly appreciable.

Thanks,

Mohammed.

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

I am not sure if I understand your question correctly. Anyhow, I have a feeling that by fields you are meaning container elements in your workflow/task? IF this is the case, you can read the container by function SAP_WAPI_READ_CONTAINER. Just give the work item ID as input parameter, and it will return you the container element values. Use this function in your report.

Regards,

Karri

Former Member
0 Kudos

Hello Experts,

Thank you for your replies.

Yes, I meant container elements, I have tried using SAP_WAPI_READ_CONTAINER, but i need to read work item ID dynamically. When ever the workflow triggers i need to capture container elements. How to approach it??

And how long the work item exists in workflow?? is it for life long??

Thanks & Regards,

Mohammed.

paul_bakker2
Active Contributor
0 Kudos

Hi,

You can use function module SAP_WAPI_WORKITEMS_TO_OBJECT to find the relevant workflow (I assume you know the object that triggered it - eg sales order 12345).

And yes, data stays in a workflow container forever. Until it's archived... even then, it hangs around.

cheers

Paul

Former Member
0 Kudos

Hello Experts,

I know the Object as it is custom, but when i execute the FM SAP_WAPI_WORKITEMS_TO_OBJECT, am unable to read any value. There are no values in the WORKLIST parameter. Am i missing some thing??

The other way which i have tried is: I have hard-coded the task id and read workitem id by using FM SAP_WAPI_READ_CONTAINER, Is it recommended to do so??

Thanks,

Mohammed.

anjan_paul
Active Contributor
0 Kudos

Hi,

   you should use SELECTION_STATUS_VARIANT = 000 in SAP_WAPI_WORKITEMS_TO_OBJECT and check

Former Member
0 Kudos

Hello Anjan,

I have tried with SELECTION_STATUS_VARIANT = 0000 and SELECTION_STATUS_VARIANT = 0001(default) but still no values coming into WORKLIST.

Thanks,

Mohammed.

Former Member
0 Kudos

Hello Mohammed,

instead of selecting the information afterwards, I would recommend to make an instant notification to your ... functionality.

In your case, I wouldn't recommend to write a full toolkit for workflow tracking, but instead to hook an event coupling for the WORKITEM.CREATED event, having a Check-FM, that checks for the workitem's type = F (flowitem) and the workitem's based task ID (your WS.... that you'd like to track).

If so, the event's object key will be the flowitem ID, and you don't need to look that up with search functions.

Use that key for the read-container stuff.

A different solution with less trouble, but with some design flaws is, to create a background task at the time, where the container data is available in the workflow and have the background workitem perform an update on a specific index table, where you can report from.

Florin

paul_bakker2
Active Contributor
0 Kudos

Hi,

Why not just write a report that reads the 3 relevant fields?

Or have I misunderstood.

cheers

Paul