Custom Approval Rule on Standard Business Object of SAP Business ByDesign using Cloud Applications Studio
Use Case: Does your business require custom approval rule on standard SAP ByDesign objects? If yes, then here is a quick guide on how to set it up.
Prerequisite:
- You (customer) or your partner has a development tenant and has SAP Cloud Application Studio installed.
- The standard Business object on which you want to build custom approval rule should be enabled for Multi Step approval.
The below use case deals with creation of custom rule for Purchase Order Approval where each Item from the PO is read to derive the Cost Center and its Manager. The manager wants to delegate his approval to others based on certain conditions like pricing.
Now, let’s get started. First step is to login into SAP Cloud Applications Studio with your development user and create a solution.
Steps to create Custom Approval Rule:
1. To maintain the delegates, create a Custom BO which can persist the delegates information as shown below:
2. Now, you can create screens on top of this custom BO, to Add/Maintain the list of delegates. To generate screens, right click on the BO and click on Create Screens and select the option Screen Scenario with Navigation
Note: By selecting the option Screen Scenario with Navigation, the framework generates all the required screens for you starting from Work Center, Work Center View, OWL, OIF, QA etc… Also the framework ensures that navigation between the screens are configured for you.
3. Right Click on your solution and select Add New Item or click on Add New Item button and select the option Business Configuration Set as shown below and give a meaningful name for it.
4. Now, in this step click on the option Use Business Configuration Object, maintain a description for the BC set and from the drop down of the Name field choose “ApprovalCustomResponsibilityCategory”
Note:
- The option Use Business Configuration Object will not be enabled if you are on a test tenant. Hence at the very beginning of the document, it was mentioned to perform the implementation in the development tenant.
- Once you are in development tenant then you can use SAP delivered std. Business Configuration Objects.
5. Click on Next, here you can maintain values for the BC set as shown:
Here, the value for BusinessObjectTypeCode/content can be found from Repository Explorer, type in the BO Name and then once you select the required BO, the information can be found like below and finish the process of creating BC set.
6. Now, create a BC Option to the BAC element. Right click on the solution, Add New Item and select the option BAC elements
Click on Add, in the next window choose the option Business Option and maintain a value for the Name field under Basic Information and a meaningful description. Maintain a question in the Scoping Question field, this will be later on seen during the scoping of the business option which will be shown in the following steps.
You can also maintain the information of Anchor & Required Scope. Anchor specifies where your Business Option will be placed and Required Scope signifies any constraints for the Business Option. Go ahead and complete the process of creating the Business Option. Once the Business Option is created, you need to activate the same.
7. Now, time to scope the above Business Option created from the front end. Login to the system and navigate to Business Configuration -> Implementation Projects -> First Implementation -> Edit Project Scope -> Questions screen.
Here drill down to Purchasing -> Purchase request & Order Management -> Purchase Orders and you can see the question created in the previous step. Scope the question and trigger the deployment.
8. Once the deployment is completed, you will be able to see the custom rule in the Workflow Approval process of the Purchase Order. To do this, navigate to Application & User Management -> Approval Process -> Find the one relevant for Purchase Order and click on Copy.
In the Work Distribution -> Choose Custom Work Distribution Category Code, and select the option which was earlier maintained by you in the BC set.
You can also maintain some conditions, so that the workflow process is triggered only if the conditions are met.
In my example, for ease of use there are no conditions maintained, which means the workflow process will be triggered all the time when the PO is ordered.
Note: The validity for workflow process has to be maintained. So for custom workflow to be triggered, delimit the earlier process and enable the new one.
9. Now the last step in the implementation is to create an Enhancement Implementation, right click on the solution and Add New Item. Select Enhancement Implementation, and chose the namespace and Enhancement Option as shown below in the screenshot and click on OK.
You can maintain the filter parameter as the value which was specified in the BC set as shown:
Now, save and activate the Enhancement Option.
Now in the absl script you can write the code to retrieve the information about the PO. Loop through each Item in PO to find the Cost Center and the corresponding manager. With these information now query on the custom BO to find out the information about the delegates. Sample code is shown below.
Finally, we have done with all the necessary steps for the custom rule to be triggered and it is now time to test it out.
10. Maintain delegates for few cost centers and managers for testing purpose.
- You can maintain data manually from UI
- Other option is that you can refer to the below blog on how to maintain data for this custom BO using XML File Input method.
11. Navigate to Purchase Requests and Orders, create New Purchase Order and Items to the Purchase Order and ensure the PO is consistent without any errors and click on Order. Once you click on Order, the custom approval rule is triggered and based on the configuration maintained in the custom BO, the approvers for this PO are picked up as shown below:
Thanks for the blog Guru.. great effort and really helpful for the Partners.
Hi Guruprasad,
Thanks for the blog, it is very informative.
Following this process i have created a Custom Approval Process on Customer Quote BO (Sales Quote) for validating the item level values. when the conditions are satisfied it is working fine and going for the approval. But when the conditions are not met still it is going for the Approval (No Approver found; task unassigned) which should not happen as per the standard approval process.
Can you please help me in solving the issue.
Thanks In Advance.
Hello,
I have the same issue, could you solve it?
Please help me.
Regards,
Carlos Panduro
Hi Guruprasad,
I have to create custom Approval process in creation of Production BillOfMaterials how can i figure out the "enabled for Multi Step approval" option for my standard business object.
Regards,
Dear expert,
HI Guruprasad,
Thanks for the blog. great effort and really helpful to me.
May i have an one doubt.how to visible the Approver's name in purchase order General tab.
Hi Guruprasad,
we are trying to adapt your solution for the Supplier Invoice Payment Approval process but we are not able to define the point nr.8 because Custom Work Distribution Category Code is not available the Work Distribution list.
Do you know if this solution could be applied to Supplier Invoice Payments (BO TradeReceivablesPayablesRegister)
thanks,
Roberto De Salvo
Hi Guruprasad,,
Exelent post, I have a few cuestions about approval rule and approval process.
I have created an approval process for project stock orders, following the steps you left in your manual for the creation of custom approval process.
But I have generated certain errors that I could not solve.
1. Why I do not generate the approval tasks since the creation of Project Stock orders.
2. For Proyect Stock orders you have to create an approval process or you have to create an approval rule.
My process of creating custom approval process:
https://answers.sap.com/questions/665636/sap-by-design-issue-from-custom-approval-process.html.
If you could answer me the doubts I have would be very useful.
Thank you so much.
Greetings from Colombia
Hi Guruprasad,
I was trying to recreate this Custom Approval Rule but got stucked on step 8.
Simply my requested workaround is, if I add or change Bank Account in Bank Data on any Supplier and once I click on Save, then the custom approval rule needed to be triggered. But in order when the question is scoped, I go to the Application and User Management workcentre -> Approval Process, I copy relevant "Business Partner Approval Request" approval process as mentioned in step 8, but the "Custom Work Distribution Category Code" is missing in "Work Distribution" dropdown.
Do you have any idea where can be the problem?
Thank you so much.
Best regards,
Barbora.