on ‎2020 Mar 23 6:31 AM
Hi experts,
I'd like to understand a specific basic concept about the workflow and PR/PO link. When we create a PR/PO, and a workflow is triggered, we can see this workflow instance when we open the said PR/PO under the Approval Details tab.
Now I'm trying to understand, at which time is this link established between the PR/PO and the workflow instance?
Moreover, I'm assuming the above should be similar in case of both classic and flexible workflows. If it's different, in both cases, I'd be more interested to learn specific to the Flexible workflows.
Request clarification before answering.
HI mithun2kr
The link is by SWWFLEXPROC table.
The selection of the workflows is implemented in class CL_SWF_FLEX_BADI_UTILS, method IF_SWF_FLEX_IFS_BADI_WF_UTIL~GET_WORKFLOWS_BY_OBJ_ID. Check out the method for details or put a break-point here and run ME23N.
You can also examine how this method is used in ME23N - method INIT of class CL_SWF_FLEX_WEBGUI_WORKFLOW:
DATA(lo_factory) = cl_swf_flex_ifs_factory=>get_instance(
EXPORTING
iv_language = me->mv_language
iv_scenario_id = me->mv_scenario
).
DATA(lo_runtime_handler) = lo_factory->get_runtime_handler( ).
IF me->mv_wiid IS INITIAL AND me->ms_appl_obj IS NOT INITIAL.
me->mv_wiid = lo_factory->get_workflow_id_by_context( iv_leading_object = me->ms_appl_obj iv_context = me->mv_context ).
ENDIF.me->mv_scenario is the workflow scenario e.g. WS00800238 for PO release.
Call lo_factory->get_workflow_id_by_context returns workitem id.
HTH, BR
Dominik Tylczynski
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks a lot. That's what I was looking for.
In this customer system (S/4HANA 1909), the method you mentioned, has a different code. But after looking around I could find the actual code I was looking for.
Hi mithun2kr
Consult SAP Help on technical details and implementation of the workflow scenarios in purchasing:
For example the release purchase order workflow contains the following steps:

As described in Workflow: Release of Purchasing Documents (MM-PUR-GF), it's WS20000075 workflow. You can display the workflow in PFTC_DIS transaction and check "Triggering events" tab - the workflow is started with RELEASESTEPCREATED event of BUS2012 object type.
The event is your link between the application to maintain purchase orders and PO release workflow. When PO is maintained the application check release strategy configuration. If the PO is release relevant, the application creates RELEASESTEPCREATED event, which starts the workflow.
Best regards
Dominik Tylczynski
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks Dominik.
However, my question is a bit on the technical side. I'm aware of the process of start event that initiates the workflow. But once an instance of the workflow is already initiated, where's the link between the current instance and the current PR/PO being stored?
For example, you see this... an instance of workflow running for the PO. Which table contains this link between the PO and the particular workflow instance, and which FM or class method fetches it?

| User | Count |
|---|---|
| 7 | |
| 5 | |
| 4 | |
| 4 | |
| 3 | |
| 3 | |
| 3 | |
| 2 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.