Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
cancel
Showing results for 
Search instead for 
Did you mean: 
derk_roesler
Explorer
2,480
A SAP BW data model can be ( and usually is) quite complex.
When a decision maker asks for the calculation logic of a key performance indicator, this can take quite a while and usually requires an IT expert to clarify.

This is due to the fact that the core business logic is hidden in the data model with multiple transformation steps and (usually) numerous ABAP routines.
Especially when a key figure calculation uses data from different datasources it is a common practice to implement that logic in ABAP Start-, End- or Expertroutines.

A business rule engine like BRFplus might provide a better way to implement complex business logic:

  • the logic is better understandable because no ABAP knowledge is required

  • the calculation logic and its documentation is centralized and directly accessible (no PDF's required anymore)

  • the Life-cycle of a calculation is traceable due to a versioning concept and easy deactivation of business rules


In order to facilitate the use of BRFplus in SAP BW, we have developed the rulerunner framework.

The rulerunner framework :

  • offers a very simple way of calling BRFplus functions within SAP BW transformations following an event->consumer model

  • enables a flexible assignment of BRFplus functions that are executed for a particular event (this is done via a BRFplus Decision Table and can be enhanced with customer rulesets)

  • enables the reuse of BRFplus function context object data (via the "context handover" feature) when BRFplus functions are called multiple times (which is standard in SAP BW). I.e. context data (e.g. masterdata, previous results) are buffered across multiple calls of a BRFplus function.

  • implements an asynchronous execution mode which allows to store events and consume these events at a later point in time (consuming means executing BRFplus functions according to the event properties). The stored events can be used by multiple consumers.


Here is an example of how to call BRFplus functions with the rulerunner (in a BW Endroutine):
   loop at RESULT_PACKAGE assigning <result_fields>.
call method zcl_rulerunner=>process_event_directly
exporting
iv_event_type = 'HOSPITAL_PATIENT'
iv_parameter_1_key = 'HOSPITAL_ID'
iv_parameter_1_value = <result_fields>-hc_institu
iv_parameter_2_key = 'PATIENT_ID'
iv_parameter_2_value = <result_fields>-hc_patcase
iv_resultgroup = 'BILLING_KEYFIGURES'
importing=
eo_result_data = lt_result_package_new.
endloop.​

And here is the assignment of the BRFplus functions that are executed.



 

The asynchronous execution mode helps to  implement complex BW delta scenarios more easily. SAP BW tries to reduce the amount of data to be calculated by identifying only those data that are new or have been changed/deleted. If a complex calculation is based on multiple datasources, the keyfigures must be recalculated if any of these datasources have changed. This can be done by firing rulerunner events for each record in any of the datasources that has changed. Later on these stored events can trigger a recalculation.
Rulerunner framework is able to detect redundencies thus ensuring that the keyfigures are only recalculated once.

 

The rulerunner framework can be used free of charge.

It is available at https://github.com/rulerunner/rulerunner4ABAP (including a full documentation).

New contributors to the project are very welcome.

PS: rulerunner provides a solution for a "For All Entries In" database lookup in BRFplus.
2 Comments
Labels in this area