Show TOC

Function documentationScript Logic Locate this document in the navigation structure

 

This function allows you to create files containing instructions for performing calculations with special requirements on Planning and Consolidation data.

Features

You can perform logic calculations on base level members only. In addition, logic is application-specific.

Planning and Consolidation provides a library of MDX formulas, and the ApShell application set is pre-configured with a number of logic functions.

Note Note

Script logic statements are case-insensitive. However, all application set, application, and dimension and member names in K2 are case-sensitive.

End of the note.

You have the following two files for each piece of script logic you create:

  • 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.

  • 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.

Default logic is a special logic statement that is executed on every writeback 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. Having all of your logic in the Default.LGF logic file might become unmanageable. Therefore you can create other logic files, such as FXTrans.LGF for foreign currency translation and ICElim.LGF for intercompany eliminations. Your default logic can contain an INCLUDE statement to execute specific logic in real-time, such as currency translation if desired, rather than having to run a separate batch process.

You access logic files from the Script Logic subdirectory within the hierarchy of an application.

Logic library

Planning and Consolidation has a library of standard logic functions available for your use. The file has the extension .LGF, which can be called at validation by using theINCLUDE 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.

The following are examples of logic delivered with Planning and Consolidation:

  • Allocation.lgf: runs an allocation

  • Calcaccount.lgf: used to prepare Cash Flow; runs a Account Calculation Business Rule

  • Consolidation.lgf: used to run a Legal Consolidation Business Rule

  • Copy_Opening.lgf: used to run a Balance Carry Forward business rule

  • FX_Trans.lgf: used to run currency conversion

  • ICBooking.lgf: used for running Intercompany reconciliation and difference posting

  • ICData.lgf: used to run Intercompany reconciliation

  • ICElim.lgf: used for running Intercompany reconciliation

  • MDXlib.lgf: library of MDX financial functions

  • System_Constants.lgf: stores constant values for use within script logic. See the System constants file section that follows for more information.

  • System_Library.lgf: includes basic examples of a set of keywords

  • Validation.lgf: used for running a Validation rule

System constants file

The system constants file is the logic file that maps your dimension names for an application to the standard Planning and Consolidation logic. By updating the dimension constants file with your dimensions, you avoid having to change or rewrite any of the standard functions that are included with Planning and Consolidation.

The system constants file is located in the \\root\Webfolders\<AppSet>\systemlibrary\logiclibrary folder. You can edit this file using download and upload functions from transaction UJFS in the ABAP interface.

Running script logic

Script logic can be automatically invoked each time the system sends data to the database. Logic contained in the default logic file is executed immediately after data is sent and you can see the results immediately. Script 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, you may decide to wait until all data has been entered in the local currency before generating the translated amounts in reporting currencies.

More Information

For more detailed documentation of script logic and examples, see the section Business Planning and Consolidation, version for the SAP NetWeaver Platform in the Enterprise Performance Management (EPM) How-to Guides section of the SAP SDN at: http://wiki.sdn.sap.com/wiki/display/BPX/Enterprise+Performance+Management+%28EPM%29+How-to+Guides.