bpc - script logics

39
© 2010 Accenture. All rights reserved. Training SAP BPC 7.5 NW Logics

Upload: janakiramyelike

Post on 08-Nov-2014

135 views

Category:

Documents


6 download

DESCRIPTION

BPC Script Logics

TRANSCRIPT

Page 1: BPC - Script Logics

© 2010 Accenture. All rights reserved.

Training

SAP BPC 7.5 NW

Logics

Page 2: BPC - Script Logics

2© 2010 Accenture. All rights reserved. Accenture, its logo and High Performance Delivered are trademarks of Accenture. SAP is a trademark of SAP AG, Germany

• Logics• Worksheet Logics• Dimension Logics • Script Logics

• Validation Engine

SAP BPC Logics

Agenda

Page 3: BPC - Script Logics

Logics allows you to perform calculations on SAP BPC data.

You can create three different types of logic:

Worksheet logic Dimension logic Advanced (Script) logic

Each type has advantages and disadvantages.

You typically use some combination of all three types to achieve the desired results.

SAP BPC Logics

Logics

Page 4: BPC - Script Logics

Uses SAP BPC and standard Excel mathematical operators and functions to produce results.

Is typically used for simple calculations and events, such as data retrievals (EvGTS), sends (EvSND), and variance calculations (EvBET).

Produces calculated values that are not stored in the database.

Exercise

Create a Range “_Data” with some numbers.

Create a EVSND function that Send the how many positive numbers are in Range

“_Data”.

Retrieve the value sent with a EVDRE function.

SAP BPC Logics

Worksheet Logic

Page 5: BPC - Script Logics

Pros Speed: formulas reside in the worksheet, so calculations are fast and have minimal

impact on performance.

Flexibility: you can define many formulas in the worksheet.

No server load: worksheet logic uses the client machine to perform calculations, so it allows the server to run more efficiently.

Cons Lack of scalability: the formulas reside in the worksheet in which they are

defined, and need to be rewritten for each worksheet.

Cannot be applied as a process: worksheet formulas cannot be executed via the Data Manager (i.e. the calculations are not performed until the sheet is opened and the data refreshed).

Not stored: results are not stored in the database, cannot easily execute a further logic based on the result of the worksheet.

SAP BPC Logics

Worksheet Logic

Page 6: BPC - Script Logics

6© 2010 Accenture. All rights reserved. Accenture, its logo and High Performance Delivered are trademarks of Accenture. SAP is a trademark of SAP AG, Germany

• Logics• Worksheet Logics• Dimension Logics • Script Logics

• Validation Engine

SAP BPC Logics

Agenda

Page 7: BPC - Script Logics

Is based on MDX syntax, and is assigned directly to a member.

MDX (Multi-Dimensional Expressions) is a language for querying and manipulating data stored into OLAP databases.

SAP BPC is shipped with many useful MDX functions that help define your calculated members.

Dimension logics use Formula property to store how the member value will be calculated

SAP BPC Logics

Dimension Logic

Page 8: BPC - Script Logics

The Formula property

Must be added using “Maintain dimension property” in order to use dimension logic.

Must have a field size equal to at least the length of your longest formula.

Will appear as a column in the dimension member sheet.

SAP BPC Logics

Dimension Logic

Page 9: BPC - Script Logics

You have the following members in the Account Dimension:

• Account1

• Account2

• Account3 (Formula is Account1/Account2)

You have the following members in the Product Dimension:

• Product1

• Product2

• Product3 (Formula is Product1 + Product2)

SAP BPC Logics

Dimension Logic

SolveOrder Example

Page 10: BPC - Script Logics

When SolveOrder is not used:

When SolveOrder is used:

Incorrect result

because ratio is

calculated prior

to the addition.

Correct result

because ratio is

calculated after

the addition.

[Account3] = [Account1] / [Account2], SOLVE_ORDER=1

[Product3] = [Product1] + [Product2], SOLVE_ORDER=2

[Account3] = [Account1] / [Account2], SOLVE_ORDER=2

[Product3] = [Product1] + [Product2], SOLVE_ORDER=1

SAP BPC Logics

Dimension Logic

Page 11: BPC - Script Logics

Formulas can affect retrieval performance if not used properly.

Dimension formulas should only be used for formulas that need to be calculated after aggregations (e.g. ratios).

Dimension formulas should not be used on members that need to aggregate.

Use the “SOLVE_ORDER” property when dimension formulas are used on more than one dimension.

Exercise

