· 

SAP BW Create SPO via BAdI - Part 2

After we created in part 1 all tables and objects, we can now create a new BAdI to generate the partitions. Go to the transaction se19 and create a new implementation with the Name RSLPO_BADI_PARTITIONING.

BAdI Builder: Create Implementation
BAdI Builder: Create Implementation

Give the enhancement implementation a name and a short text.

Create Enhancement Implementation
Create Enhancement Implementation

Click continue and save. Now specify the BAdI implementation name, the implementation class and the BAdI definition. Select for the BAdI Definition RSLPO_BADI_PARTITIONING, click continue and save.

Enhancement Implementation: Create BAdI Implement
Enhancement Implementation: Create BAdI Implement

After that the following screen appears.

Enhancement Implementation ZDEMO_BADI_PARTITION Change
Enhancement Implementation ZDEMO_BADI_PARTITION Change

Double click the implementation class and the following screen appears. The 6 methods of the class ZCL_DEMO_BADI_PARTITION which we use to define the partitions are displayed in the right panel.

  • GET_T_SPO
  • GET_T_PART
  • GET_T_PART_TEXT
  • GET_T_PART_CRIT
  • GET_T_PART_PROP
  • GET_T_PART_DTP

Each method has a specific role, which you can see under the short description. Double click the method IF_RSLPO_BADI_PARTITIONING~GET_T_SPO.

Enhancement Implementation: Implementing Class
Enhancement Implementation: Implementing Class

First we have to implement the name of the Semantic Partitioning Object (SPO).

1
2
3
4
5
6
7
8
method IF_RSLPO_BADI_PARTITIONING~GET_T_SPO.
  DATA: l_spo TYPE rslponame.
  
  "Return a table with names of supported BAdI SPOs.
  SELECT SPONAME from ZSPOINFOPROV into l_spo.
    APPEND l_spo TO r_t_spo.
  ENDSELECT.
endmethod.

 

Save and activate the method and the class. Now implement the

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
method IF_RSLPO_BADI_PARTITIONING~GET_T_PART.

DATA: l_cnt TYPE i,
      l_posit TYPE i VALUE 1,
      l_id TYPE c LENGTH 2,
      l_s_part TYPE rslpo_badi_s_part,
      "ZSPOINFOPROV Variable
      l_it_spoinfoprov TYPE TABLE OF ZSPOINFOPROV,
      l_wa_spoinfoprov TYPE ZSPOINFOPROV.

SELECT * from ZSPOINFOPROV into CORRESPONDING FIELDS OF TABLE L_IT_SPOINFOPROV where SPONAME = I_SPO.

Loop at L_IT_SPOINFOPROV into L_WA_SPOINFOPROV.
  SELECT COUNT(*) from zspocriteria into l_cnt where PATTERNID = L_WA_SPOINFOPROV-PATTERNID1.
    WHILE l_posit LE l_cnt.
      UNPACK l_posit to l_id.
      l_s_part-IDPART = l_id.
      l_s_part-POSIT = l_posit.
      APPEND l_s_part TO r_t_part.
      l_posit = l_posit + 1.
    ENDWHILE.
    CLEAR l_posit.
  ENDLOOP.
  
endmethod. 

IF_RSLPO_BADI_PARTITIONING~GET_T_PART_TEXT specifies the text for each partition. The problem is, the customer normally named the partitions after his own mind, so I just implemented a comment, so it would be initialized. The comment is necessary.

1
"Coding will follow later

 

Now we implement the IF_RSLPO_BADI_PARTITIONING~GET_T_PART_CRIT. This implementation specifies the partition criteria.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
method IF_RSLPO_BADI_PARTITIONING~GET_T_PART_CRIT.

DATA: l_id TYPE c length 2,
      l_s_part_crit TYPE rslpo_badi_s_part_crit,
      "SPOCRITERIA Variable
      l_it_criteria TYPE TABLE OF ZSPOCRITERIA,
      l_wa_criteria TYPE ZSPOCRITERIA,
      "ZSPOINFOPROV Variable
      l_it_spoinfoprov type table of zspoinfoprov,
      l_wa_spoinfoprov type zspoinfoprov.

SELECT * from ZSPOINFOPROV into CORRESPONDING FIELDS OF TABLE L_IT_SPOINFOPROV where SPONAME = I_SPO.

