Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
100% found this document useful (1 vote)
997 views

04 - Logics Scripts

BPC Logic allows you to define formulas that perform calculations on SAP Business Planning and Consolidation members and data. You can have three different type of calculations: Front-End Worksheet logic (excel and VBA) on-the-fly - Dimension Member Formulas (MDX) stored output - Script logic (sql or MDX syntax) - Business Rules (table driven) each type has advantages and disadvantages.

Uploaded by

Giorgio Jacchini
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
997 views

04 - Logics Scripts

BPC Logic allows you to define formulas that perform calculations on SAP Business Planning and Consolidation members and data. You can have three different type of calculations: Front-End Worksheet logic (excel and VBA) on-the-fly - Dimension Member Formulas (MDX) stored output - Script logic (sql or MDX syntax) - Business Rules (table driven) each type has advantages and disadvantages.

Uploaded by

Giorgio Jacchini
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 69

SAP BPC 7.

0 NW SPBO Training
Logic Scripts

Introduction to different calculations methods

Calculations in BPC
Logic allows you to define formulas that perform calculations on SAP Business Planning and Consolidation members and data. You can have three different type of calculations:
Front-End Worksheet logic (Excel & VBA) On-the-Fly

Dimension Member Formulas (MDX) Stored output

Script logic (SQL or MDX syntax) Business Rules (Table Driven)

Badi (ABAP) Allocation Engine

Each type has advantages and disadvantages. You typically use some combination of all four types to achieve the desired results.

Logics

Worksheet Logic Overview


Uses SAP Business Planning and Consolidation 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 do not need to be stored in the database. Usage of standard Excel Formulas to perform calculations Custom VBA code can be triggered for specific events (like refresh, expand, send) Custom VBA coding can also be created for custom selection boxes, validations, allocations,

Worksheet Logics VBA Events


The following events cab be used to trigger custom VBA coding:
BEFORE_CHANGECVW AFTER_CHANGECVW BEFORE_REFRESH AFTER_REFRESH BEFORE_SEND AFTER_SEND BEFORE_EXPAND AFTER_EXPAND

Sample code (need to be created in an Application Module)


Function BEFORE_CHANGECVW(Argument As String) MsgBox Argument BEFORE_CHANGECVW = True End Function

Worksheet Logic Pros and Cons


Pros
Speed - the 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
Static - the formulas are only available in the worksheet in which they are written, 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. Risk of incompatibilities between different version of MS Excel Usage of VBA can cause performance issues in Citrix environments Usage of VBA can increase maintenance work on reports / input schedules

Dimension Member Formulas Overview


Dimension Member Formulas are on-the-fly calculations defined on dimension members based on other member values.
They are commonly used for calculated key figures, such as costs per unit, percent of sales, growth rates and other ratios. 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. We recommend that you use hierarchies, rather than formulas, to define aggregate (or sub-total) dimension member levels. Familiarity with the Multidimensional Expressions (MDX) language may be helpful when creating more complex dimension member formulas. However, fewer MDX keywords are supported in SAP NetWeaver Business Intelligence (BI) than were available in SAP Business Planning and Consolidation 5.x using SQL Server.

SAP 2008 / Page 8

Dimension Member Formulas Prerequisites


In order to use formulas in a dimension you must add a property called 'Formula' to the member sheet using the Manage Dimensions task in the SAP Business Planning and Consolidation Admin module. 'Formula' is a user-defined property, so you must define the length of the field. Enter a field length that is greater than 60 characters, and at least equal to the length of the longest expected formula.

SAP 2008 / Page 9

Dimension Member Formulas Maintaining


Accessed from SAP Business Planning and Consolidation Administration in the Dimension Library subdirectory in the hierarchy of a particular Application Set Maintain Dimension Members.

SAP 2008 / Page 10

Dimension Member Formulas Syntax


Except for the Account dimension, the dimension name must always be specified. Correct formulas: [ACCOUNT].[Account1] / [ACCOUNT].[Account2] Or Account1 / Account2 And [PRODUCT].[Product1] + [PRODUCT].[Product2] Or (with use of optional Solve_Order property) [PRODUCT].[Product1] + [PRODUCT].[Product2];Solve_Order=100

Tip

Make sure the dimension and dimension member case are correct!

SAP 2008 / Page 11

Dimension Member Formulas Solve_Order


Use this property to define the order in which calculated members are solved in the case of intersection with other calculated members. Zero is the highest priority

In the event of a formula collision between the above members, the Account3 formula should take precedence over the Product3 formula because solve_order = 5 has higher priority than solve_order = 100.

SAP 2008 / Page 12

Dimension Member Formulas Solve_Order Example


When Solve_Order is not used or is defined incorrectly:
A3= A1/A2 Then P3=P 1+P2 2

When Solve_Order is used correctly:


P3= P1+P 2 Then A3= A1/A2 1