Create three account: ACC1, ACC2, ACC3.

Create a calculated account: ACCM, which value is the average of ACC1, ACC2, ACC3

Create a input schedule that send data on ACC1, ACC2, ACC3 and retrieve ACCM.

SAP BPC Logics

Dimension Logic

Dimension formulas calculate on the fly the result at retrieval time.

Page 12: BPC - Script Logics

Pros• Consistency: the same logic is applied to all members in all applications that use

the dimension.

Cons• Performance issue: Dimension Logic slow retrieval performance.

• Lack of flexibility: dimension logic applies to all levels in the dimension and in all applications using the dimension.

• Not stored: results are not stored in the database, cannot easily execute a further logic based on the result of the worksheet.

• Load: Can create Load on server. Formulas are fast enough if used sparingly, but do not scale well on larger applications.

SAP BPC Logics

Dimension Logic

Page 13: BPC - Script Logics

13© 2010 Accenture. All rights reserved. Accenture, its logo and High Performance Delivered are trademarks of Accenture. SAP is a trademark of SAP AG, Germany

• Logics• Worksheet Logics• Dimension Logics • Script Logics

• Validation Engine

SAP BPC Logics

Agenda

Page 14: BPC - Script Logics

Reads a specific data selection from the application.

• Applies to it a set of user-defined formulas (stored in a logic file)

• Derives the values

• Writes those values back to the application.

Results are written directly to the application as base data, and aggregated up the dimensional hierarchy as they are, without being recalculated at upper levels.

• All dimension logic formulas are applied to these results.

• This process allows you to perform such calculations as units times price because the formulas are applied only to those members specified in the logic file.

SAP BPC Logics

Script Logic

The Logic module:

Page 15: BPC - Script Logics

Advanced logic can be automatically invoked each time data is sent to the database.

Logic contained in the Default logic file is executed immediately after data is sent.

Advanced logic can be run from Data Manager for batch processing of formulas.

Useful for calculations that do not need to be executed immediately.

For example, you may decide to wait until all the data has been entered in the local currency before generating the translated amounts in the reporting currencies.

Logics can be written using MDX language or SQL-based functions (better performance).

SAP BPC Logics

Script Logic

Page 16: BPC - Script Logics

Script Logic Editor is available in the admin module, under each application.

SAP BPC Logics

Script Logic

Page 17: BPC - Script Logics

Simple logic that make constant the value of an account:

This logic must be inserted on Default Logic, under Planning App.To see the result of this logic make a simple report that retrieve the value of this Account.Note that the value is constant only where a data has been sent.

SAP BPC Logics

Script Logic

Demo

Page 18: BPC - Script Logics

Logic that increase an Account by 30%

This logic must be inserted on Default Logic, under Planning App.To see the result of this logic make a simple report that retrieve the value of this Account.Note that the value is constant only where a data has been sent.

SAP BPC Logics

Script Logic

Demo

Page 19: BPC - Script Logics

Logic write Account 2 data on Account 1

This logic must be inserted on Default Logic, under Planning App, and write data sent on PL000008 to PL000006.To see the result of this logic make a simple report that retrieve the value of this Account.Note that the value is constant only where a data has been sent.

SAP BPC Logics

Script Logic

Demo

Page 20: BPC - Script Logics

SAP BPC Logics

Script Logic

Logic: write Account 1 data / Account 2 data on Account 3 using SQL-based functions

Write this logic into a new logic file named Formula.lgf under Planning App, and insert into the Default Logic the following statement:

*include Formula.lgfThis logic will perform the ratio between the data value on Account TA0009 and the data value on the Account TA0004 and will store the result on the Account KPI0006.To see the result of this logic make a simple report that retrieve the value of these Accounts.

Demo

Page 21: BPC - Script Logics

SAP BPC Logics

Script Logic

Logic: write Account 1 data / Account 2 data on Account 3 using MDX language

Write this logic into the Formula.lgf logic file created in the previous step, under Planning App.This logic will perform the ratio between the data value on Account TA0009 and the data value on the Account TA0004 and will store the result on the Account KPI0006.To see the result of this logic make a simple report that retrieve the value of these Accounts.

Demo

Page 22: BPC - Script Logics

SAP BPC Logics

Script Logic

Logics are useful when you have to manage Price x Quantity calculation

P x Q Calculation

Page 23: BPC - Script Logics

23© 2010 Accenture. All rights reserved. Accenture, its logo and High Performance Delivered are trademarks of Accenture. SAP is a trademark of SAP AG, Germany

