cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Question about Purchasing Documents and Workflows

Mithun_Kr
Active Participant
0 Likes
1,763

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?

  1. Is the link created at the time of creation of the PR/PO and starting of the workflow? If so, then it must be stored in some DB table. Do you know which is it? and which FM or class-method saves this link?
  2. Or is the link dynamic and the workflow instance is determined only when the PR/PO is opened? In this case, do you know which FM or class is responsible for this determination?

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.

View Entire Topic
Dominik_Tylczynski
SAP Champion
SAP Champion

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

Mithun_Kr
Active Participant

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.