Dynamically Replace or Update a Script Logic File and Execute It in ABAP
- by George Chen, SAP Consultant, Lynk, Inc.
- October 19, 2015
Using SAP Business Planning and Consolidation (BPC), version for NetWeaver and an ABAP Business Add-In (BAdI), you can dynamically change the content of the script logic file before you run it. Therefore, you don’t have to maintain multiple similar static script logics. This reduces maintenance efforts.
Reading this article you will learn how to:
- Retrieve script logic file content in an ABAP Object Oriented (OO) Business Add-In (BAdI)
- Dynamically change script logic file content in an ABAP OO BAdI
- Execute script logic in an ABAP OO BAdI
A Data Manager package executes business logic on SAP Business Planning and Consolidation (BPC), version for NetWeaver data through a series of SAP BW process chains. One important Data Manager package, Default_Formulas, triggers script logic to accomplish the task. An advanced way to run script logic is to trigger it from an ABAP environment. Further, in ABAP Object Oriented (OO) for SAP BPC, you can retrieve script logic file content, make changes at run time, and trigger the script logic on this dynamically changed script logic file content.
SAP Business Planning and Consolidation (BPC), version for NetWeaver provides a standard process for creating or running Data Manager packages. When a business needs to run a large variety of variations of similar logic and uses the standard process, it has to create multiple script logic files, one for each logic, to accomplish the task. This requires the user to either enter different parameter values in a selection screen and execute a script logic file that takes the input parameter values, or choose one of the many script logic files to execute. Each file then has to be hard coded with preselected parameter values.
Either way it is not convenient for users or for BPC administrators or developers to maintain a large number of similar script logic files. Users, administrators, and developers have 30-plus script logic files to choose from.
Consider this business scenario:
- For business unit A1, you need to plan at the cost center group and product group levels.
- For business unit A2, you need to plan at the cost center group and profit center group levels.
- For business unit A3, you need to plan at the cost center group and profit center group levels; then, you need to make adjustments afterwards.
In a common, general solution, this would require three scripts:
Script 1: Input a parameter for business unit A1 and scope at the cost center group and product group levels
Script 2: Input a parameter for business unit A2, scope at the cost center group and product group levels, and total to the cost center group and profit center plan group levels
Script 3: Input a parameter for business unit A3, scope at the cost center group and profit center group plan levels, and run an adjustment
If you have 30 scenarios, that usually means 20 scripts, possibly 30 Data Manager packages (one for each script logic file), or one Data Manager package with complex instructions on which script logic file to select for each scenario.
I implemented an alternative solution that allows you to reuse just one script logic template file. To use this method, you need to:
- Maintain parameter mapping in a script logic template file
- Maintain logic in the same script logic template file
Would you like to see this full item?