Skip to Content
0
Former Member
Jan 11, 2012 at 01:29 AM

Get Sub Workflow workitem id from Business Object

359 Views

Hi

Need a suggestion.

I am triggering a workflow on an event creation of the workflow for BUS1001.

later to track the workflow workitem id which is triggered,

i am using - FM - SAP_WAPI_WORKITEMS_TO_OBJECT to get the workitem id of the workflow.

The problem here is the moment the workflow is triggered, the workitem id of the workflow run as the latest is not updated using this fm, it takes ample of time for the new workitem id to be generated and to get generated.

as per the system time, it doesnt update the latest workitem of the workflow triggered. it still shows the old workitem in the last run.

Is there any alternate where i can get the workitem id on which i need to act upon and which is same as in the transaction swi1.

Please suggest me !

thanks,

shankar

My code:-

CALL FUNCTION 'SAP_WAPI_CREATE_EVENT'

EXPORTING

OBJECT_TYPE = C_OBTYPE

OBJECT_KEY = W_OBKEY

EVENT = W_EVENT

COMMIT_WORK = 'X'

EVENT_LANGUAGE = SY-LANGU

LANGUAGE = SY-LANGU

USER = SY-UNAME

IMPORTING

RETURN_CODE = W_RC

TABLES

MESSAGE_LINES = T_EVENT

MESSAGE_STRUCT = T_MSG.

  • this function module is used to determine the Workitem id of the workflow triggered.

CALL FUNCTION 'SAP_WAPI_WORKITEMS_TO_OBJECT'

EXPORTING

  • OBJECT_POR =

OBJTYPE = C_OBTYPE

OBJKEY = W_OBKEY

TOP_LEVEL_ITEMS = 'X'

SELECTION_STATUS_VARIANT = 0001

  • TIME =

TEXT = 'X'

OUTPUT_ONLY_TOP_LEVEL = ' '

LANGUAGE = SY-LANGU

  • DETERMINE_TASK_FILTER = 'X'

  • REMOVED_OBJECTS = ' '

IMPORTING

RETURN_CODE = W_RC

TABLES

  • TASK_FILTER =

WORKLIST = IT_WORKLIST

  • MESSAGE_LINES =

  • MESSAGE_STRUCT =

.

READ TABLE IT_WORKLIST INTO WA_WORKLIST INDEX 1.

WA_ZTTT010-MATNR = MAT.

WA_ZTTT010-WI_ID = WA_WORKLIST-WI_ID.

WA_ZTTT010-WI_TYPE = WA_WORKLIST-WI_TYPE.

WA_ZTTT010-WI_STAT = WA_WORKLIST-WI_STAT.

WA_ZTTT010-WI_CD = WA_WORKLIST-WI_CD.

WA_ZTTT010-WI_CT = WA_WORKLIST-WI_CT.

MOVE WA_ZTTT010 TO ZTTT010.

MODIFY ZTTT010 FROM WA_ZTTT010.

can any one suggest me on what can be done to get the workitem id of the workflow which is the latest