Post on 16-Jul-2015
BRFplus – The API Way
21/03/2015SAP Inside Track Frankfurt 2
Contents
1. The Business Scenario
2. Solution Options
3. The API Way
4. Summary
21/03/2015SAP Inside Track Frankfurt 3
• Policy Management of Industry Insurances
• Focus: Insurance for transportation of goods
• Processes are a little bit different compared to the individual insurance ☺
• Most important question: How is the premium calculated per transport?
The Business Scenario
Image courtesy of ddpavumba at FreeDigitalPhotos.net
21/03/2015SAP Inside Track Frankfurt 4
• Premium rate is individually negotiated between the insurer and the insured
• Premium depends on several parameters like:− value of the transported good− weight of the transported good− packing of the transported good− …
• For each combination of the parameters a premium is defined
• What do we finally have within the individual contracts?
� A table consisting of condition columns and a result column … a decision table
� Whenever a transport is reported the table gets evaluated and the calculated premium gets collected
The Business Scenario – Premium Calculation
21/03/2015SAP Inside Track Frankfurt 5
Questions
• How do we get the contract individual decision tables into our policy management system?
• How do we get the table evaluated within the reporting process on a policy?
The Business Scenario – Premium Calculation
21/03/2015SAP Inside Track Frankfurt 6
Contents
1. The Business Scenario
2. Solution Options
3. The API Way
4. Summary
21/03/2015SAP Inside Track Frankfurt 7
• Use an application table where the values are stored (including relational operators)
• ABAP coding to evaluated the table and get the right result (hopefully)
Drawbacks
• Coding is Z-coding (or partner coding)� bug fixing!
• Functional features (e. g. check for completeness of table, Excel export/import) have to be implemented� effort and bug fixing
� Let’s see if we find a better approach
Approach One – “Classical” ABAP
21/03/2015SAP Inside Track Frankfurt 8
Correct: BRFplus as the ABAP based business rule management system offers the framework including decision tables !
Approach Two – BRFplus
Image courtesy of stockimages at FreeDigitalPhotos.net
Isn’t there a tool that can help us with decision tables …
21/03/2015SAP Inside Track Frankfurt 9
What does BRFplus offer in detail?
• Modeling environment to create, change, delete and display BRFplus objects
• Functions (decision services) that evaluate rules based on some input and deliver a result
• Decision table object consisting of condition and result columns incl.− Check for gaps− Check for overlap− Excel ex-/import− Simulation options− Optimization option for the table contents − …
• Tracing e. g. in order to satisfy reporting requirements
Approach Two – BRFplus
21/03/2015SAP Inside Track Frankfurt 10
Unfortunately … yes: Storage and transportation of BRFplus objects
Approach Two – BRFplus
Image courtesy of stockimages at FreeDigitalPhotos.net
Are there any drawbacks … ?
21/03/2015SAP Inside Track Frankfurt 11
How are BRFplus objects stored and transported?
• System storage – storage in S-tables and transport via workbench requests
• Customizing storage – storage in C-table and transport via customizing requests
Transport is a no go!
� We need master data to store the contract individual data
Approach Two – BRFplus
21/03/2015SAP Inside Track Frankfurt 12
How are BRFplus objects created?
• Via the BRFplus workbench
• Several modeling steps have to be done in order to have such a contract individual BRFplus function
But we just want to enter the decision table data!
� It is not intended to create the BRFplus function from scratch every time
Approach Two – BRFplus
21/03/2015SAP Inside Track Frankfurt 13
But there is a way out:
• Storage type: Master Data � No transport
• Usage of the BRFplus API to handle the creation process
Approach Two – BRFplus
Image courtesy of chanpipat at FreeDigitalPhotos.net
21/03/2015SAP Inside Track Frankfurt 14
Contents
1. The Business Scenario
2. Solution Options
3. The API Way
4. Summary
21/03/2015SAP Inside Track Frankfurt 15
• The complete BRFplus is covered by an API
• The API allows the creation, update and deletion of every BRFplus objects
• In addition there is also a query object for selection of BRFplus objects
• There are several toolkits that simplify the handling of BRFplus objects
• How do we use this to solve the requirement?− Whenever a new contract for transport insurance is created a new BRFplus application
is created in background (type master data)
− The application contains a function and an empty decision table
− The decision table can then be filled with values using a custom transaction
The API Way
21/03/2015SAP Inside Track Frankfurt 16
Step 0 – Creation of ReUse Application (precondition)
• All Data objects that are in use to define the decision table columns are stored in one central S-type application � reused in every master data application
The API Way
21/03/2015SAP Inside Track Frankfurt 17
Step 1 – Creation of the application
The API Way
21/03/2015SAP Inside Track Frankfurt 18
Step 2a – Fetching of reusable data elements
The API Way
21/03/2015SAP Inside Track Frankfurt 19
Step 2b – Creation of the empty decision table
The API Way
21/03/2015SAP Inside Track Frankfurt 20
Step 2b – Creation of the empty decision table
The API Way
21/03/2015SAP Inside Track Frankfurt 21
Step 3 – Creation of the function and linking decision table
The API Way
21/03/2015SAP Inside Track Frankfurt 22
The API Way – System Demo
21/03/2015SAP Inside Track Frankfurt 23
Question: If the user enters the BRFplus workbench he can change anything in the BRFplus, right?
Answer: Maybe ☺ - we created an application exit class that ensures that only the decision table can be changed and contains additional authority checks
Question: What about the call of the function in the backend?
Answer: The call is generic. The UUID of the function is stored in the contract
The API Way – Further Aspects
21/03/2015SAP Inside Track Frankfurt 24
Contents
1. The Business Scenario
2. Solution Options
3. The API Way
4. Summary
21/03/2015SAP Inside Track Frankfurt 25
• BRFplus is far more than just the BRFplus workbench
• BRFplus offers a full blown API in order to create, modify, delete and query each and every BRFplus object
• The BRFplus API is designed fully object oriented and is very intuitive to use
• Several functionalities are extracted into toolkits/service functionalities in order to decrease the implementation effort
• BRFplus is very flexible with respect to customer specific adoptions
• Do not forget about the BRFplus storage type master data ☺
Summary
21/03/2015SAP Inside Track Frankfurt 26
Questions?
Image courtesy of Master isolated images at FreeDigitalPhotos.net
Thank you for your attention.
21/03/2015SAP Inside Track Frankfurt 27
Dr. Christian Lechner
Business Unit Development
christian.lechner@msg-systems.com@lechnerc77
http://scn.sap.com/people/christian.lechner
www.msg-systems.com
21/03/2015SAP Inside Track Frankfurt 28
• Overview on API: BRFplus - Business Rule Management for ABAP Applicationsby Thomas Albrecht, Carsten Ziegler (SAP PRESS; 2010)
• Blog posts on API usage (SCN):− http://scn.sap.com/community/brm/blog/2014/10/23/handling-of-applications-with-the-brf-
api-part-1− http://scn.sap.com/community/brm/blog/2014/10/26/handling-of-applications-with-the-brf-
api-part-2
• Document on query aspect of API (SCN):http://scn.sap.com/docs/DOC-4585
Appendix
21/03/2015SAP Inside Track Frankfurt 29
Step 0 – Creation of the custom transaction (precondition)
• A custom transaction is created in order to call the BRFplus workbench and target it to one specific BRFplus object S
Custom Transaction