1. Create a new logic file named PxQ.lgf under Planning App.

2. Write a logic that performs the following PxQ formula:

Outgoing Volume (TA0013) = Average Customer Base (TA0004) * MOU (KPI0004)

3. Write into the Default Logic an include statement to include the PxQ logic file.

4. Create an input schedule and send some data to the Accounts TA0004 and KPI0004.

5. Verify that in the Account TA0013 is written the correct value.

SAP BPC Logics

Script Logic

P x Q Calculation Exercises

Page 24: BPC - Script Logics

SAP BPC Logics

Script Logic

Allows to define and run a top-down allocation. Integrated into the script logic engine. Define the allocation logic using a tabular format.

An allocation is essentially always made up of the following components:

WHAT needs to be allocated WHERE the results of the allocation must be written What driver should be USED to perform the allocation How the allocation driver should be used, i.e. what FACTOR must be applied

to the source amounts during the calculation.

Allocation Engine

Page 25: BPC - Script Logics

SAP BPC Logics

Script Logic

FACTOR USING/TOTAL

DIMENSION WHAT WHERE USING TOTAL

CUSTOMER CUS_ND BAS(TOT_CUS) BAS(TOT_CUS) BAS(TOT_CUS)

DATASRC MANUAL MANUAL AUTOMATIC_ALLOC AUTOMATIC_ALLOC

For each parameter, a region is defined:

Allocation Engine

Page 26: BPC - Script Logics

SAP BPC Logics

Script Logic

FACTOR USING/TOTAL

DIMENSION WHAT WHERE USING TOTAL

CUSTOMER CUS_ND BAS(TOT_CUS) BAS(TOT_CUS) BAS(TOT_CUS)

DATASRC MANUAL MANUAL AUTOMATIC_ALLOC AUTOMATIC_ALLOC

For each parameter, a region is defined:

Source Data

Region

Allocation Engine

Page 27: BPC - Script Logics

SAP BPC Logics

Script Logic

FACTOR USING/TOTAL

DIMENSION WHAT WHERE USING TOTAL

CUSTOMER CUS_ND BAS(TOT_CUS) BAS(TOT_CUS) BAS(TOT_CUS)

DATASRC MANUAL MANUAL AUTOMATIC_ALLOC AUTOMATIC_ALLOC

For each parameter, a region is defined:

Destination

Region

Allocation Engine

Page 28: BPC - Script Logics

SAP BPC Logics

Script Logic

FACTOR USING/TOTAL

DIMENSION WHAT WHERE USING TOTAL

CUSTOMER CUS_ND BAS(TOT_CUS) BAS(TOT_CUS) BAS(TOT_CUS)

DATASRC MANUAL MANUAL AUTOMATIC_ALLOC AUTOMATIC_ALLOC

For each parameter, a region is defined:

Driver

Region

Allocation Engine

Page 29: BPC - Script Logics

SAP BPC Logics

Script Logic

FACTOR USING/TOTAL

DIMENSION WHAT WHERE USING TOTAL

CUSTOMER CUS_ND BAS(TOT_CUS) BAS(TOT_CUS) BAS(TOT_CUS)

DATASRC MANUAL MANUAL AUTOMATIC_ALLOC AUTOMATIC_ALLOC

For each parameter, a region is defined:

Driver Total

Region

Allocation Engine

Page 30: BPC - Script Logics

SAP BPC Logics

Script Logic

FACTOR USING/TOTAL

DIMENSION WHAT WHERE USING TOTAL

CUSTOMER CUS_ND BAS(TOT_CUS) BAS(TOT_CUS) BAS(TOT_CUS)

DATASRC MANUAL MANUAL AUTOMATIC_ALLOC AUTOMATIC_ALLOC

The applied formula in the sample above is:

(The amount of the WHERE region) = (the amount of the WHAT region) * (the amount of the USING region) / (The sum of the amount of the TOTAL region)

Allocation Engine

Page 31: BPC - Script Logics

SAP BPC Logics

Script Logic

Data before allocation:

Drivers Source Data

Allocated Data

Data after allocation:

Allocation Engine

Page 32: BPC - Script Logics

32© 2010 Accenture. All rights reserved. Accenture, its logo and High Performance Delivered are trademarks of Accenture. SAP is a trademark of SAP AG, Germany

1. Open the logic file ALLOCATION.LGF under the Planning App.2. Define the following allocation:

