Planning Function Framework

Developing custom planning functions for SAP BPC and SAP BW IP can be quite frustrating and error-prone. Based on more than 10 years of experience we have developed a framework offering a set of tools that will considerably speed up the development, ease maintenance, catch typical errors and bring more transparency into your planning functions.

We offer the framework and tools as a package of source code, documentation, and a workshop to get you started.

Focus on the important things

Implementing custom planning functions barefoot leads to a lot of ‘technical’ coding. Don’t waste time and lines of code on these monotonous tasks, we have already done that for you: by creating methods to read and check filter selections, parameter values, issue messages, move data between hashed and standard tables, etc. Instead, focus on the logic you would like to implement. For example, getting a single value selection or issuing a warning message can be as simple as that:

sel_get_single( EXPORTING iv_iobj = '0CALYEAR' IMPORTING ev_value = lv_calyear ).
IF lv_calyear MOD 4 = 0 AND lv_calyear MOD 100 <> 0.
  message_warning_freetext( |Year { lv_calyear } is a leap year.| ).
ENDIF.

We cut the 2-3 interface methods of BW IP into smaller pieces so everything has its place. You will instinctively know where to put which part of your code – and so will your colleagues, should they ever need to debug it. Everything has its place…

METHODS ev_check_filters_and_params REDEFINITION. "Check filter selections and parameter values for validity
METHODS ev_reference_selections REDEFINITION. "Determine required reference data in this method
METHODS ev_abap_execute REDEFINITION. "Put your calculation logic here, if you implement an ABAP based planning function
METHODS ev_finished REDEFINITION. "Runs if planning function has been executed successfully
METHODS ev_canceled REDEFINITION. "Runs if execution has been canceled
METHODS ev_exception REDEFINITION. "Runs if an exception ocurred during execution
METHODS ev_dataslices_deactive. "This event can be used to deactivate any dataslices prior to execution

SQL Script-based implementations

If you would like to leverage the power of SAP Planning Application Kit to implement planning functions using HANA SQL Script, this is the toolkit you need! It will automatically generate interface types for your aggregation levels, facilitate the passing of scalar and tabular control parameters to the SQL script, supports catching SQL exceptions and checks parameter types, names and order to prevent errors due to silly mistakes.

METHODS ev_sql_scalar_parameters REDEFINITION. "Use this method to pass scalar parameters to your SQL procedure
METHODS ev_sql_method_name REDEFINITION. "Return the method name of the SQL procedure to be used
METHODS ev_sql_tabular_parameter REDEFINITION. "You can also pass an internal table to your SQL procedure
METHODS ev_sql_deltaimage REDEFINITION. "By default the result of the SQL procedure is interpret as an after-image, override this method to interpret is a delta-image
METHODS sql_procedure
      IMPORTING
        VALUE(it_data)                       TYPE tt_aggrlevel_zalvl003 "Input data
        VALUE(it_ref_volumes)                TYPE tt_aggrlevel_zalvl001 "Reference data used for calculation
        VALUE(it_ref_prices)                 TYPE tt_aggrlevel_zalvl002
        VALUE(it_tabular_param)              TYPE tt_customizing_data   "Tabular parameter supplied from ABAP
        VALUE(iv_compcode)                   TYPE /bi0/oicomp_code      "Scalar parameters
        VALUE(iv_currency)                   TYPE /bi0/oicurrency
      EXPORTING
        VALUE(et_data)                       TYPE tt_aggrlevel_zalvl003 "Result data
        VALUE(et_msg)                        TYPE if_rspls_sql_script=>y_t_msg.

We will get you on board quickly, and help you make your 20-minute calculations run in 20 seconds even for data volumes with millions of records.

The framework also supports physical deletion of records from planning aDSOs in an intuitive way: If a record which was there in the input data is not returned in the output data of your SQL logic, it is deleted. Try this with the standard solution…

Typed data access & type generation

Tired of field-symbols and ASSIGN statements cluttering your ABAP? Make your code simple and transparent again by using typed access to planning function data.

The type generator included in our framework will create the types automatically based on the structure of your aggregation levels, and check during runtime that they are up to date.

"Instead of cluttering your code with 200 times 
"ASSIGN COMPONENT '...' OF STRUCTURE <ls_data> TO FIELD-SYMBOL(<lv_field>).
"you is is that simple:

FIELD-SYMBOLS <ls_data> TYPE ts_aggrlevel_zalvl001. 
"This structure type (ts_aggrlevel_zalvl001) is automatically generated for you by the type generation tool
"You can use the typed field-symbol to write field names directly, with syntax check
LOOP ct_data ASSIGNING <ls_data>.
  IF <ls_data>-pcompany IS NOT INITIAL AND gt_accounts[ table_line = <ls_data>-account ]-acctype = 'SLSREV'.
    <ls_data>-zicsales = 'X'.
  ENDIF.
ENDLOOP.

Automated source code generation

Especially for SQL Script-based planning functions – where dynamic programming is not common – it might be monotonous work to program the same logic for dozens of key-figures. The code generation feature of the framework allow source code to be generated on the fly for such repetitive patterns. If a new key-figure or object is added the code generation checker will notice and warn you – you can re-generate the code with the click of a button.

This makes an account to key-figure model conversion and vice versa a breeze… A very fast breeze, by the way…

Runtime change of filter

Stop the exit variable madness in your planning filters. Change filter restrictions right from the source code of your planning function implementation class. Your filter logic will be encapsulated with the rest of your code, right where it belongs. Save time and avoid mess – never creating single-use exit variables anymore.

Automatic logging and time measurement

The framework will log every planning function execution, and the log viewer delivered with the tool will allow you to view all details of each planning function execution. Now you can be certain who executed which planning function at what time – and whether they used the right parameters or not.

METHODS ev_supply_log_parameters REDEFINITION. 
"The values you supply here will be written into the log so it is easier to find planning function executions for a specific company code, sales organization or planning year

Interested?