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

Dynamic parallel processing steps

Former Member
0 Likes
2,022


Dear Consultants,

I am creating a custom workflow , where i am sending work item to all first level  approvers at the same time and taking approval of all approvers.

This has been achieved by parallel block profetch. However i am stuck with some scenario -

1. I want to send outlook mail to requestor's outlook ID

2. an outlook mail to all approvers ( With table in item text ,where detail and approver list should appear)

3. an most importantly i want if one of the  approver rejects the work item , that work item should go to requestor for edit and resend the item only to the approver who has reected that item, but all the work work item should not go to the all approvers who have already approved the task?

Anyone has any idea?

Thanks

View Entire Topic
I042439
Product and Topic Expert
Product and Topic Expert
0 Likes

Hi Sudhanshu

1) Your screen shot is not that clear to know the business process? What is the BO which you are using? Can't you use the code given below to get the PD responsible in SRM (all you need to supply is the Doc Guid and type ... type for example, for SC will be BUS2121, PO, BUS2201....

Use this code in a new method and get the Document responsible (you can additionally concatenate it with preceding 'US' for the user ID. Receive the result in structure of type SWHACTOR. Use this in the email step as 'Expression' and type ID as 'G' - Org Object

It does not matter if it's SRM System, if the SRM Org Structure has communication Infotype 0105 maintained, emails can be picked up from there. But I guess SU01 approach would be better for your case.

2) for the second case, better use only the approver IDs with a leading US and follow the same approach of SU01/SO16/ Type ID G to send the email

3) All the best for this item

Regards,

Modak

here is the code for getting the PD responsible (my code revolves around PO and SC, you can include BUSxxxxx for Confirmation

  DATA lo_wf_pdo               TYPE REF TO /sapsrm/if_wf_pdo.
  DATA lx_pdo_ex               TYPE REF TO cx_static_check.
  DATA lt_document_responsible TYPE /sapsrm/t_wf_agent_id.
  DATA lr_document_responsible TYPE REF TO /sapsrm/wf_agent_id.

*IV_DOCUMENT_TYPE is of type /SAPSRM/WF_DOCUMENT_TYPE
*IV_DOCUMENT_GUID  is of type/SAPSRM/WF_DOCUMENT_GUID
* ev_document_responsible is of type /SAPSRM/WF_AGENT_ID

  TRY.
*     Get shopping cart / PO instance
      lo_wf_pdo ?= /sapsrm/cl_wf_pdo_impl_factory=>get_instance(
        iv_document_guid = iv_document_guid
        iv_document_type = iv_document_type
        ).

*     Get owner of shopping cart / PO
      lt_document_responsible = lo_wf_pdo->get_document_responsible( ).
      READ TABLE lt_document_responsible REFERENCE INTO lr_document_responsible INDEX 1.
      ASSERT ID /sapsrm/wf_cfg CONDITION sy-subrc = 0.
      IF sy-subrc NE 0.
        RETURN.
      ENDIF.

      ev_document_responsible = lr_document_responsible->*.


    CATCH /sapsrm/cx_pdo_abort INTO lx_pdo_ex.
      RETURN.

    CATCH /sapsrm/cx_pdo_error INTO lx_pdo_ex.
      RETURN.

  ENDTRY.


Former Member
0 Likes

Hey Modak,

This is a SRM system and i working on custom requirement . Which has nothing to do with SC, PO and GRN.

Business process is like this -

There is one custom web dynpro screen , where user will enter some data and based on cost center it will go for the approval .and at the end it will update one table.

I042439
Product and Topic Expert
Product and Topic Expert
0 Likes

So, isn't the workflow initiator the requester in your case?

Former Member
0 Likes

yes workflow initiator is the same as requestor...

I042439
Product and Topic Expert
Product and Topic Expert
0 Likes

So then the point one (as initially detailed) will hold good... we have the workflow initiator in the workflow container.

Former Member
0 Likes

Hey Modak,

can you please explain the 3 part , i am not able to find binding from block to wf?

THanks

Former Member
0 Likes
Former Member
0 Likes

actually applying first step it is logically deleting this

I042439
Product and Topic Expert
Product and Topic Expert
0 Likes

Almost there...

  • Create a variable LV_REJ_WF as Char01 in Workflow container
    Create a variable LV_REJ_BLK as Char01 in Block container (tab Local Container of the Block)
  • Set LV_REJ_BLK = 'X' in the Rejection Branch of the decision which is inside the block
  • In the Binding (Control Tab of Block Step), bind back LV_REJ_BLK to  LV_REJ_WF.
  • End condition of block (Parallel processing Tab of block) -> set to LV_REJ_BLK = 'X' or LV_REJ_WF = 'X'.

  • remember to clear LV_REJ_WF in the loop
  • remember to clear LV_REJ_BLK before the decision step (inside the block)

Regards,

Modak