Data to allocate region:- TIME dimension: DEC of the current year- CATEGORY dimension: BUDGET- DATASRC dimension: MANUAL

Destination region:- TIME dimension: All months of the current year- CATEGORY dimension: BUDGET- DATASRC dimension: MANUAL

DRIVER region:- TIME dimension: All months of the previous year- CATEGORY dimension: ACTUAL- DATASRC dimension: AUTOMATIC_ALLOC

TOTAL region:- TIME dimension: All months of the previous year- CATEGORY dimension: ACTUAL- DATASRC dimension: AUTOMATIC_ALLOC

FACTOR: DRIVER data region / TOTAL data region

3. Create an input schedule and send some data to the source and driver region.4. Run the Allocation package to launch the allocation logic created.5. Verify that the allocated data values are correct.

SAP BPC Logics

Script Logic

Allocation Exercise

Page 33: BPC - Script Logics

33© 2010 Accenture. All rights reserved. Accenture, its logo and High Performance Delivered are trademarks of Accenture. SAP is a trademark of SAP AG, Germany

• Logics• Worksheet Logics• Dimension Logics • Script Logics

• Validation Engine

SAP BPC Logics

Agenda

Page 34: BPC - Script Logics

34© 2010 Accenture. All rights reserved. Accenture, its logo and High Performance Delivered are trademarks of Accenture. SAP is a trademark of SAP AG, Germany

• Back-end characteristic validation engine

• Designed to prevent incorrect records being saved into the cube.

• Rule-based configuration of the validation checks.

• BAdI-based validation for more advanced checks.

• Covers all BPC modules (BPC Excel, BPC Data Manager, BPC Web,

Journals).

• Supersedes the Journal validation functionality of the MS versions.

SAP BPC Logics

Validation Engine

Page 35: BPC - Script Logics

35© 2010 Accenture. All rights reserved. Accenture, its logo and High Performance Delivered are trademarks of Accenture. SAP is a trademark of SAP AG, Germany

Driver Dimension

• The dimension of an application from which the rules will be

created.

• Can be any dimension

• Only one driver dimension per application.

• Rules created at dimension level (not application level).

• Thus, applications with the same driver dimension, shares the

same validation rules.

SAP BPC Logics

Validation Engine

Page 36: BPC - Script Logics

36© 2010 Accenture. All rights reserved. Accenture, its logo and High Performance Delivered are trademarks of Accenture. SAP is a trademark of SAP AG, Germany

• The configuration is not performed in the BPC interface, but in the SAP GUI, through UJ_VALIDATION transaction.

• The configuration is AppSet specific.

• The validation configuration of an AppSet can be maintained only by one user at a time.

SAP BPC Logics

Validation Engine

Page 37: BPC - Script Logics

37© 2010 Accenture. All rights reserved. Accenture, its logo and High Performance Delivered are trademarks of Accenture. SAP is a trademark of SAP AG, Germany

Assign Driver Dimension

• The Edit Rules button allows to jump directly to the maintenance of the validation rules for the selected dimension.

• This function allows to select the Driver Dimension for each application of the AppSet.

• An empty Driver Dimension means that no validation rules will be applied to the application.

SAP BPC Logics

Validation Engine

Page 38: BPC - Script Logics

38© 2010 Accenture. All rights reserved. Accenture, its logo and High Performance Delivered are trademarks of Accenture. SAP is a trademark of SAP AG, Germany

Rule Maintenance

• For each rule, specify the members of the driver dimension that the rule applies to.

• Is possible to specify members that not yet exist (a warning will be displayed).

• Define the validation rule by compiling the Logic Table.

• For more complex rules, is possible to create a custom validation logic by creating an implementation of the BAdI BADI_UJ_VALIDATION_RULE_LOGIC.

• This function allows to create/edit/delete the validation rules of the current dimension.

SAP BPC Logics

Validation Engine

Page 39: BPC - Script Logics

39© 2010 Accenture. All rights reserved. Accenture, its logo and High Performance Delivered are trademarks of Accenture. SAP is a trademark of SAP AG, Germany

Other Functionalities

• Copy Validation: allows to copy a validation configuration from the specified source AppSet to the specified target AppSet.

• Delete Validation Configuration: allows to delete the validation configuration of the specified AppSet.

• Turn Validation On/Off: allows to turn on/off the validation check for one or more modules of the specified AppSet.

• Check Validations: performs a check of the validation configuration of the specified AppSet.

SAP BPC Logics

Validation Engine