Skip to Content

Dynamic Multilevel approval Workflow using Block Step

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.


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


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


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


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


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.


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.


8. Final workflow design.


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


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.

You must be Logged on to comment or reply to a post.
    • 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!!!!!!

    • 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.

      • 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.



        • 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.

          • 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.

  • 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...



    • 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.

    • 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



  • 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.



  • 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.



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

    Could you please point out where i have errored?



  • 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.

    • 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.



      • 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.


        Kamal Jain

        • /
          • Hi Anjan,

            Excellent Work!

            It works beautifully and fits my requirement 🙂

            I am facing one issue in the end block section/Ending the workflow.  As in my case, there are 3 levels of approvals.

            Incase of approvals, the work item goes from one level to another correctly.

            But in case of Reject at any of the levels the workflow should stop and come out of the workflow.

            However, it is still in the process stage and the workflow is not ended.

            Screenshot attached.

            Please provide your input.



  • Hi Anjan,

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

    Any Possible way to achieve that.


      • 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 ?


    • 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.



  • 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



  • 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

    • 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

  • 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?


  • 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.



  • 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...



        • 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.



          • 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.



  • 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 ?



  • 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?




  • 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 .


  • 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??

    • 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??

  • 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?


  • Hi Anjan,

    I get these warning message in my client’s system:


    This is my step and binding:



    The strange this is that I tried this out in my company’s sandbox system and it worked perfectly and didn’t give any warning message.

    Do you think these warning message mean anything? Am I missing some configuration anywhere?



    • Hello,

      I triggered workflow when status of claim notification (tcode iqs1 ) is in 'IN PROCESS'.

      I nedd workflow item with user decision button Approve/Reject and link to tcode iqs1. So that users can see claim notification and Approve/Reject with comments.

      Workflow need to triggered sequentially to multiple approvers.

      I have created user decision step with approve/reject. How to fetch agents in user decision step and trigger workflow sequentially to approvers. Kindly help.



  • Hey Anjan,


    Beautiful documentation! ?

    Was in need of something like this and this popped up on my search hits.


    A quick question : I am in need of a updated functionality ; where until all the approvers in notification list approve the work item from their inbox ; it should revert the changes . So basically the reject part in this workflow suits the requirement ; but in the approve part I would need all approvers to approve the work item simultenously.

    The approvement should be a asynchronous mode ; unlike the generic functionality which puts the workflow as completed once any user approves the work item .


    Kindly your help if you happen to know of any such specifications.


    Thanks in Advance ?