Skip to Content

Hi all,

   This document will show how you can create multilevel workflow using Block. Generally we are using Loop step to create Dynamic multilevel workflow. But Block step gives lot of advance feature like Deadline monitorin, Exception handling etc.

In this example User decision workitem will send to agent one by one i.e after first approver approve, second approver will get the User decision workitem.

So step by step as follows.

1.  Create a multiline container element for UserList.

/wp-content/uploads/2013/06/2_227469.jpg

2. Create a container element for Exit condition from block.

/wp-content/uploads/2013/06/3_227470.jpg

3. Create a Block step. Select ForEach as Block Type.

/wp-content/uploads/2013/06/1_227468.jpg

4. Use your multiline User list element in Dynamic Processing tab.  And give condition for exit from Block.

/wp-content/uploads/2013/06/16_227477.jpg

5. In the Block in Control tab Per Run Binding , bind the _LINE element with WF_PerForEach_Index element.

/wp-content/uploads/2013/06/19_227478.jpg

6. Now create a User Decision Step and put agent as &UserList[_UserList_line]&. It will send to User Decision step determined on perforeach loop index.

/wp-content/uploads/2013/06/21_227480.jpg

7. Add mail step for each outcome. And add Container Operation step in Reject outcome to exit from block if any user take decision to reject.

/wp-content/uploads/2013/06/29_227467.jpg

8. Final workflow design.

/wp-content/uploads/2013/06/a1_227929.jpg

9. Now Test thew workflow . Pass User name in the UserList.

A2.jpg

10. Now you can easily found that in this example User Decision will go first to BCUSER, then if BCUSER  approved it, it will go to ANJAN.

Its done.

To report this post you need to login first.

