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

Dynamic parallel processing steps

Former Member
0 Likes
2,013


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

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Likes

Hello

hey i am stuck with this ? Also i have one question how to send request agin to requester ?

Do you have any document ,ehich can help me out?

In the same rejection branch, save the rejection agent (_ACTUAL_AGENT from the task to the workflow in a new variable)., say in LV_REJ_AGENT of type SWHACTOR. Pass it back from the block to the workflow

After the block , send a revision item to the workflow initiator if LV_REJECTED = 'X', clear the rejection flag, after that activity of WF Initiator, loop back to top of block, replace the agent table with the LV_REJ_AGENT saved in the rejection branch.

I have created a task to read values but where i hae to creae  container?

DATA: ztask_wi_id type SWWWIHEAD-WI_ID,

      it_container type table of swr_wihdr,

      wa_container type swr_wihdr,

      lv_rej_agent type SWHACTOR.





swc_get_element container 'ztask_wi_id' ztask_wi_id.





CALL FUNCTION 'SAP_WAPI_READ_CONTAINER'



EXPORTING



workitem_id = ztask_wi_id



language = sy-langu



TABLES



simple_container = it_container



* MESSAGE_LINES =



* MESSAGE_STRUCT =



* SUBCONTAINER_BOR_OBJECTS =



* SUBCONTAINER_ALL_OBJECTS =



.

IF sy-subrc = 0.

READ TABLE it_container INTO wa_container WITH KEY WI_AAGENT = '_WI_ACTUAL_AGENT'.

ENDIF.

swc_set_element container '_WI_ACTUAL_AGENT' lv_rej_agent.





*MOVE wa_container-value TO reqndetails-employeeid.

I042439
Product and Topic Expert
Product and Topic Expert
0 Likes

Hi Sudhanshu

Why did we create a method to manipulate the container?

We need to use a loop step.

the workflow logic should look like this:

1) Start -> Get agents

2) Start loop -> end condition can be LV_APPROVED = 'X'

3) Start Block (with local container data as necessary) - end condition correctly setup - pass back necessary variables back to workflow in binding to read later on

4) End block

5) IF LV_REJECTED = 'X', send workitem to _WF_INITIATOR (available in the workflow container) - After WI completion, loop back to send the WI to the Agnets (you can overwrite the agents table with Actual Agent

6)  IF LV_REJECTED <> 'X' - set LV_APPROVED = 'X' so that the loop ends

Regards,

Modak


Former Member
0 Likes

This Workflow is working fine in approved case , but for reject i think i am missing something , can you please check the workflow diagram , if this logic is correct i will re do the whole part again

I042439
Product and Topic Expert
Product and Topic Expert
0 Likes

can you expand the full log in the first screen shot - navigate to the actual item in error and show the step history. Also give a screen shot of the Binding between the block and WF.

Please make sure that your screen shots have the outcome labels.

Regards,

Modak


Former Member
0 Likes

Hello Modak,

I have created this one. Issue was with binding of blocks.

Thanks

Sudhanshu

Answers (3)

Answers (3)

I042439
Product and Topic Expert
Product and Topic Expert
0 Likes
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

I042439
Product and Topic Expert
Product and Topic Expert
0 Likes

Hi Sudhanshu

1) Outlook email to requester -> where is the email maintained? In SU01 or HR Infotype 0105?

If either of these, just set the email recipient as workflow initiator (expression) (type ID G) in the standard email step.

Go to txn SO16->Tab MailSys Grp -> Select Send to user's home address (this has to be done in all systems once.) - This will enable the workflow to pickup the email address from HR Infotype or SU01 the moment it encounters the above(Type ID G and User ID WF initiator) (if you are using SU01, make sure that just below the email ID, you select the 'communication type' as 'Internet')

2) Not very sure what you want to display in point two email - please elaborate.

To send the email, just keep "Appending" the _ACTUAL_AGENT from the decision step to a workflow container variable of type TSWHACTOR (in the binding from the task to the workflow, use the double arrow button) (http://scn.sap.com/docs/DOC-3036)

Once you have the list of all approvers, bind it back from Block striucture to the workflow and just send an email like above, TYPE ID G, select expression as that table (of type TSWHACTOR) (provided you do SO16 settings)

3) In the rejection branch , set a variable (using container operation), say LV_REJECTED = 'X'. pass this back from block to WF. In the END condition of the Block, check for this LV_REJECTED = X . This will end the block the moment it is rejected.

In the same rejection branch, save the rejection agent (_ACTUAL_AGENT from the task to the workflow in a new variable)., say in LV_REJ_AGENT of type SWHACTOR. Pass it back from the block to the workflow

After the block , send a revision item to the workflow initiator if LV_REJECTED = 'X', clear the rejection flag, after that activity of WF Initiator, loop back to top of block, replace the agent table with the LV_REJ_AGENT saved in the rejection branch.

Regards,

Modak

Former Member
0 Likes


Hello Modak,

Believe or not , i was expecting your answer only šŸ™‚ I followed your posts and those were interesting. being new in the workflow concept , i could take only some of it .

1. I want to send outlook  mail to requestor of confirmation that request has been submitted. and item text should contain the list of approvers agains the cost center . Which i have in my container ET_agents.However i am not sure from where to take requester ID and email.

2. i want to send same mail to all the approvers with same ITEM text.

I have takedn all the approvers email in one container in agent determination stage only , and attached the container directly in send mail and it is serving my purpose. But i want to attach cost center and there approver's list too. Which i am not able to do.

3. Let me apply your suggestion , and i will come back with question:-)

Former Member
0 Likes


I am working on cutom SRM requirement , It is not a HR system