cancel
Showing results for 
Search instead for 
Did you mean: 

How to get own workitem id from within a task method ?

Former Member
0 Kudos

Hi Everybody,

I need to change an existing workflow. I have to do some code changes in a task - object method.

For this I need some workflow container elements to be passed to the task - this is not passed currently.

I cannot add new container elements to the task as I would then need to change the binding as well. And I cannot do any changes to the workflow.

Is there any way to know the workitem id of the workflow which triggered the task. So that I can then execute "SWW_WI_CONTAINER_READ" with the workitem id and get the container elements - this would also save me from adding a new container element to the task.

If anyone knows please let me know how to get the self workitem id from within the task method.

Accepted Solutions (1)

Accepted Solutions (1)

former_member186746
Active Contributor
0 Kudos

Hi,

this is a really weird requirement. Beause the best way is to make changes to the existing workflow and pass the container elements you need.

If you have the key and you know the event of the workflow you could probably find the workitem id.

there's also SAP_WAPI_WORKITEMS_TO_OBJECT which might be usefull.

But I would try to persuade some people that if they want the workflow to behave differently then you have to change the workflow.

Kind regards, Rob Dielemans

Former Member
0 Kudos

Hi Rob,

Thanks for your answer... I have persuaded them and I created the workflow container and modified the binding accordingly.

It was the safest way... and also I didn't need any FM..

former_member186746
Active Contributor
0 Kudos

Hi,

Good work in persuading them.

You've just prevented a bucketload of problems if you tried to do it the unorthodox way.

Cheers, Rob.

former_member186746
Active Contributor
0 Kudos

Hi,

Good work in persuading them.

You've just prevented a bucketload of problems if you tried to do it the unorthodox way.

Cheers, Rob.

former_member185167
Active Contributor
0 Kudos

You can say that again.

Answers (5)

Answers (5)

Former Member
0 Kudos

Hi,

In order to get the work item id for the task which is triggered.

Table : SWWORGTASK.

In this table, You can get the workitem id for the tasks triggered along with the workflow.

Thanks,

former_member185167
Active Contributor
0 Kudos

Hello,

fm SAP_WAPI_READ_CONTAINER

But it's a very poor way of doing this. How come you're allowed to change methods but not workflows?

regards

Rick Bakker

hanabi technology

bpawanchand
Active Contributor
0 Kudos

Hi

Use the function module suggested by Rob. Its the right way to identify the workitems with respect a specific BOR.

May be you can try with this Function module to if you have the task number

SAP_WAPI_WORKITEMS_BY_TASK

Regards

Pavan

Edited by: Pavan Bhamidipati on May 11, 2011 12:31 PM

suresh_subramanian2
Active Contributor
0 Kudos

Hello !

Go to transaction SWEL.Under the name of the receiver type, the your workflow id under the column "Name of receiver type" if it have triggered.

Double click that entry and get the work item id.

Regards,

S.Suresh

Former Member
0 Kudos

Hi,

Please try with the following transaction to change the workflow as well as the workflow container.

SWDD

PFTC

PFTC_CHG

If you have the task id then you can use theFM SWN_UWL_GET_WORKLIST to get the woktiem for a perticular task.

Here you need to pass the Task id in import parameter IM_TASK_FILTER

You can also use FM SWW_WI_TASK_INSTANCES_READ to get workitem from task.

Thanks and regards,

SNJY

Edited by: Sanju.pal on May 11, 2011 11:31 AM

Edited by: Sanju.pal on May 11, 2011 11:49 AM