Implementing Pattern-based Partitioning using the SPO BAdI – Part 2: BAdI Implementation
In my blog series Pattern-based Partitioning using the SPO BAdI I shared an approach how to realize central definition and maintenance of partitioning patterns. The standard Semantically Partitioned Object (SPO) functionality of SAP NetWeaver BW 7.3 is enhanced by implementing Business Add-in (BAdI) RSLPO_BADI_PARTITIONING and few control tables. It facilitates an automated (re)partitioning, either individually or collectively, and enables partitions, criteria, texts and Data Transfer Processes (DTPs) to be generated automatically and consistently.
The blog series consists of the following blogs:
- Pattern-based Partitioning using the SPO BAdI – Part 1: Introduction;
- Pattern-based Partitioning using the SPO BAdI – Part 2: BAdI Managed Maintenance;
- Pattern-based Partitioning using the SPO BAdI – Part 3: Partitioning Patterns;
- Pattern-based Partitioning using the SPO BAdI – Part 4: Use Cases.
I developed a working version of the BAdI implementation which I would like to share via two documents. Implementing Pattern-based Partitioning using the SPO BAdI – Part 1: Control Tables contains all technical details of creating the control tables and the related ABAP data dictionary objects. Part 2 explains all technical details of implementing BAdI RSLPO_BADI_PARTITIONING and the necessary ABAP Object Oriented programming in the implementing class.
Please have a look here to download the attachment.
Introduction to the BAdI
Business Add-In (BAdI) RSLPO_BADI_PARTITIONING is available for realizing more sophisticated partitioning scenarios. The following methods of interface IF_RSLPO_BADI_PARTITIONING are mandatory to be implemented:
- GET_T_SPO – Supplies a table with Semantically Partitioned Objects;
- GET_T_PART – Supplies a table with partitions;
- GET_T_PART_TEXT – Supplies a table with names for partitions;
- GET_T_PART_CRIT – Supplies a table with partitioning criteria;
- GET_T_PART_DTP – Supplies a table with Data Transfer Processes.
Next to the interface methods, several other methods were developed for the sake of transparency and source code organization.
Create an Implementation
You can create an implementation of BAdI RSLPO_BADI_PARTITIONING using the BAdI Builder. Go here via t/code SE19 or SAP menu path:
Tools > ABAP Workbench > Utilities > Business Add-Ins > Implementation
Figure 1: Create BAdI Implementation (1)
Then you will have to enter a technical name for the implementation. In this example: YIM_RSLPO_BADI_PARTITIONING.
Figure 2: Create BAdI Implementation (2)
In the next pop-up window you have to specify further details on the implementation.
Figure 3: Create BAdI Implementation (3)
Finally, the BAdI implementation overview is shown. The implementing class is in this example YCL_IM_RSLPO_BADI_PARTITIONING.
Figure 4: BAdI Implementation Overview
From here you can go to the implementing class. Don’t forget to enter a bit of coding into every of the five single interface methods, otherwise they won’t be implemented. A comment is enough for the time being, further enhancement can be done later.
Figure 5: Implementing Class
You can use the Class Builder to change the implementing class YCL_IM_RSLPO_BADI_PARTITIONING.
Go here via t/code SE24 or SAP menu path:
Tools > ABAP Workbench > Development > Class Builder
Overview of the Interfaces
The following screenshot shows the interfaces which are used. The BAdI implementation automatically provides them so no manual actions are needed here.
Figure 6: Interfaces
Overview of the Attributes
The following attributes are defined:
- P_TH_CRITERIA – Partition Criteria;
- P_TH_DTP – DTP Templates;
- P_TH_INFOPROV – BAdI Managed InfoProviders;
- P_TH_PATTERN – Partition Patterns;
- P_TH_RSLPO – Current SPOs;
- P_TH_RSLPOPART – Current Partitions;
- P_T_GENPART – Partition Links;
- P_T_GENPARTCRIT – Generated Partition Criteria;
- P_T_LOGSYSMAP – Logical System Conversion;
- P_T_MAXPART – Maximum Set of 99 Partitions;
- P_T_PATTERNT – Partition Patterns Texts;
- P_T_RSLPOPARTRANGE – Current Partition Criteria.
Overview of the Methods
Next to the interface methods (the methods starting with IF_RSLPO_BADI_PARTITIONING~), several other methods were developed for the sake of transparency and source code organization. The following methods are implemented:
- CONSTRUCTOR – CONSTRUCTOR;
- DETERMINE_PARTITION_IDS – Determine Existing and New Partitions;
- GENERATE_DTPS – Generate DTPs;
- GENERATE_MAX_PARTITIONS – Generate Maximum Set of 99 Partitions;
- GENERATE_PARTITION_COUNTERS – Generate Partition Counters;
- GENERATE_PARTITION_CRITERIA – Generate Partitioning Criteria;
- GENERATE_PARTITION_TEXTS – Generate Partition Texts;
- MAIN_PROCEDURE – Main Procedure for Partitions and Partition Criteria;
- POSTPROCESS_PARTITION_CRITERIA – Postprocess Partitioning Criteria;
- READ_CONTROL_TABLES_FROM_DB – Read Control Tables from Database;
- READ_LOGSYSMAP_FROM_DB – Read Logical System Mapping Table from Database;
- READ_SPO_TABLES_FROM_DB – Read SPO Tables from Database.
Source Code of the Implementing Class
Please refer to the attached text document for the source code of the implementing class
You can easily copy and paste the source code in the Class Builder. Switch from the “Form-Based” to the “Source Code-Based” maintenance.