Skip to Content

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:

 

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_01_Create_BAdI_Implementation_1.jpg

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_02_Create_BAdI_Implementation_2.jpg

Figure 2: Create BAdI Implementation (2)

 

In the next pop-up window you have to specify further details on the implementation.

 

Figure_03_Create_BAdI_Implementation_3.jpg

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_04_BAdI_Implementation_Overview.jpg

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_05_Implementing_Class.jpg

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_06_Interfaces.jpg

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

YCL_IM_RSLPO_BADI_PARTITIONING.

You can easily copy and paste the source code in the Class Builder. Switch from the “Form-Based” to the “Source Code-Based” maintenance.

To report this post you need to login first.

4 Comments

You must be Logged on to comment or reply to a post.

  1. Sören Reiche

    Thank you very much for this detailed and very helpful article. And I just want to offer you a small enhancement:

    Since SAP has increased the limit of max. patitions from 99 to 1295 you may replace the coding in your method GENERATE_MAX_PARTITIONS with the following to be prepared for the use of 100 and more partitions:

    method generate_max_partitions.
    * Local data declaration
         data:
           l_t_maxpart type rslpo_badi_t_part,
           l_s_maxpart type rslpo_badi_s_part.

    * Initialization
         refresh:
           l_t_maxpart,
           p_t_maxpart.
         clear:
           l_s_maxpart.

    * Check if there are BAdI Managed InfoProviders
         if p_th_infoprov[] is initial.
           return.
         endif.

    * Generate all possible partitions (1295)
         data: l_char1 type c,
               l_char2 type c,
               l_count1 type i,
               l_count2 type i.

         do 36 times.
           if syindex gt 10.
             l_char1 = syabcde+l_count1.
           else.
             l_char1 = syindex 1.
           endif.
           do 36 times.
             if syindex gt 10.
               l_char2 = syabcde+l_count2.
             else.
               l_char2 = syindex 1.
             endif.
             clear: l_s_maxpartidpart.
             concatenate l_char1 l_char2 into l_s_maxpartidpart.
             append l_s_maxpart to l_t_maxpart.
             if syindex gt 10.
               add 1 to l_count2.
             endif.
           enddo.
           clear l_count2.
           if syindex gt 10.
             add 1 to l_count1.
           endif.
         enddo.
    * delete Template-ID ’00’
         delete l_t_maxpart where idpart eq ’00’.

    * Store results in attribute
         p_t_maxpart = l_t_maxpart[].
       endmethod.                    “generate_max_partitions

    (1) 
    1. Sander van Willigen Post author

      Hi Sören,

      Thanks a lot for your positive feedback and sharing your coding enhancement with us. Allow me to make a few small remarks.

      I would like to advise to be careful with generating too many partitions. Technically speaking it’s indeed possible to generate up to 1,295 partitions but is it wise to go into this direction? Please refer to section Maximum Number of Partitions in my blog Pattern-based Partitioning using the SPO BAdI – Part 3: Partitioning Patterns for some reflection.

      Furthermore, please be aware of the maximum of 2 partitioning characteristics in my solution. Although standard SAP allows you to define up to 5 partitioning characteristics, I restricted it intentionally, in line with my first remark.

      It would be great if you could share with us your use case(s) for more than 100 partitions (what is the data volume in total, how many partitions do you need, which database do you use, what is the data retention period, etc.).

      Best regards,

      Sander

      (0) 

Leave a Reply