Espero que pueda servirte de ayuda. Hace un par de días me encontré
con una situación que es, un poco, inusual. Estaba realizando tareas y
desarrollos con los estados de trabajo y de bloqueo en determinadas
regiones de datos. Me encontré con este post que me ayudó bastante.
Es un articulo muy interesante el que he encontrado en el SCN.
Como profesional de SAP BPC es conveniente mantenerse actualizado en este tipo de documentación.
http://scn.sap.com/community/epm/planning-and-consolidation-for-netweaver/blog/2013/10/28/how-to-change-work-status-from-script-logic-using-badi
Showing posts with label Script Logic. Show all posts
Showing posts with label Script Logic. Show all posts
Jan 29, 2014
Dec 12, 2011
BPC Script logic - Scope using member property
*XDIM_MEMBERSET is for scoping based on the member ID.
What if user wants to scope members based on a specific property value?
For example, a user wants to filter Account dimension members those are Asset. To achieve this, we need to use ACCTYPE property which has the type value of account. AST is the value for ASSET account.
(Note: Value is based on the APSHELL of BPC.)
The command is *XDIM_FILTER. The usage is
*XDIM_FILTER <DIMENSIONNAME> = [DIMENSIONName].Properties("Property name") = "Property value"
So above example can be written as below.
*XDIM_FILTER ACCOUNT = [account].properties(“ACCTYPE”)=”AST”
Let's say Account dimension has 3 members as below.
ID ACCTYPE
Extsales INC
CASH AST
TAXES EXP
NETINCOME INC
Then about *XDIM_FILTER_ACCOUNT will select CASH member only.
Let's assume If you already used multiple *XDIM_MEMBERSET command
and below are selected data from the fact tables.
*XDIM_MEMBERSET TIME = 2011.JAN
*XDIM_MEMBERSET CATEGORY = BUDGET
<Result>
EXTSALES , 2011.JAN, BUDGET, 9000
CASH , 2011.JAN, BUDGET, 3000
TAXES , 2011.JAN, BUDGET, 800
NETINCOME, 2011.JAN, BUDGET, 1500
Now if you add *XDIM_FILTER against ACCOUNT dimension.
*XDIM_MEMBERSET TIME = 2011.JAN
*XDIM_MEMBERSET CATEGORY = BUDGET
*XDIM_FILTER ACCOUNT = [account].properties(“ACCTYPE”)=”AST”
Only one record will be selected from above result because CASH is
the only account member that has 'AST' value of ACCTYPE property.
<Result>
CASH , 2011.JAN, BUDGET, 3000
What if user wants to scope members based on a specific property value?
For example, a user wants to filter Account dimension members those are Asset. To achieve this, we need to use ACCTYPE property which has the type value of account. AST is the value for ASSET account.
(Note: Value is based on the APSHELL of BPC.)
The command is *XDIM_FILTER. The usage is
*XDIM_FILTER <DIMENSIONNAME> = [DIMENSIONName].Properties("Property name") = "Property value"
So above example can be written as below.
*XDIM_FILTER ACCOUNT = [account].properties(“ACCTYPE”)=”AST”
Let's say Account dimension has 3 members as below.
ID ACCTYPE
Extsales INC
CASH AST
TAXES EXP
NETINCOME INC
Then about *XDIM_FILTER_ACCOUNT will select CASH member only.
Let's assume If you already used multiple *XDIM_MEMBERSET command
and below are selected data from the fact tables.
*XDIM_MEMBERSET TIME = 2011.JAN
*XDIM_MEMBERSET CATEGORY = BUDGET
<Result>
EXTSALES , 2011.JAN, BUDGET, 9000
CASH , 2011.JAN, BUDGET, 3000
TAXES , 2011.JAN, BUDGET, 800
NETINCOME, 2011.JAN, BUDGET, 1500
Now if you add *XDIM_FILTER against ACCOUNT dimension.
*XDIM_MEMBERSET TIME = 2011.JAN
*XDIM_MEMBERSET CATEGORY = BUDGET
*XDIM_FILTER ACCOUNT = [account].properties(“ACCTYPE”)=”AST”
Only one record will be selected from above result because CASH is
the only account member that has 'AST' value of ACCTYPE property.
<Result>
CASH , 2011.JAN, BUDGET, 3000
Jul 14, 2011
Structure of Script Logic
Logic can be broken down into 3 components
BPC for Excel Scoping
Modification of Scope (i.e.:*XDIM_MEMBERSET)
Allocation Logic and Stored Procedures
Custom BADIs
BPC version for Netweaver Script Logic Overview
*XDIM_MEMBERSET O_CUENTA = ESP001111
*XDIM_MEMBERSET T_TIME = 2011.FEB
*WHEN O_CUENTA
*IS ESP001111
*REC (EXPRESSION = 311)
*ENDWHEN
*COMMIT
- Scoping - What am I running the data on?
BPC for Excel Scoping
Modification of Scope (i.e.:*XDIM_MEMBERSET)
- Body/Code – What do I want to do with the scopedrecords?
Allocation Logic and Stored Procedures
Custom BADIs
- Writing the record
BPC version for Netweaver Script Logic Overview
*XDIM_MEMBERSET O_CUENTA = ESP001111
*XDIM_MEMBERSET T_TIME = 2011.FEB
*WHEN O_CUENTA
*IS ESP001111
*REC (EXPRESSION = 311)
*ENDWHEN
*COMMIT
Parameter *INCLUDE... more Script logic
Multiple files can be combined into one logic file by the use of the instruction INCLUDE. During the LGX generation of the script logic execution step, the statements in INCLUDE file are combined with main file.
Working with *INCLUDE will facilitate debugging since you can debug each Include separately.
The file has the extension .LGF, which can be called at validation by using the INCLUDE function in your logic file.
Working with *INCLUDE will facilitate debugging since you can debug each Include separately.
The file has the extension .LGF, which can be called at validation by using the INCLUDE function in your logic file.
Use the *INCLUDE command to have one logic file call another logic file.
Types of Script Logic
Default logic is a special logic statement that is executed on every write back
to an application.
All logic in Default.LGF is run after data sends. Data is first committed to cube and then, Default.LGF is run on cube data. All other Logic is not executed during Send Data!
Script Logic allows you to create files containing instructions for performing calculations with special requirements on Planning and Consolidation data. You can perform logic calculations on base level members only. In addition, logic is application-specific.
Script Logic Files
You have the following two files for each piece of script logic you create:
1.- An .LGF file, which is an ASCII file you create and edit when setting up logic calculations. You access the .LGF file through the Script Logic editor in the Admin Console.
2.- An .LGX file, which is the compiled logic file created by the system when you validate and save your logic. This is an executable version of the .LGF file that is not stored in Planning and Consolidation.
to an application.
All logic in Default.LGF is run after data sends. Data is first committed to cube and then, Default.LGF is run on cube data. All other Logic is not executed during Send Data!
Script Logic allows you to create files containing instructions for performing calculations with special requirements on Planning and Consolidation data. You can perform logic calculations on base level members only. In addition, logic is application-specific.
Script Logic Files
You have the following two files for each piece of script logic you create:
1.- An .LGF file, which is an ASCII file you create and edit when setting up logic calculations. You access the .LGF file through the Script Logic editor in the Admin Console.
2.- An .LGX file, which is the compiled logic file created by the system when you validate and save your logic. This is an executable version of the .LGF file that is not stored in Planning and Consolidation.
Feb 20, 2011
Donde esta el fichero MDXlib en BPC NW
Como ya sabreis se puden utilizar formulas en la hohja de dimensiones ¿Como? En la pestaña OPTIONS de la hoja de miembros podemos incluir librerías mediante la sintaxis *SYSLIB MDXLIB.lgf
Pero puede ocurrir que tengamos error a la hora de ejecutarlo. Uno de estos errores es que el fichero en cuestión no se encuentre en dicho Set App. ¿Donde localizarlo?
Normalmente se encuentra en C:\BPC\Data\Webfolders\<Appset>\SystemLibrary\Logic Library
Al estar en version NW la ruta es \ROOT\WEBFOLDERS\\SYSTEMLIBRARY\LOGIC LIBRARY\
Pero puede ocurrir que tengamos error a la hora de ejecutarlo. Uno de estos errores es que el fichero en cuestión no se encuentre en dicho Set App. ¿Donde localizarlo?
Normalmente se encuentra en C:\BPC\Data\Webfolders\<Appset>\SystemLibrary\Logic Library
Al estar en version NW la ruta es \ROOT\WEBFOLDERS\\SYSTEMLIBRARY\LOGIC LIBRARY\
Standard Functions in the Library File
The following standard functions are available in SAP Business Planning and Consolidation:
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:
- 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.
Dimension Member Formulas
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.
Benefits related to dimension member formulas include:
Considerations:
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.
Benefits of Dimension Member Formulas
Benefits related to dimension member formulas include:
- Speed
- Consistency
Considerations:
- Lack flexibility
- Shared by all applications in the App Set
- Retrieval performance
Jan 20, 2011
Declaración REC - Script Logic
La declaración de REC proporciona un método para crear y manipular los valores de los nuevos registros utilizando Script Logic. El formato básico de la declaración de REC es el siguiente:
..
*WHEN Dim1
*IS *
*REC(FACTOR=1, Dim2="A")
*ENDWHEN
...
Los nuevos registro(s) creado por la declaración REC, heredan los mismos valores de todas las dimensiones del registro original.
Cualquier dimensión especificada dentro de la expresión REC anulará el valor de la dimension original y será sustituida por la definición REC para esa dimensión.
En el ejemplo anterior, la declaración REC hereda los valores de la dimensión de cada registro de valores con excepción de la dimensión Dim2. Independientemente del valor inicial de Dim2, el nuevo registro tendrá el valor " A " en dicha dimensión.
El estamento REC puede aceptar asignaciones de múltiples dimensiones, cada dimensión asignada debe de estar separados por una coma. Ejemplo:
*WHEN ....
*IS ....
*REC(FACTOR=.5)
*ENDWHEN
->FACTOR puede ser un valor positivo o negativo:
...
*REC(FACTOR=-2)
...
->FACTOR puede realizar operaciones de calculo simples:
...
*REC(FACTOR=3.6/4.7)
...
En este caso, el factor que se aplica es de 3,6 dividido entre 4,7 o 0,765957.
La palabra clave EXPRESIÓN también se puede utilizar para modificar los registros generados por REC. La fórmula de expresión puede incluir operadores regulares aritmética, valores fijos y la palabra clave%% del valor (que representa el valor original recuperado).
Ejemplo:
...
*REC(EXPRESSION=%VALUE%+1500)
...
En este ejemplo, el valor del nuevo registro se determina sumando el valor del registro inicial (%VALUE%) por una cantida fija (1500).
..
*WHEN Dim1
*IS *
*REC(FACTOR=1, Dim2="A")
*ENDWHEN
...
Los nuevos registro(s) creado por la declaración REC, heredan los mismos valores de todas las dimensiones del registro original.
Cualquier dimensión especificada dentro de la expresión REC anulará el valor de la dimension original y será sustituida por la definición REC para esa dimensión.
En el ejemplo anterior, la declaración REC hereda los valores de la dimensión de cada registro de valores con excepción de la dimensión Dim2. Independientemente del valor inicial de Dim2, el nuevo registro tendrá el valor " A " en dicha dimensión.
El estamento REC puede aceptar asignaciones de múltiples dimensiones, cada dimensión asignada debe de estar separados por una coma. Ejemplo:
*WHEN ....
*IS ....
*REC(FACTOR=.5)
*ENDWHEN
->FACTOR puede ser un valor positivo o negativo:
...
*REC(FACTOR=-2)
...
->FACTOR puede realizar operaciones de calculo simples:
...
*REC(FACTOR=3.6/4.7)
...
En este caso, el factor que se aplica es de 3,6 dividido entre 4,7 o 0,765957.
La palabra clave EXPRESIÓN también se puede utilizar para modificar los registros generados por REC. La fórmula de expresión puede incluir operadores regulares aritmética, valores fijos y la palabra clave%% del valor (que representa el valor original recuperado).
Ejemplo:
...
*REC(EXPRESSION=%VALUE%+1500)
...
En este ejemplo, el valor del nuevo registro se determina sumando el valor del registro inicial (%VALUE%) por una cantida fija (1500).
Subscribe to:
Posts (Atom)