Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Call purchase requisition approval workflow in abap program

Hello,

I copied the standard workflow for the approvaI of a purchase requisition WS00000038 and i tested it. I create a purchase requisition in me51n. This is triggering the event releasestepcreated which starts my workflow. Everything goes ok.

Now, i want to call this workflow in ABAP. I do not know exactly how to do it. Here is the code I tried.

data: ls_objkey type SWR_STRUCT-OBJECT_KEY,

lt_mesage type table of SWR_MESSAG,

gt_container type table of swr_cont,

gs_container type swr_cont.

gs_container-element = 'ReleaseCode'.

gs_container-value = '01'.

append gs_container to gt_container.

gs_container-element = 'requisition'.

gs_container-value = '0010000362'.

append gs_container to gt_container.

gs_container-element = 'RequisitionHeader '.

gs_container-value = '0010000362'.

append gs_container to gt_container.

ls_objkey = '0010000362'.

CALL FUNCTION 'SAP_WAPI_CREATE_EVENT'

EXPORTING

object_type = 'BUS2009'

object_key = ls_objkey

event = 'RELEASESTEPCREATED'

TABLES

input_container = gt_container

MESSAGE_LINES = lt_mesage.

As you can see i filled he RequisitionHeader, requisition and release code. I saw in the workflow that i copied, that these are import parameters. Requisition and release code are mandatory. 0010000362 is a purchase requisition that i created.

After i run the program i receive a work item in SBWP but it has the status error.

Can you help me?Perhaps anyone has done this. I think that i am not filling the correct data or something like that. Maybe you can look in the standard workflow WS00000038 and tell me what I should pass and how.

Thank you,

Efren

Former Member
Former Member replied

Hi Efren,

The Problem is, for the purchase requisition there is two key fields.

So when you pass the keyfiled to workflow it should be the concatenation of Purchanse requisition number and the item number.

You have to pass the object key as below.

ls_objkey = '00100003620010'.

Then only your business object will getting insatanciated.

Thanks,

Viji.

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question