Loop at L_IT_SPOINFOPROV into L_WA_SPOINFOPROV.
  SELECT * from ZSPOCRITERIA into CORRESPONDING FIELDS OF TABLE l_it_criteria where patternid = L_WA_SPOINFOPROV-PATTERNID1 or patternid = l_wa_spoinfoprov-patternid2 or patternid = l_wa_spoinfoprov-patternid3 or patternid = l_wa_spoinfoprov-patternid4.

  LOOP AT l_it_criteria INTO l_wa_criteria.
    SELECT INFOOBJECT FROM ZSPOPATTERN into l_s_part_crit-IOBJNM where patternid = l_wa_criteria-patternid.
      If L_WA_CRITERIA-HIGHVALUE NE ''.
        l_s_part_crit-opt = 'BT'.
      ELSE.
        l_s_part_crit-opt = 'EQ'.
      ENDIF.
      UNPACK L_WA_CRITERIA-PARTGROUP to l_id.
      l_s_part_crit-IDPART = l_id.
      l_s_part_crit-low = l_wa_criteria-LOWVALUE.
      l_s_part_crit-high = l_wa_criteria-HIGHVALUE.
      l_s_part_crit-posit = L_WA_CRITERIA-PARTGROUP.
      APPEND l_s_part_crit TO r_t_part_crit.
    ENDSELECT.
  ENDLOOP.
ENDLOOP.

endmethod.

The method IF_RSLPO_BADI_PARTITIONING~GET_T_PART_PROP will only be initialized with the following code:

1
"Coding will follow later

 

The next and last method is IF_RSLPO_BADI_PARTITIONING~GET_T_PART_DTP. It specifies the template of the DTP.

 

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
method IF_RSLPO_BADI_PARTITIONING~GET_T_PART_DTP.

DATA: l_posit TYPE i VALUE 1,
      l_cnt TYPE i,
      l_id TYPE c LENGTH 2,
      l_s_part_dtp type rslpo_badi_s_part_dtp,
      "ZSPODTP Variable
      l_it_dtp type table of zspodtp,
      l_wa_dtp type zspodtp,
      "ZSPOINFOPROV Variable
      l_it_spoinfoprov type table of zspoinfoprov,
      l_wa_spoinfoprov type zspoinfoprov.

SELECT * from ZSPOINFOPROV into CORRESPONDING FIELDS OF TABLE L_IT_SPOINFOPROV where SPONAME = I_SPO.

Loop at L_IT_SPOINFOPROV into L_WA_SPOINFOPROV.

  SELECT COUNT(*) FROM ZSPOCRITERIA into l_cnt where PATTERNID = L_WA_SPOINFOPROV-PATTERNID1.
  SELECT * from ZSPODTP into CORRESPONDING FIELDS OF TABLE l_it_dtp where SPONAME = I_SPO.

  LOOP at l_it_dtp into l_wa_dtp.
    l_s_part_dtp-DTPTEMPLATE = l_wa_dtp-DTPTEMPLATE.
    l_s_part_dtp-OBJNM = l_wa_dtp-OBJNAME.
    l_s_part_dtp-LOGSYS = l_wa_dtp-LOGSYS.
    l_s_part_dtp-TLOGO = l_wa_dtp-OBJTYPE.
    WHILE l_posit LE l_cnt.
      UNPACK l_posit to l_id.
      l_s_part_dtp-IDPART = l_id.
      APPEND l_s_part_dtp TO r_t_part_dtp.
      l_posit = l_posit + 1 .
    ENDWHILE.
  ENDLOOP.
ENDLOOP.

endmethod.

After all methods are implemented, activate the Enhancement Implementation. Now we are able to create a Semantic Partitioning Object (SPO). What we need to maintain will be described in Part 3 of this series.

author.


I am Tobias, I write this blog since 2014, you can find me on twitter and youtube. If you want you can leave me a paypal coffee donation. You can also contact me directly if you want.

SAP Analysis for Office - The Comprehensive Guide
The book SAP Analysis for Office - The Comprehensive Guide by Tobias Meyer is a pdf book about SAP Analysis for Office. It is based on Analysis for Office 2.8 and contains 346 Pages.
45,00 €
SAP Analysis for Office - The Comprehensive Guide
SAP Analysis for Office - The Comprehensive Guide is a pdf book about SAP BusinessObjects Analysis for Office. It is based on Analysis for Office 2.7 and contains 299 Pages.
37,00 €
SAP Analysis for Office - The Comprehensive Guide
SAP Analysis for Office - The Comprehensive Guide is a pdf book about SAP BusinessObjects Analysis for Office. It is based on Analysis for Office 2.6 and contains 272 Pages.
27,00 €

Write a comment

Comments: 0