24 + 26 = 50 but 250 / 10 <> 50 Incorrect result because account ratio is calculated prior to and over-ridden by the product addition formula. 250 / 10 = 25 but 24 + 26 <> 25 Correct result because account ratio is calculated after the product addition formula.

SAP 2008 / Page 13

Dimension Member Formulas The Library File


SAP Business Planning and Consolidation provides a Library File with standard functions that you can use in your dimension member formulas. You can include the library file for use in dimension member formulas specified on the Options sheet of the Account dimension. Then you can define dimension formulas using the standard functions available from the library file. Syntax example:

SAP 2008 / Page 14

Dimension Member Formulas Assigning the Library File


Assigned from SAP Business Planning and Consolidation Administration in the Dimension Library subdirectory in the hierarchy of a particular Application Set Maintain Dimension Members.

Options tab

SAP 2008 / Page 15

Dimension Member Formulas Functions in the Library File


The following standard functions are available in SAP Business Planning and Consolidation:
Basic Financial Formulas Account Average and Growth Rate. Liquidity Analysis Ratios Current Ratio, Quick Ratio, Networking Capital Ratio.

The following SAP Business Planning and Consolidation 5.x standard functions are not included in SAP Business Planning and Consolidation 7.0, version for SAP NetWeaver:
Profitability Ratios Return on Assets, Return on Equity, Return on Common Equity, Cost of Goods Sold to Sales, Net Profit Margin, Gross Profit Margin, SG&A to Sales Ratio. Efficiency Analysis Ratios Asset Turnover Ratio, A/R Turnover Ratio, Average Collection Period, A/P Turnover Ratio, Inventory Turnover Ratio, Average Age of Inventory, Sales to Total Assets Ratio, Days in Receivables, Days in Payables, Days in Inventory. Capital Structure Analysis Ratios Debt Ratio, Debt to Equity Ratio, Interest Coverage Ratio, Debt Coverage Ratio. Capital Market Analysis Ratios Earnings per Share, Price Earnings Ratio, Book Value per Share, Market to Book Ratio, Dividend Yield, Dividend Payout.

SAP 2008 / Page 16

Dimension Member Formulas Pro and Cons


Pro
Consistency - the same logic is applied to all members in all applications that use the dimension.

Cons
Lack of flexibility - dimension logic applies to all levels in the dimension and in all applications using the dimension. If you want to apply a formula only to base level members or want a formula to be used in only one application you should use advanced logic. Creates load on the server.

Script Logic Overview


Script Logic enables calculations on base-level cells that result in data stored within an application. The results are aggregated up the dimensional hierarchy intact, without being re-calculated at upper levels. Some example of when to use a Script Logic formulas are: unit times price calculations, foreign currency translation, allocations, and others. Script logic can be run in any of three ways:
Automatically after data is sent to the database from BPC for Excel using the Default.lgf file. After Journal data sends using either Default.lgf, or if present, Journal.lgf files. From Data Manager as a batch processing event to call Script Logic formulas.

SAP 2008 / Page 18

Script Logic How it works


The Logic module:
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 are 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.

Scope How it works (contd)

Source Data

Calculations

Calculation Output

Destination Data

=
Delta Application

Script Logic Maintaining


Accessed from SAP Business Planning and Consolidation Administration in the Script Logic subdirectory in the hierarchy of a particular Application.

SAP 2008 / Page 21

Script Logic Logic Files


Default Logic gets executed on every write-back to an application. Use the *INCLUDE command to have one logic file call another logic file.

SAP 2008 / Page 22

Script Logic Script Logic Tester


Program UJK_SCRIPT_LOGIC_TESTER can be used to test and debug script logic.

SAP 2008 / Page 23

Creating a new logic script - Steps

Creating a new logic scripts involves the following 5 steps:


Creating the logic script file (Admin Console) Compile the logic script (Admin Console) Create a Process Chain (Netweaver BI) Add the newly created package to the user interface (BPC for Excel) Set the run-time parameters of the Package (BPC for Excel), like the user prompt or the logic file that will be executed.

Script Logic Structure