68 Comments

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

    1. Hafizul Mollah

      Hi Anjan,

      This is a very good documentation with step by step description and with relevant screenshot.

      Normally in this case we do use the Loop but we can do it more intelligently using this Block End Block steps………very well documented thanks a lot for ur effort!!!!!

      Thanks again…….Well Done!!!!!!

      (0) 
    1. Anjan Paul Post author

      Hi,

      Pavan, Thank for your valuable suggestion. Just want to share, whatever link you posted is not prove of that the approval step can be easily done one by one dynamically.

      The document you shared is complete different from my example. You shared the document –

      1 . How can you use dynamic parallel processing at one go, not one by one.

      2. How you can catch exception in block.

      (0) 
      1. Pavan Bhamidipati

        Anjan

        1 . How can you use dynamic parallel processing at one go, not one by one.

        Check the screen shot. click on the first hyper link, (tinypc link) did you ever try to check this tab what it can do?

        about the second hyper link as you said, yes, it does not have any relevance to the content what you posted, I just wanted to show how it can be used in other ways too.

        Because I saw in other thread you just referred this document, just to gain some thing tactically. you don’t have to create a  document, which does not give enough information.I seriously feel that if any user who just goes through the SAP help  documentation, can easily do the same, what you just tried to showcase in this big document.

        Keep some quality in the information that you upload into SCN.

        Regards

        Pavan

        (0) 
        1. Anjan Paul Post author

          Hi Pavan,

             I think you need to recheck the link again.

             I am copying the description of Miscellaneous tab-

             Here it specified that “All processing instances are executed simultaneously.”

             Its clearly specified it will generate all the workitem at once, not one by one.

            May be I am wrong, I am unaware of the functionality. Can you please share some link or some screenshot, how it is possible to generate workitem instance one by one.

            And another point, you wrote “just to gain some thing tactically”.

            Can you please elaborate what is meant by it. If anyone want to create document, he can share his knowledge. And if the document is not relevant enough, for that Moderators are there to analyze it. If you feel this is not helpful, you can approach to moderators.

          (0) 
            1. Anjan Paul Post author

              Hi Pavan,

                We only share what we felt. You have every right to give comments of document created in SCN. May be Document creators are wrong or unaware of some functionality.   But before comment we should be modest enough and read the document thoroughly.

              I am also waiting for some link or documents from your valuable time to describe “how it is possible to generate workitem instance one by one”  . May  be I am unaware of this functionality.

              (0) 
  1. Paul Bakker

    Anjan,

    Thanks very much for posting this information. I have never heard of this functionality before! You may be able to do the same with a loop, but this approach certainly looks simpler and cleaner.

    Are there any known drawbacks? I wonder why I’ve never seen it used…

    cheers

    Paul

    (0) 
    1. Anjan Paul Post author

      Thanks Paul,

       

          I still not find any drawback, but found some advantage, if we want to skip series of activities based on condition, we can easily terminate the block. Also we can put deadline to complete the series of activities in block , which is not possible in loop.

      (0) 
    2. Stéphane Bailleul

      Hi Paul and Anjan,

      Sorry for providing a feedback more than 4 years after…

      I have discovered this blog not long ago.. last week

      I like the functionality but may be not for a valiation because I think there is one drawback, it is not with the functionality during the conception but rather something missing for the maintenance.

      As the agent are being calcuated before and stored in a workflow container, if for one reason or another you have to recalculate the agent, well you won’t be able to use the usual worfklow provided tool (SWI1_RULE ) that is why I like using rule directly within the dialog step.

      If I have missed something please inform me

      Regards

      Stephane

      (0) 
  2. Rambabu Kunuku

    Hi Anjana,

    I think using this process, work item will be sent to all agents instead of one by one.

    after distribution of workitems, anyone can execute the workitem first.

    example: manager should approve only after supervis

    if this is the case how can we sequence the users here.

    Thanks.

    Rambabu

    (0) 
  3. ajeet choudhary

    Hi Anjan,

    I have tried as per the description given by you but when i am testing workflow by filling user list container manually it is not showing any agent and giving msg ‘No Selected Agent’.

    workflow is in process and not pending with anyone.

    Binding

    Capture.JPG

    Agent Expression in user decison step ‘&USERLIST[_USERLIST_LINE]&’.

    Could you please point out where i have errored?

    Regards

    Ajit

    (0) 
      1. ajeet choudhary

        Hi Anjan,

        Problem solved, actually i was passing userid without concatenating ‘US’ as a result workflow failling to determine approver.its working now and thanks for sharing document and it helps people like us.

        Regards

        Ajit

        (0) 
  4. ted pudmanabadoo

    Hi Anjan,

    Thanks for this helpful post on using Block Step but i am having issues while using program exit to add users to a multiline container without hard coding the values.

    It would be very helpful if you could provide me with a tutorial or an example on how to implement it.

    (0) 
    1. Ibrahim Ansari

      HI Anjan,

      Nice document.

      Is it possible to have this block step type where workitem goes to each level approver one by one but there could be multiple approvers at particular level . So it should go to all the approvers at a time at particular level and then to next level.

      Regards,

      Ibrahim

      (0) 
      1. Kamal Jain

        Hi Ibrahim,

        yes this is possible that WI will go to each level one by one and also you can add multiple approval at one level. WI will go to all and if any one completed then WI will be removed from inbox of all agents and Next level WI will be started.

        There 2 main things. Pls note.

        1. In block – block Type should be FOR EACH.

        2. Use deep structure, means table inside table for agent.

        Regards,

        Kamal Jain

        (0) 
        1. sudheer ganti

          How is this possible?? Mine is custom delegated BO method. Here I can not declare parameter with deep structure. So How I should achieve this??

          (0) 
  5. Lin S

    Hi Anjan,

    I have a requirement where every user should be able to work on the decision simultaneously.

    Any Possible way to achieve that.

    Thanks.

    (0) 
      1. Lin S

        Anil,

        Thanks. It sounds relevant. The requirement i have to implement is multiple levels of approval for ex Manager , submanagers etc and within every level dyanamic number of approvers, Reminder Approvals , Adhoc removal of the approvers.

        I am thinking to implement it with a subworkflow which will get everytime a list of approvers and using this block will do the approval process.

        Any suggestion regading adhoc removal of the approver ?

        Thanks

        (0) 
    1. Vishesh Malik

      Hi Linda,

      If you are looking just for parallel processing of a Decision for which multiple approver have to take decision and based on their Decision further steps should be processed then you can use Fork.

      Regards,

      Vishesh

      (0) 
  6. Lin S

    Hi Anjan,

    I tried to use this with parforeach as i need parallel decision processing but if one user is Rejecting the decision the Workflow is setting itself in Error state ? I dont understand this behaviour.

    Please help further

    Thanks

    LS

    (0) 
  7. sudhanshu das

    Hello Anjan,

    This is very nice document. However i have one question if you can answer .

    1. If we send any work item to all the users at one go(parallel workflow) , will all approvers be able to approve that work item or workflow get completed even if one approver approvs the work item?

    I had posted the same question in another thread, as i am new with workflow

    Can we send Work ITem to more than one user and all should be able to approve the work item

    Thanks in advance

    (0) 
    1. Anjan Paul Post author

      Hi,

      Try same approch like Reject mentioned in this doeument. Take a container element and add a container operation to add 1 to that element . Then    in approve branch add another step of  condition to check that contaoner element = 1  or not .  In the yes branch you set ISEXIT = E adding another conatiner operation step.

      Your purpose  will ready

      (0) 
  8. sudhanshu das

    Hello Anjan,

    I have tried this and this is good.

    However i want to send one work item to all users , which i am able to do though parEach.

    However i have a requirement that each of the approver should be able to approve the task and unless all approver have not approved the work item, workflow should not be end?

    Can we acheive this for it?

    Thanks

    (0) 
  9. Vijayakumar V

    Hi Anjan,

    Thanks for the Blog.

    I am very much new to Workflow. Started working on it only last week and this blog help me a lot. But I have one issue.

    I followed the steps mentioned, but the work item is created only for the first user. basically, I think it is not looping properly. Could you please let me know if there are some other steps which needs to be done apart from these steps.

    Thanks

    Vijay

    (0) 
  10. Anand Babu V

    Hi Anjan,

    Really nice document..

    Block type (FOR EACH)  and binding is fine.. only User decision step binding issue.

    FYI….I have created Multiple container name as USER not USERLIST.

    When I am trying it is not working as you explained.. Can u please clarify on the below things.

    In user decision I can map only Multiple container (USER) not like wat you have mapped multiple container with index  ( ‘&USERLIST[_USERLIST_LINE]&)

    If I map multiple container (USER)  in user decision (Expression) then workitem is going at a stretch to all users like parallel processing.

    if I map index number (_USER_LINE) in user decision (Expression) then nothing is doing  since it is the index number.

    How to map  multiple line with index like this (&USERLIST[_USERLIST_LINE]&)    in the user decision step

    Please guide on this…

    Thanks,

    Anand

    (0) 
      1. Anand Babu V

        Hi Anjan,

        Please find the screen shots below.

        Only doubt is how to bind in User decision (Multiple container with Index number)

        WF5.PNG

        WF1.PNG

        WF2.PNG

        WF3.PNG

        wf4.PNG

        Thanks,

        Anand

        (0) 
        1. Anand Babu V

          Hi Anjan,

          As I said before… If i bind USER in user decision step.. Workitem is going to all at the same time.

          If i bind _USER_LINE in user decision step.. noting is happening.. since _USER_LINE is holding the index number not the user name.

          Thanks,

          Anand

          (0) 
            1. Anand Babu V

              Hi Anjan,

              In the 3rd screen shot i am showing binding in the block and in the 5th screenshot I am binding User in the User decision step.. Please check above screenshots…

              I just want to know how to binding in User decision step…multiline container with Index

              How you did the below step.. i cant able to do this.. multi container with index???

              In my case like this I am unable to do    ‘ &User[_UserList_line]&’

              If i typed manually in the binding step it is throwing error.

              6. Now create a User Decision Step and put agent as &UserList[_UserList_line]&. It will send to User Decision step determined on perforeach loop index.

              Thanks.

              Anand.

              (0) 
  11. Siddhartha Srivastava

    Hi Anjan,

    I am trying this example, however I am unable to activate the WF after using block step. Once I remove the block step, I can activate the WF. There are no errors while syntax check though. Any idea what I could be missing ?

    Thanks,

    Sid

    (0) 
  12. Patrick Both

    Hello Anjan,

    absolutely fantastic document for a UserList Approval Workflow.

    I have a question and hope u can help me to solve it. I would like to build in a possibility to bounce the workflow to a Prior Approver in UserList (f.e. User 3 bounces his Decision so User 2 has to approve again).

    I tried it by adding a Containeroperation and set forEach_Index back to further number but that does not work. The index gets further in counting and the workflow ends.

    Do u have an idea how to solve that?

    Thanks,

    Patrick

     

    (0) 
  13. Anjan Paul Post author

    Hi,

     

    Now that will be quiet complex.¬† Please check like that way.¬† Trigger a Event from Block step after¬† Rejection. After that maintain at¬† Basic Data¬† of workflow -> Version¬†¬† Dependant¬† ->¬† Events ->¬† Maintain the¬† Event with¬† Receiver Type¬† as¬† ‘Reevaluate Rule¬† of¬† Active¬† Workitems’.

     

    So that if anyone Reject, Workflow active workitem can be start from begining.  Try this and let us know .

     

    (0) 
  14. sudheer ganti

    Hi Anjan,

    Very Nice document. I struck here with deep structure. In my requirement it will be multiple as well as multi level workflow. At first approval there might be more than two and also at second level same like more than two. So I need to use UserList as Deep structure. But in my custom BO – ZBUS2081 I can not declare a parameter with deep structure to method. So hw shoud I resolve this??

    (0) 
    1. sudheer ganti

      Hi Anjan,

      As a simpler way here my requirement is in the UserList I will have one Position ID at each approval level instead of User IDs. For a Position ID I need to fetch all users assigned to it and I need to send work item to  all users assigned to that Position ID at each approval level. How can I achieve this in your Block Step way??

      (0) 
  15. Sabarinathan C

    Hi Anjan ,

    I just followed the same step as per your suggestion but the issue is if the first person approves the request then it in workflow log it is displaying as pending with second person for approval. but the same request comes again to first person for approval.what might be the issue?

     

    (0) 

Leave a Reply