BPC BW Hierarchy
BPC BW Hierarchy
BPC BW Hierarchy
org
BPC Classic (Standard) 10.1 on Netweaver platform uses objects in SAP BW, however in many cases the
level of integration with BW requires custom development. In the post below I will review steps needed
for a BPC dimension hierarchy to be updated automatically from infoobject attributes in SAP BW.
Table of Contents
Generate BPC Hierarchy from BW.................................................................................................................. 1
Business Case ......................................................................................................................................... 1
BW Model for Profit Center InfoObject ................................................................................................. 1
Convert Attributes to a hierarchy using Expert Routine ...................................................................... 2
Upload BW infoobject hierarchy in BPC ................................................................................................ 6
Review Profit Center hierarchy in BPC .................................................................................................. 7
Business Case
Let us review a business case where users maintain Profit Center hierarchy in SAP BPC for planning
purposes. Once a certain planning scenario is approved Profit Centers are being created in the ERP
system. Profit Centers are linked to Business Units in ERP and eventually have to be integrated to SAP
BPC as actual values under proper (existing) BU nodes. Technically this requires loading Profit Center –
Business Unit mapping from ERP to BW, converting this mapping into a BW hierarchy utilizing existing
BPC hierarchy structure, and finally updating BPC hierarchy with the new nodes.
Page | 1
www.biportal.org
Here is the ABAP code I have used in the Expert routine to generate the hierarchy:
* Update Source table with the existing BPC hierarchy for Profit Centers
DATA: sr TYPE _ty_s_SC_1.
Page | 2
www.biportal.org
DATA: pc_bpc
TYPE SORTED TABLE OF ty_pcbpc
WITH NON-UNIQUE KEY NODEID.
FIELD-SYMBOLS: <pc> TYPE ty_pcbpc, <pc1> TYPE ty_pcbpc.
sr-/BIC/ZCLASSIF = 'BPC'.
LOOP AT pc_BPC ASSIGNING <pc>.
* Check if node is already in Source
READ TABLE SOURCE_PACKAGE TRANSPORTING NO FIELDS
WITH KEY /BIC/ZPROFCTR = <pc>-NODENAME.
IF sy-subrc <> 0.
* Add PC line if not already in source
sr-/BIC/ZPROFCTR = <pc>-NODENAME.
READ TABLE pc_BPC ASSIGNING <pc1>
WITH TABLE KEY NODEID = <pc>-PARENTID.
IF sy-subrc = 0.
* If there is a parent in BPC hier use it
sr-/BIC/ZBUSUNIT = <pc1>-NODENAME.
ELSE.
sr-/BIC/ZBUSUNIT = ''.
ENDIF.
INSERT sr INTO TABLE SOURCE_PACKAGE.
ENDIF.
* ENDIF.
ENDLOOP.
Page | 3
www.biportal.org
DELETE SOURCE_PACKAGE.
ENDIF.
ENDLOOP.
ENDDO.
* T1 ------------------
DATA: rp1 TYPE _ty_s_TG_1.
rp1-H_HIENM = 'BUH'.
rp1-H_STARTLEV = '1'.
INSERT rp1 INTO TABLE RESULT_PACKAGE_1.
Page | 4
www.biportal.org
TRY.
an = <SOURCE_FIELDS>-/BIC/ZPROFCTR. "Convert string to number.
CATCH cx_sy_conversion_no_number.
pv_error = 1.
CATCH cx_sy_conversion_overflow.
pv_error = 2.
ENDTRY.
IF pv_error = 0.
a = an. SHIFT a RIGHT. TRANSLATE a USING ' 0'.
ELSE. a = <SOURCE_FIELDS>-/BIC/ZPROFCTR.
ENDIF.
rp-H_HIERNODE = a.
rp-/BIC/ZPROFCTR = <SOURCE_FIELDS>-/BIC/ZPROFCTR.
INSERT rp INTO TABLE RESULT_PACKAGE_3.
ENDLOOP.
After the transformation execution we get a hierarchy for the infoobject zprofctr with the new values
Profit Centers from ERP integrated in the existing hierarchy structure from BPC:
Page | 5
www.biportal.org
*MAPPING
NODENAME=NODENAME
HIER_NAME=HIER_NAME
PARENT=PARENT
ORDER=ORDER
*CONVERSION
HIER_NAME= CONV_HIER.xls
Conversion File
EXTERNAL INTERNAL FORMULA
* PARENTH1
Page | 6
www.biportal.org
Run Package
Page | 7
www.biportal.org
In the final step I would suggest automating data loads in BW with process chains followed by Package
run scheduling in BPC.
Even though the logic for generating the hierarchy is contained in one ABAP script the approach
described in this post may sound complex or artificial. I have to admit this complexity won’t be
necessary in the case of SAP BPC Embedded as BW infoobjects and their hierarchies are directly
consumed in the BPC Embedded models.
Page | 8