Script Logic can be broken down into 3 components:
Scoping- What am I running the data on? Data manager scoping Input schedule scoping Scope control Body/Code What do I want to do with the scoped records? *IIf Statements *REC [#] based MDX statements *WHEN / *IS/ *ENDWHEN Allocation Logic Writing the record *Commit

SAP 2008 / Page 25

Script Logic The Library File


SAP Business Planning and Consolidation provides a Library File with standard functions that you can use in your own Script Logic formulas. ApShell includes the default System_library.lgf which stores a library of standard functions. Can be called by using the INCLUDE function in your logic file. The Logic module scans the library file for the appropriate formulas to use based on the information in the LGF file.

SAP 2008 / Page 26

Script Logic Calculations


There are two main ways to perform: A + B = C
MDX Syntax: [ACCOUNT].[#C] = [ACCOUNT]. [A] + [ACCOUNT]. [B] The calculated member is prefixed with a # SQL Syntax : *WHEN ACCOUNT *IS A,B *REC(ACCOUNT=C) *ENDWHEN The calculated member is specified in the *REC()
The MDX syntax is straight forward, but may incur a performance penalty. The SQL syntax is only executed for the records where valuey do exists, this improves the performance but makes the writing of the logic less intuitive

Script Logic Scope Source


Definition of the execution scope :
Data Send (Default logic script) Scope is derived by the sent data, A list of all the unique members in the sent data is used to derive the scope. Scope can be overridden / modified / filtered with the *XDIM keywords Running a Data Manager Package Scope is derived from the User Prompt for the dimensions that are part of the prompt. All non-calculated members are selected for the other dimensions. Scope can be overridden / modified / filtered with the *XDIM keywords

In the MDX mode, the execution scope represents the data region where calculations result should be posted. In the SQL mode, the execution scope represents the data region where the source data are.

Script Logic Scope Source Keywords


The following 3 keywords can be used to modify the scope: *XDIM_MEMBERSET
Overwrites the scope for that dimension

*XDIM_ADDMEMBERSET
Add members to the scope of that dimension

*XDIM_FILTER
Filters the members of the scope of that dimension

*XDIM_MAXMEMBERS
Specifies the maximum number of members that should be included in one query (per dimension)

*SELECT
Assigns a list of members to a memory variable

Script Logic *XDIM_MEMBERSET


*XDIM_MEMBERSET Category = PLAN *XDIM_MEMBERSET Entity = C3000 Additional observation from JeffH *XDIM_MEMBERSET P_DataSrc = MANUAL *XDIM_MEMBERSET TIME = <ALL> does NOT *XDIM_MEMBERSET RptCurrency = LC work! *XDIM_MEMBERSET P_Activity = EMPL1 *XDIM_MEMBERSET P_ACCT = CE0004220 *XDIM_MEMBERSET TIME = BAS(2007.TOTAL) //*XDIM_MEMBERSET TIME = DEP(2007.Q3) //*XDIM_MEMBERSET TIME = ALL(2007.TOTAL)

*WHEN P_ACCT *IS CE0004220 *REC (EXPRESSION = 907) *ENDWHEN *COMMIT

Variant on XDIM_MEMBERSET *XDIM_MEMBERSET {Dimension name} = BAS{Members Set} *XDIM_MEMBERSET {Dimension name} = DEP{Members Set} *XDIM_MEMBERSET {Dimension name} = ALL{Members Set} Example: *XDIM_MEMBERSET TIME = BAS(2007.TOTAL) Selects all base level members of the 2007.TOTAL parent node

Script Logic *XDIM_ADDMEMBERSET


*XDIM_MEMBERSET Category = PLAN *XDIM_MEMBERSET Entity = C3000 *XDIM_MEMBERSET P_DataSrc = MANUAL *XDIM_MEMBERSET RptCurrency = LC *XDIM_MEMBERSET P_Activity = EMPL1 *XDIM_MEMBERSET P_ACCT = CE0004220 *XDIM_MEMBERSET TIME = 2007.JAN *XDIM_ADDMEMBERSET TIME = 2007.FEB *WHEN P_ACCT *IS CE0004220 *REC (EXPRESSION = 901) *ENDWHEN *COMMIT

Adds to Member Selection *XDIM_ADDMEMBERSET {dimension} = {members set} Example: User sends data only on Entity1 and the default logic contains: *XDIM_ADDMEMBERSET ENTITY=Entity2 Logic will be executed for Entity1 AND Entity2.

Script Logic *XDIM_FILTER


*XDIM_FILTER
This instruction does not replace the scope, but filters the existing scope.

Syntax
*XDIM_FILTER {Dimension name} = {Members Set}

Example
If the scope is France, Italy, USA, the instruction:
*XDIM_FILTER ENTITY= [ENTITY].Properties(EUROPE)=Y would limit the scope to the European Entities : France and Italy

Script Logic *XDIM_MAXMEMBERS


*XDIM_MEMBERSET Category = PLAN *XDIM_MEMBERSET Entity = C3000 *XDIM_MEMBERSET P_DataSrc = MANUAL *XDIM_MEMBERSET RptCurrency = LC *XDIM_MEMBERSET P_Activity = EMPL1 *XDIM_MEMBERSET P_ACCT = CE0004220 //*XDIM_MEMBERSET TIME = 2007.JAN *XDIM_MAXMEMBERS TIME = 4 // this forces the system to process the //total number of records in //smaller groups, in this case groups of four, //rather than one big group *WHEN P_ACCT *IS CE0004220 *REC (EXPRESSION = 901) *ENDWHEN *COMMIT Additional observations Significant performance enhancement by entering a large value for XDIM_MAXMEMBERS observed. ENITITY is automatically defaulted to XDIM_MAXMEMBERS ENTITY =1 May want keep default XDIM_MAXMEMBERS ENTITY =1 when considering financial system implications.

Limits the maximum number of members in a query


*XDIM_MAXMEMBERS {dimension}= {max number of members} *XDIM_MAXMEMBERS Entity = 50

Above instruction, if entities to process exceed the limit of 50 members, the logic will break the query into multiple queries of no more than 50 entities each.
PREFORMANCE RELATED

Script Logic *SELECT


*XDIM_MEMBERSET Category = PLAN *XDIM_MEMBERSET P_DataSrc = MANUAL *XDIM_MEMBERSET RptCurrency = LC *XDIM_MEMBERSET P_Activity = EMPL1 *SELECT(%ENTSet%, "[ID]", ENTITY, "[INTCO] ='I_C3000' ") *XDIM_MEMBERSET Entity = %ENTSet% *SELECT(%ACCSet%, "[ID]", P_ACCT, "[CALC]='N'") *XDIM_MEMBERSET P_ACCT = %ACCSet% *WHEN P_ACCT *IS CE0004210 *REC (EXPRESSION = 10) *IS CE0004220 *REC (EXPRESSION = 20) *IS CE0004230 *REC (EXPRESSION = 30) *ENDWHEN *COMMIT Dynamic Member Selection *SELECT ({variable}, {What}, {From}, {Condition}) *SELECT(%ENTSet%, "[ID]", ENTITY, "[INTCO] ='I_C3000' ")

Script Logic *SELECTCASE *CASE


*XDIM_MEMBERSET Category = PLAN *XDIM_MEMBERSET Entity = C3000 SELECTCASE does NOT allow nesting. *XDIM_MEMBERSET P_DataSrc = MANUAL *XDIM_MEMBERSET RptCurrency = LC *XDIM_MEMBERSET P_Activity = EMPL1 *XDIM_MEMBERSET P_ACCT = CE0004220 *XDIM_MEMBERSET TIME = 2007.JAN *SELECTCASE [P_acct].[CE0004210] *CASE 5002 [#CE0004220] = 9011 *CASEELSE [#CE0004230] = 9022 *SELECTCASE is a syntax friendly conditional statement similar *ENDSELECT to the IF>>Then>>Else statements used in other applications. *COMMIT In this example: look at the record if the account is CE0004210, if the value of that record is 5002, then create a new records with account CE0004220 with a value of 9011, if the value of the record is NOT 5002, then create an alternative record with account CE0004230 with a value of 9022.

Script Logic

Calculations - *REC
The *REC instruction is used to generate a new database. The *REC statement has two type of parameters:
Calculation on the current value of the record (Using the keywords EXPRESSION and FACTOR Overwriting the members where the records should be generated (you usually do not want to overwrite your source record with the result, but write that result back to another member) Example: The following syntax multiplies the value of the record by 2 and writes-it back to the category budget
*REC(FACTOR=2,CATEGORY=BUDGET)

The *REC statement can only be used within an *WHEN / *ENDWHEN structure

Script Logic

Calculations - *REC Factor / Expression


The amount to be posted on the new record can be derived from the existing value using Factor and Expression key words
The Factor key word multiplies the existing value by the specified factor The Expression key word allows the input of a formula (can contain arithmetical operators, like +,-,*,/, fixed values of the value of the source value (%value%) A value from another account can be used with MDX Syntax, for example: EXPRESSION=%VALUE%/[P_ACCT].[CE0004020] EXPRESSION=%VALUE%/([P_ACCT].[CE0652000],[P_ACTIVITY].[LABPRD]) [FACTOR | EXPRESSION = {Expression}]

Example
*REC(FACTOR=1/2) Current value is multiplied by 0.5 *REC(EXPRESSION=%VALUE% + 500) Adds 500 to the existing value

Script Logic

Calculations - *WHEN / *IS


The keywords *WHEN and *IS are used to filter the records that get processed
*WHEN Dimension *IS Value,Value2 *REC() *ELSE *REC() *ENDWHEN

A *When / *Endwhen structure can contain several *IS statements and one *ELSE statement The *When keyword can use any property of a dimension, for example Entity.Currency. The *IS keword can then filter on the values of that property

Script Logic

Calculations - *WHEN / *ENDWHEN Example This example copies the values of the account sales from the category Actual to Budget and multiply the values by 2

*WHEN Category *IS Actual *WHEN Account *IS Sales *REC(FACTOR = 2, Category=Budget) *ENDWHEN *ENDWHEN

Script Logic

Calculations - Lookup values


For the EXPRESSION and FACTOR parameter, values of other members can also be used with the following two statements:
*LOOKUP Possibility to Lookup data in another application (for example for Currency Exchange Rates) All values that are defined in the *LOOKUP are queried at the beginning of the logic execution and are then available throughout the logic execution *GET Retrieves a value from memory, the value that is retrieved need to be part of the scope (no additional query is required to read the lookup values) Only value from the same application can be retrieved

Script Logic

Calculations - *LOOKUP
*LOOKUP/*ENDLOOKUP
*Lookup/*EndLookup - This set of instructions can be used in conjunction with a WHEN/ENDWHEN structure to retrieve (lookup) some other values that may be needed either in the calculation of the new value or to define some criteria to be evaluated. A relationship is defined between the current record being processed and the record to lookup Can be used in Factor\Expression or *WHEN Can lookup values in current application or different application in the same application set

Syntax
*LOOKUP {App} *DIM [{Lookup ID}:] {Dimension Name}=Value | {Calling Dimension Name} [. {Property}] [*DIM.] *ENDLOOKUP

*Where:

{App} is the name of the application from which the amounts are searched {DimensionName} is a dimension in the lookup app {CallingDimensionName} is a dimension in the current application {LookupID} is an optional identifier of the looked-up amount. This is only required when multiple values must be retrieved.

Script Logic Calculations - *LOOKUP Example


Consider the currency calculation Value * Rate, where value is in the primary application and rate is in the supporting rate application
*LOOKUP RATE *DIM RATESRC="RATECALC" *DIM RATE=ACCOUNT.RATETYPE *DIM SOURCECURR:INPUTCURRENCY=ENTITY.CURRENCY *DIM USD:INPUTCURRENCY="USD" *DIM EURO:INPUTCURRENCY="EURO" *ENDLOOKUP

Script Logic Calculations - Multi Application Logic


LOOKUP was used to read from another application previously. There is also a statement to write-back the result of a calculation to another application.
*Destination_app = <<application name >>

The desination application needs to have the same structure than the source application, the keywords *Skip_dim, *Add_dim and *Rename_dim are not supported

Script Logic Write-back Overview


Once calculation have been performed, the results need to be sent back (or committed) to the database. This operation is very resource intensive and should be limited to minimum number of commits. The records are not written back directly to the write-back fact table, but are posted through the send governor. Depending on the send governor settings, a logic with several commit sections may take a long time to execute. To avoid multiple write-backs, some calculations need to be rewritten to avoid dependency on other calculated accounts

Script Logic Write-back - *COMMIT


A Commit send the data back to the database A Commit may be required when there are several sections in a logic file and the second section need the output of the first section as input A Commit may also be required when the scope is different for different sections The number of Commit should be limited to a minimum, as this instruction has an important performance impact Syntax
There are a variety of commit instructions that can be used:
*COMMIT *COMMIT_EACH_MEMBER={dimname} *COMMIT_EACH_LEVEL={dimname}

The behavior of the XDIM_MAXMEMBERS option for SQL logic is that the process will commit the generated result as they are generated by each single query. When XDIM_MAXMEMBERS is used in MDX type logics, the logic query is broken in as many queries as required. However all resulting records are committed to the database in one lump at the end of the loop of queries.
It may be preferable to perform a commit to the database after each individual query. This can be accomplished inserting the instruction:
*COMMIT_MAXMEMBERS

Script Logic Execution


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 and the results can be seen in SAP Business Planning and Consolidation right away.

Advanced logic can be run from Data Manager for batch processing of formulas.
Using Data Manager to execute Logic module formulas is useful for calculations that do not need to be executed immediately. For example, an administrator may decide to wait until all the data has been entered in the local currency before generating the translated amounts in the reporting currencies.

Script Logic Data Manager Package


These packages are executed on demand by the users and they will usually require some additional input by the users (like the period or the file they want to import). The logic file cannot be executed by itself, it requires a Process Chain (Netweaver BI Process Chain, transaction RSPC) to be setup first, that Process Chain contains a component that will then call a logic file. Each logic file can have its own Process Chain or a generic Process Chain can be created, where the Logic Script name is passed as parameter

Script Logic Deltas with BPC Microsoft Release


In SQL Logic, the values are not cumulated between different *IS sections, like in the following example:
*WHEN ACCOUNT *IS ACC1 *REC(ACCOUNT=ACC3) *IS ACC2 *REC(ACCOUNT=ACC3) *ENDWHEN ACC3 will only contain the value of Account ACC1 or ACC2.

Script Logic Pros and Cons


Pros
Real-time - allows for real-time calculations. Flexible - enables you to apply different formulas to different applications within an application set (dimension logic is applied to all applications using the dimension). Syntax options - you can use SQL or MDX syntax.

Account Transformation Business Rules Overview


The account transformation function is designed to: Read the values posted under specific combinations of accounts, flow types and data sources Aggregate these values Post the aggregated amount under an alternate destination account, flow and data source combination. Options need to exist to allow for inversion of the sign on posting of the calculated amounts (change debit to credit and vice versa), to use reference data in other periods and years to determine the amount to be posted and to support YTD calculations in Period based applications. The values to be read, the posting rules and the sign determination are all defined in the business rule tables for Account Transformation. The Account Transformation function can be utilized in either a Financial or a legal consolidation application. An example of where this would be used would be to calculate and store amounts which are required for purposes of performing Cash Flow reporting.

Account Transformations Business Rules Syntax


How does the Account Transformation calculation work? These calculations can only use the following 4 dimensions: Account Flow Datasrc Time The instructions *RUN_PROGRAM is used to execute the calculations defined in the Account Transformation Business Rules tables *RUN_PROGRAM CALC_ACCOUNT CATEGORY = %CATEGORY_SET% GROUPS = %RPTCURRENCY_SET% TID_RA = %TIME_SET% CALC=CALC1 OTHER = [ENTITY=%ENTITY_SET%] *ENDRUN_PROGRAM The parameter CALC defines which Calculation Group should be run. All dimension names specified between percentages should be replaced with the dimension names used in the current application

Account Transformations Business Rules Table settings


Supporting fields in the Account Transformation Business Rule Table
Transformation Group: ID to group the calculations Source Account: valid member (base or parent) or a list defined with a DIMLIST property (Accountl) Source Flow: valid member (base or parent) or a list defined with a DIMLIST property (Flow) Source Category: valid member (base or parent) or a list defined with a DIMLIST property (Category) Source Datasrc: blank, valid member (base or parent) or a list defined with a DIMLIST property (Datasrc) Destination Account: blank (same as source member) or base member (Accountl) Destination Category: blank (same as source member) or base member (Accountl) Destination Flow: blank (same as source member) or base member (Flow) Destination Datasrc: blank (same as source member) or base member (Datasrc) Reverse Sign: blank or Y Source Year: blank, absolute value (2006, 2007) or relative value (+1, -2) Source Period: blank, absolute value (JAN, FEB) or relative value (+1, -2) Apply to YTD: blank or Y. In a periodic application, this field can be set to Y to apply calculation on the YTD value

Account Transformation Business Rules Example


The following example shows the Account Transformation table that would be used to copy the Account CE0004220 to the Account CE0004530, keeping the same category, flows and data source

Allocation Engine Overview

Usage: *RUNALLOCATION *FACTOR={expression} *DIM {dim name} WHAT={set}; WHERE={set}; *DIM *ENDALLOCATION [USING ={set};] [TOTAL={set}]

Description Within SAP Business Planning and Consolidation 5.x, this was run as a stored procedure. Within SAP Business Planning and Consolidation 7.0, version for SAP NetWeaver, this is natively a Script Logic Keyword. An allocation method to allocate a value to a number of target member using reference values or percentage Rather than writing custom script logic, the allocation engine was designed to simplify allocations and is a best practice methodology. The allocation engine is referenced in a script logic package, but uses a table based approach.
SAP 2008 / Page 54

Allocation Engine Definition


Allocation Engine Table Components *RunAllocation initiates the allocation Dimensions to include in the allocation *DIM Account Dimensions not defined in the allocation will default to scoping. What Base member to be allocated supports multiple members WHERE=AccountA,AccountB Where Destination members where the allocation will be written supports WHERE=BAS(ParentHX) syntax to define all base level members of a parent. supports use of properties WHERE=[STATUS]="FT" AND [EMP_CLASS]="Existing Using (Optional) member storing an allocation factor, the amount of the driver. Total (Optional) Sum of the driver or Using amounts. Very useful when calculating a percentage Using/Total Factor (Optional) Omitted - factor will always default to 1, Using and Total columns are ignored Numerical values such as 2 What x 2 Using What is multiplied by Using. Total column is ignored. Using/Total What is multiplied by Using/Total 1/COUNT Divided evenly among 1/count of where members

SAP 2008 / Page 55

Allocation Engine Example


Example: The account RENT in entered in entity GLOBALOPS, inter-company NON_INTERCO. This amount must be allocated using a percentage of allocation that is entered by the user in account PERCENT in the appropriate entities and for the desired members of the CATEGORY, TIME, DATASRC and RPTCURRENCY dimensions. This allocation demonstrates the following features: It uses the {dimensiontype}DIM keyword to identify the dimensions by type It uses the <<< and >>> keywords to reference the definitions used to the left or to the right It uses the <> operand to reference all members not equal to a given one

SAP 2008 / Page 56

Allocation Engine Example (contd)


Below is the corresponding script:
*RUNALLOCATION *FACTOR=USING/100 *DIM ACCOUNTDIM *DIM ENTITYDIM *DIM INTCODIM *ENDALLOCATION WHAT=RENT; WHAT=GLOBALOPS; WHERE=<<<; WHERE=>>>; USING=PERCENT USING<>GLOBALOPS USING=<<<

WHAT=NON_INTERCO; WHERE=<<<;

SAP 2008 / Page 57

Badi

Agenda

1.

Call Custom Logic Where am I .main views in BPC NW Custom Logic Overview Create Custom Logic for Input Schedule Create Custom Logic for Data Package Debugging Custom Logic

Where am I main view in BPC NW

BPC (.Net Installation)

Data Modeling Maintain Master Data Data Modeling Script Logic Maintain Master Data User Management Script Logic User Management

Reporting Input Scheduling Reporting Data Mangement Input Scheduling Data Mangement

BI (ABAP Installation) Admin Workbench


Modeling (RSA1)
Info Provider Info Objects

Administration
- Process Chain (RSPC) - BPC: File Service User Interface (UJFS)

Development
- Dev. Workbench (SE80) - BADI (SE19) - SAP Table (SE16) - Programms (SE38)

Business Content Meta Data Rep.

Authorization
User Maintanance (SU01), Role Maintanance (PFCG), Management of Analysis Authorizations (RSECADMIN)

Custom Logic Overview

To create a new function, create a Business Add-in (BADI) Implementation of UJ_CUSTOM_LOGIC (SE18). If the BADI has a filter, then in script logic the customer need to provide the a filter value. Note: To pass parameters to the BADI, you can use Data Manager prompts and read the values of these parameters within your call custom logic code.

For instructions about implementing an SAP Business Add-In, see the ABAP online help at:
http://help.sap.com/saphelp_nw70/helpdata/en/32/a83942424dac04e10000000a1550b0/cont ent.htm. For instructions on how to pass parameters to Custom Logic BADI using START_BADI https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/20f4252d-98ca-2b10-e689f85085ae2d12

SAP 2008 / Page 61

Custom Logic Overview

You can use Custom Logic in two different ways, find below a short summary:
Decision Points: Custom Logic in Input Schedule Data Selection Modeling Debugging Input Schedule and Default Logic BADI, Scipt, Input Schedule External Breakpoint, Maintain Debugging User Custom Logic in Data Package Query and Scipt Logic BADI, Process Chain, Script, Data Package External Breakpoint, Maintain Debugging User, Save SYNCHRONOUS.run File

Create Custom Logic for Input Schedule


BPC Admin BPC Admin
Call BADI

BPC Excel BPC Excel


BackendSave aktive Application
Workbook

1. Create BADI 1. Create BADI


1. A) Define ABAP Code 1. A) Define ABAP Code 1. B) Define Filter Value 1. B) Define Filter Value

Script Logic

Data Input Layout

2. Create Script Logic 2. Create Script Logic


2. A) Call BADI in Scipt Logic 2. A) Call BADI in Scipt Logic

BADI BADI

3. Create Data Input Layout 3. Create Data Input Layout

BW BW Developer Developer

4. Save aktive Workbook 4. Save aktive Workbook

Custom Logic in ABAP

Create Custom Logic for Data Package


BPC Admin BPC Admin
Call BADI

BPC Excel BPC Excel


Call Process Chain Backend Application with Script Logic

1. Create BADI 1. Create BADI


1. A) Define ABAP Code 1. A) Define ABAP Code 1. B) Define Filter Value 1. B) Define Filter Value

Script Logic

Data Package
2. Create Process Chain 2. Create Process Chain
2. A) Create Start Process 2. A) Create Start Process 2. B) BPC Modify Dynamically 2. B) BPC Modify Dynamically

BADI BADI

BW BW Developer Developer

Process Chain Process Chain BW BW Process Chain Process Chain Admin Admin Workbench Workbench

2. C) BPC Run Logic 2. C) BPC Run Logic 2. D) or Process 2. D) or Process 2. E) BPC Clear BPC Tables 2. E) BPC Clear BPC Tables

3. Create Script Logic 3. Create Script Logic

Custom Logic in ABAP

3. A) Call BADI in Scipt Logic 3. A) Call BADI in Scipt Logic

Customizing via Customizing via Drag & Drop Drag & Drop

4. Create Data Management 4. Create Data Management Package Package 5. Call Data Package 5. Call Data Package

Debugging Customer Logic

1.

Maintain Debugging User on BPC Server Manager

2. 3.

Set External Debug User in your Coding Only for Data Package: Create File SYNCHRONOUS.run with Content Y (direct under C:\ on you Client PC)

Lessons learned

Lessons Learned

Script Logic has still a few functional gaps with the Microsoft Release, but is catching up quickly (lots of features were delivered in SP01 and SP02) Performance of Dimension Member Formulas (MDX) is rather poor, should be avoided whenever possible Limit the number of *COMMIT Limit the scope of your calculations Limit the content of your Default logic file

Thank you!

SAP 2008 / Page 68 SAP 2008 / Page 68

Copyright 2008 SAP AG All rights reserved


No part of this publication may be reproduced or transmitted in any form or for any purpose without the express permission of SAP AG. The information contained herein may be changed without prior notice. Some software products marketed by SAP AG and its distributors contain proprietary software components of other software vendors. SAP, R/3, xApps, xApp, SAP NetWeaver, Duet, SAP Business ByDesign, ByDesign, PartnerEdge and other SAP products and services mentioned herein as well as their respective logos are trademarks or registered trademarks of SAP AG in Germany and in several other countries all over the world. All other product and service names mentioned and associated logos displayed are the trademarks of their respective companies. Data contained in this document serves informational purposes only. National product specifications may vary. The information in this document is proprietary to SAP. This document is a preliminary version and not subject to your license agreement or any other agreement with SAP. This document contains only intended strategies, developments, and functionalities of the SAP product and is not intended to be binding upon SAP to any particular course of business, product strategy, and/or development. SAP assumes no responsibility for errors or omissions in this document. SAP does not warrant the accuracy or completeness of the information, text, graphics, links, or other items contained within this material. This document is provided without a warranty of any kind, either express or implied, including but not limited to the implied warranties of merchantability, fitness for a particular purpose, or non-infringement. SAP shall have no liability for damages of any kind including without limitation direct, special, indirect, or consequential damages that may result from the use of these materials. This limitation shall not apply in cases of intent or gross negligence. The statutory liability for personal injury and defective products is not affected. SAP has no control over the information that you may access through the use of hot links contained in these materials and does not endorse your use of third-party Web pages nor provide any warranty whatsoever relating to third-party Web pages

Weitergabe und Vervielfltigung dieser Publikation oder von Teilen daraus sind, zu welchem Zweck und in welcher Form auch immer, ohne die ausdrckliche schriftliche Genehmigung durch SAP AG nicht gestattet. In dieser Publikation enthaltene Informationen knnen ohne vorherige Ankndigung gendert werden. Einige von der SAP AG und deren Vertriebspartnern vertriebene Softwareprodukte knnen Softwarekomponenten umfassen, die Eigentum anderer Softwarehersteller sind. SAP, R/3, xApps, xApp, SAP NetWeaver, Duet, SAP Business ByDesign, ByDesign, PartnerEdge und andere in diesem Dokument erwhnte SAP-Produkte und Services sowie die dazugehrigen Logos sind Marken oder eingetragene Marken der SAP AG in Deutschland und in mehreren anderen Lndern weltweit. Alle anderen in diesem Dokument erwhnten Namen von Produkten und Services sowie die damit verbundenen Firmenlogos sind Marken der jeweiligen Unternehmen. Die Angaben im Text sind unverbindlich und dienen lediglich zu Informationszwecken. Produkte knnen lnderspezifische Unterschiede aufweisen. Die in diesem Dokument enthaltenen Informationen sind Eigentum von SAP. Dieses Dokument ist eine Vorabversion und unterliegt nicht Ihrer Lizenzvereinbarung oder einer anderen Vereinbarung mit SAP. Dieses Dokument enthlt nur vorgesehene Strategien, Entwicklungen und Funktionen des SAP-Produkts und ist fr SAP nicht bindend, einen bestimmten Geschftsweg, eine Produktstrategie bzw. -entwicklung einzuschlagen. SAP bernimmt keine Verantwortung fr Fehler oder Auslassungen in diesen Materialien. SAP garantiert nicht die Richtigkeit oder Vollstndigkeit der Informationen, Texte, Grafiken, Links oder anderer in diesen Materialien enthaltenen Elemente. Diese Publikation wird ohne jegliche Gewhr, weder ausdrcklich noch stillschweigend, bereitgestellt. Dies gilt u. a., aber nicht ausschlielich, hinsichtlich der Gewhrleistung der Marktgngigkeit und der Eignung fr einen bestimmten Zweck sowie fr die Gewhrleistung der Nichtverletzung geltenden Rechts. SAP bernimmt keine Haftung fr Schden jeglicher Art, einschlielich und ohne Einschrnkung fr direkte, spezielle, indirekte oder Folgeschden im Zusammenhang mit der Verwendung dieser Unterlagen. Diese Einschrnkung gilt nicht bei Vorsatz oder grober Fahrlssigkeit. Die gesetzliche Haftung bei Personenschden oder die Produkthaftung bleibt unberhrt. Die Informationen, auf die Sie mglicherweise ber die in diesem Material enthaltenen Hotlinks zugreifen, unterliegen nicht dem Einfluss von SAP, und SAP untersttzt nicht die Nutzung von Internetseiten Dritter durch Sie und gibt keinerlei Gewhrleistungen oder Zusagen ber Internetseiten Dritter ab. Alle Rechte vorbehalten.
SAP 2008 / Page 69

You might also like