This blog post is a common answer to the questions, like in the Technical background of SC to PO conversion?

Application controlled workflow

As example an item based Workflow will be taken. As you may know, workflow template for item-based process is WS14500015.

Check here: Defining Conditions for Workflow in SAP SRM – Supplier Relationship Management – SCN Wiki, at  the end of the article.

Let’s check, how the workflow looks like in Workflow Builder (Transaction SWDD).

/wp-content/uploads/2014/08/0000_513689.png

At the end there is a step, called No Approval Required, make a double click on it. You’ll see, it is a subworkflow WS10400051.

/wp-content/uploads/2014/08/0001_513690.png

Make a double click on workflow id. A new window is opened with Workflow structure.

/wp-content/uploads/2014/08/0002_513691.png

Here You’ll see a number of brunches, depending on shopping cart/workflow status. You need a brunch Approval, make a double click on the first element.

You’ll see the workflow task TS10007991.

/wp-content/uploads/2014/08/0003_513698.png

Double click on it, you’ll jump to transaction PFTC – workflow task overview.

/wp-content/uploads/2014/08/0004_513701.png

Now you see, that the method SETRELEASED of Business Object BUS2121 is called.

Make a double click on SETRELEASED to just into Business Object Maintenance transaction (SWO1).

/wp-content/uploads/2014/08/0005_513702.png

Select method SetReleased and click on “Program” button – You’ll jump to method implementation.

In the method implementation you can see, that the function module BBP_PD_SC_STATUS_CHANGE_WF is called. Jump into.

In this function module two other function modules called in a queue: BBP_PD_SC_STATUS_CHANGE and BBP_PD_SC_SAVE.

First sets the status to released, and the second saves the changes and triggers the transfer. Let’s see how.

Navigate to: BBP_PD_SC_SAVE=>BBP_PROCDOC_SAVE=>PERFORM procdoc_save=>PERFORM procdoc_ev_and_output_create.

In this form routine you can find following lines of code:


CASE p_object_type.
     WHEN c_shop.
*   - Start transfer if shopping cart has been now released
*   - status released can also be set several times during update for
*     external demands in BAPI or while changing a SC which is already
*     in the SOCO by an employee
*   - transfr should not start if the SC is changed by the purchaser in
*     the SOCO
       IF l_sc_released_active EQ c_on AND
          l_deleted_active     EQ c_off.
         IF l_old_sc_released_active EQ c_off OR
            ( iv_usertype EQ c_wf_employee
               AND iv_subtype NE c_subtype_er ) OR
            ( iv_usertype EQ c_wf_extreq_bapi
               AND iv_subtype EQ c_subtype_er ).
           CLEAR ls_xitem.
           IF x_itmigp[] IS NOT INITIAL.
             READ TABLE x_itmigp INTO ls_xitem INDEX 1.
           ENDIF.
*   check if RFQ will be created in eSOA
           IF ls_xitem-source_rel_ind <> gc_rfq_from_sc_esoa.
*   released active for shopping cart?
             CALL FUNCTION 'BBP_PROCDOC_TRANSFER'
               EXPORTING
                 i_guid        = p_guid
                 i_object_type = p_object_type
                 i_no_commit   = c_on.
           ENDIF.
         ENDIF.
       ENDIF.

So, here is the function module BBP_PROCDOC_TRANSFER is called. This function module moves shopping cart further.

Process Controlled Workflow

Process controlled workflow uses a workflow template WS40000014. Let’s check it via SWDD.

/wp-content/uploads/2014/08/0006_513717.png

Almost at the end of workflow you’ll see a workflow task, named “Handle Process Finish”. Make a double click on it.

You’ll see workflow task TS40007947 – jump into it.

/wp-content/uploads/2014/08/0007_513718.png

Here you see the handler: /SAPSRM/CL_WF_PROCESS_MGR_SBWF->FINISH_PROCESS.

Then you go through:

/SAPSRM/CL_WF_PROCESS_MGR_SBWF->FINISH_PROCESS

/SAPSRM/CL_WF_PROCESS_MANAGER->FINISH_PROCESS

There you can find th call


"------ Delegate handling of finished process to PDO Facade.
   io_wf_pdo->handle_process_finished(
     iv_process_status = iv_process_status
     iv_agent_id       = lv_agent_id
   ).

In case of shopping cart it should be the class /SAPSRM/CL_WF_PDO_SC, check the implementation of the method HANDLE_PROCESS_FINISHED of the class /SAPSRM/CL_WF_PDO.

It will be not the /SAPSRM/CL_WF_PDO_SC, because it has no own implementation and the parent implementation of the /SAPSRM/CL_WF_PDO is called.

In the implementation, you’ll find the call


*     Delegate handling of process finish to pdo_adv
       lo_pdo_adv->handle_process_finished(
         iv_username        = iv_agent_id
         iv_process_status  = iv_process_status
       ).

For the shopping cart the lo_pdo_adv will be /SAPSRM/CL_PDO_BO_SC_ADV.

/wp-content/uploads/2014/08/0008_513722.png

Check the implementation /SAPSRM/CL_PDO_BO_SC_ADV->/SAPSRM/IF_PDO_ADV_BASE~HANDLE_PROCESS_FINISHED

/wp-content/uploads/2014/08/0009_513723.png

RELEASE nethod calls the function modules BBP_PROCDOC_STATUS_CHANGE and BBP_PROCDOC_SAVE in a queue.

Then you have following queue: BBP_PROCDOC_SAVE=>PERFORM procdoc_save=>PERFORM procdoc_ev_and_output_create.

And further the logic works the same way as for application controlled workflow.

P.S.:  English language is not my native language, and any person is not insured from mistakes and typing errors. If you have found an error in the text, please let me know – I’ll correct the post.

P.P.S.: If you have some ideas, how to correct/improve this post – please don’t hesitate to leave a comment.

To report this post you need to login first.

6 Comments

You must be Logged on to comment or reply to a post.

Leave a Reply