cancel
Showing results for 
Search instead for 
Did you mean: 

RFC to update/ reject work flow

Former Member
0 Kudos

Hi Experts,


Is there any RFC/ FM to approve or reject the work flow?

I am using SAP_WAPI_DECISION_COMPLETE, with following inputs:


WORKITEM_ID <000000665113>

LANGUAGE = EN

USER  = <user id>

DECISION_Key  = 0001

DO_COMMIT= X

It gives:

return code = 2

message line: M = E, line =     Work item 000000665113 is not a user decision

Message structure

MSGID                M            MSG        MSGV1

SWR                  E                 205           000000665113

Where am I going wrong? Need help.

It shows  ready status after execution at SWIA.

Is there an alternative?

Thanks,

Ritu

Accepted Solutions (1)

Accepted Solutions (1)

I042439
Employee
Employee
0 Kudos

Hi Ritu

the workitem you are trying to end is not of type USER DECISION. It may be a workitem of type dialog. See how it actually ends in the workflow...by way of terminating events? or the users just open it and close and then it completes?

You can try using SAP_WAPI_WORKITEM_COMPLETE ... but after knowing fully how the WI is handled in the actual WF.

regards,

Modak

Former Member
0 Kudos

Thanks Modak for your input.


However, how do i make sure that the WI is not of type User decision? Can you pls elaborate the steps. Actually i am a novice.


Regards,


Ritu

I042439
Employee
Employee
0 Kudos

Hi Ritu


It would be a bit tricky as both types are 'W' - dialog WI. This is how you can decide which FM to call:


Call a method to get the Header of the work item:

CALL METHOD cl_swf_run_wim_factory=>find_by_wiid
  EXPORTING
     im_wiid     = <<Your Work Item ID>>
  RECEIVING
     re_instance = lv_wi_handle.

Where lv_wi_handle is defined as lv_wi_handle TYPE REF TO if_swf_run_wim_internal

Then call method to get Node details based on header:

MOVE-CORRESPONDING lv_wi_handle->m_sww_wihead TO ls_swwwihead. 
(ls_swwwihead is defined as ls_swwwihead TYPE swwwihead)

CALL METHOD cl_swf_run_workitem_compatible=>get_def_guid_structure
  EXPORTING
    im_header   = ls_swwwihead
  IMPORTING
    ex_nodetype = l_nodetype.


where  l_nodetype. is defined as : l_nodetype TYPE swd_nodetp.

IF l_nodetype <>  'D', call FM SAP_WAPI_WORKITEM_COMPLETE else call FM SAP_WAPI_DECISION_COMPLETE

Regards,

Modak

Former Member
0 Kudos

Thanks again.

Mu next query is - How to figure out that a work item is of particular workflow. where  and how can i find this?

Regards,

Ritu

I042439
Employee
Employee
0 Kudos

Hi Ritu

Call FM SAP_WAPI_GET_WORKITEM_DETAIL, the export parameter WORKITEM_DETAIL-TOP_WI_ID will give you the work item ID of the parent. If you do not have sub-workflows within the main WF, you will just need to call it once. But if you are using sub workflows and your step is inside the Sub-WF, then call it first to get the Sub WF ID, then Use the sub WF ID and call it again to get the MAIN WF Id ....

And if you want the details on the main Workflow, use the TOP_WI_ID and then call SAP_WAPI_GET_WORKITEM_DETAIL again to get the details of the main WF.

Regards,

Modak

Good to see that you are learning ... however do keep the SCN Rules Of Engagement in mind ( http://scn.sap.com/docs/DOC-18590 ) . Ask only one question in one thread.

Also, your question are not very specific for SRM and hence the right place to post such questions are on the forum SAP Business Workflow http://scn.sap.com/community/bpm/business-workflow

Post your question on this (current) forum only when you need SRM specific advise for workflows.

Former Member
0 Kudos

Thanks for your guidance Modak.

Answers (0)