Professional Documents
Culture Documents
Integrate BPC NW To Bi7x Technabapnov2010
Integrate BPC NW To Bi7x Technabapnov2010
Applies to:
Document is applicable to all SAP BPC 7.0 NW versions. For more information, visit the Enterprise
Performance Management homepage.
Summary
This document provides an overview of data integration between BPC NW with BI 7.0. SAP Net weaver 7.0
BI is used as the backend server to hold BPC data. Since BPC tool is used for planning and reporting
purposes, it typically needs to references other BPC Application data. This guide will provide reusable FMs
to access those data at ease.
Prerequisite(s):
(1) Foundational understanding of BPC Concepts and Terminologies
(2) Basic understanding of ABAP <field-symbols>
(3) Reading and appreciation of How to Pass Parameters to Custom Logic BADI using START_BADI
Author:
Author Bio
Benedict Yong is a Certified SAP BI Consultant with 5 years SAP experience. He holds a
Bachelor of Management (Australia) and a Diploma in Business InfoTech (Singapore). Prior to his
current employment at Accenture Consulting, he was with Hypercube Consulting, practicing SAP
Analytics and Business Intelligence. He is situated in Singapore and is bilingual in English and
Mandarin.
Table of Contents
Overview ............................................................................................................................................................. 3
Introduction ..................................................................................................................................................... 3
Scenario .......................................................................................................................................................... 3
Approach ......................................................................................................................................................... 3
Main Section for FM ............................................................................................................................................ 4
ZBPC_GET_ATTR_BY_DIM .......................................................................................................................... 4
ZBPC_GET_APPL_API_FOR_UJQ ............................................................................................................... 6
Main Section for Program ................................................................................................................................... 9
ZBPC_API_DRIVER ....................................................................................................................................... 9
Conclusion ........................................................................................................................................................ 12
Appendix ........................................................................................................................................................... 12
ZBPC_GET_ATTR_BY_DIM ........................................................................................................................ 12
ZBPC_GET_APPL_API_FOR_UJQ ............................................................................................................. 13
ZBPC_API_DRIVER ..................................................................................................................................... 15
Related Content ................................................................................................................................................ 18
Disclaimer and Liability Notice .......................................................................................................................... 19
Overview
Introduction
The goal of this how-to guide is to create a set of FM that can easily access BPC Applications Transactional
and Master Data. Hence, reducing development time, project cost and creating business value with a
methodology in place.
Scenario
One sample scenario that may be applicable is that you have a core Sales/Transaction Application that
needs to read Pricing/Rate from another Application to do cross-Application computation.
Or simply, you may just want to access the Master Data of the Dimensions easily with a common approach.
Cross-Application Integration, Standardized Methodology, Reusable Function Modules are some of the
desired development needs for any application platform.
Approach
The scope of this paper will only be restricted to technical level discussions.
We will be creating 2 FM and one driver program. (Do note that you may use the FM directly without going
through the driver program. The program is there to just demonstrate how to use the FM)
ZBPC_GET_ATTR_BY_DIM
This FM reads from multiple BPC system tables (e.g. UJA_DIMENSION, UJA_DIM_ATTR) to gather the
mapping of the field names between BPC and BI.
This FM can be used independently. It reads out an internal table that has two columns, the first column will
be the dimension field and the second column will be the selected attribute field. You also have the option to
just get the text in place of an attribute field by flagging I_TEXT_ONLY = abap_true.
Typical FM 'ZBPC_GET_ATTR_BY_DIM can be used as below:
Sample Output:
ZBPC_GET_APPL_API_FOR_UJQ
This FM has to be used in-conjunction with the standard SAP FM UJQ_RUN_RSDRI_QUERY.
The rationale for doing so is that, you will not know the actual structure of the BPC equivalent InfoCubes for
sure all the time. This is because during Full Optimization, the BPC InfoCubes are deleted from SAP BI and
new replica InfoCube containing the migrated data are linked back to the BPC Application. Either way, we
need to leverage on ABAP/4 RTTS Classes.
From a BPC perspective, Applications are permanent but InfoCubes are just data storage containers. There
is a mapping table in SAP that holds the relationships between individual Application and Infocube (i.e.
UJA_APPL). However, after determining that mapping between the Infocubes and the Applications through
UJA_APPL, you need to get the names of the individual fields of the underlying tables that form the SAP BI
Infocubes from UJA_DIMENSION. And more linkages need to be determined for further integration.
InfoCube
Characteristics
It is best that we use the standard SAP API to access the data from the BPC Application without too much
of a hassle.
cl_uj_model=>get_model( EXPORTING i_appset_id = 'YOUR_APPSET'
RECEIVING ro_model = lo_model ).
"MAKE the TABLE first
lo_model->create_tx_data_ref(
EXPORTING
i_appl_name = 'YOUR_APPLICATION'
i_type
= 'T'
it_dim_name = dt_dim_list
if_tech_name = space
IMPORTING
er_data
= lo_tranx_ref ).
ASSIGN lo_tranx_ref->* TO <lt_final>.
"FILL the TABLE later
CALL FUNCTION 'UJQ_RUN_RSDRI_QUERY'
EXPORTING
i_appset_id
= 'YOUR_APPSET'
i_appl_id
= 'YOUR_APPLICATION'
if_check_security = abap_false
IMPORTING
et_data
= <lt_final>.
"DO whatever you want with the data (i.e. <lt_final>)
.
However, the standard BPC API uses OO ABAP for processing. It might be too awkward for us who are
accustomed to the old FM paradigm. So why not just create a FM to encapsulate the complexity? Pass in
simple strings of requirements and get back the data required.
Typical FM ZBPC_GET_APPL_API_FOR_UJQ should be used as below:
*
MAKE the TABLE first
CALL FUNCTION 'ZBPC_GET_APPL_API_FOR_UJQ'
EXPORTING
i_appset_id
= 'YOUR_APPSET'
i_appl_id
= 'YOUR_APPLICATION'
if_inc_measure = abap_true
IMPORTING
er_data
= lo_metadata.
ASSIGN lo_metadata->* TO <lt_final>.
*
FILL the TABLE later
CALL FUNCTION 'UJQ_RUN_RSDRI_QUERY'
EXPORTING
i_appset_id
= 'YOUR_APPSET'
i_appl_id
= 'YOUR_APPLICATION'
it_dim_name
= lt_column
if_check_security = abap_false
IMPORTING
et_data
= <lt_final>.
"DO whatever you want with the data (i.e. <lt_final>)
.
In summary, there are will always be two-step in accessing data from SAP BPC NW Application using ABAP
(whether through the API or through encapsulation): (1) Dynamically create an internal table that match the
current Application database structure; and (2) Fill the generated table structure with actual data from BPC.
Sample Output:
ZBPC_API_DRIVER
Typically in BPC planning, it will also be great to gain access to the Master Data. To do that, we can call the
FM 'ZBPC_GET_ATTR_BY_DIM'. By using the mentioned BAdI, we will have the main structure ct_data
based on the Current View Application, but we would also like to access the data of another Rate
Application for further computation. To do that, we can call the FM 'ZBPC_GET_APPL_API_FOR_UJQ' &
'UJQ_RUN_RSDRI_QUERY'.
After the related reference data are collected continue with business logic.
Note: This driver program is an adaptation of if_uj_custom_logic~execute. Although the code runs on SE38, it can be
ported back into SE19 BAdI implementation with some modifications.
Sample Output:
Conclusion
Above are some of the functionalities that I have managed to emulate. There are more. One for instance, is
accessing the hierarchy grouping of the TIME dimension. So on and so forth. Most of SAP BPC NW
functionalities are pretty much exposed; with an astute mind, you can probably pick into the locks of BPC. My
personal advice is to explore the object class CL_UJ_MODEL & CL_UJQ_QUERY_UTIL.
The value of this paper is not just in creating a set of usable APIs, but at a more conceptual level it opens up
our minds to more possibilities.
Appendix
ZBPC_GET_ATTR_BY_DIM
FUNCTION ZBPC_GET_ATTR_BY_DIM.
*"---------------------------------------------------------------------*"*"Local Interface:
*" IMPORTING
*"
REFERENCE(I_APPSET) TYPE C DEFAULT 'ZSCA_PLAN_DM'
*"
REFERENCE(I_DIM) TYPE C DEFAULT 'DIM_CSTMR'
*"
REFERENCE(I_ATTR) TYPE C DEFAULT 'SLSDIST'
*"
REFERENCE(I_KEY_ONLY) TYPE C OPTIONAL
*"
REFERENCE(I_TEXT_ONLY) TYPE C OPTIONAL
*" EXPORTING
*"
REFERENCE(ER_DATA) TYPE REF TO DATA
*"---------------------------------------------------------------------TYPE-POOLS: abap, rsd, ujr0, uj00.
TYPES: BEGIN OF ty_package,
dim TYPE string,
attr TYPE string,
END OF ty_package.
TYPES: ty_t_package TYPE STANDARD TABLE OF ty_package.
DATA: lv_select TYPE TABLE OF string.
DATA: lv_table TYPE string.
DATA: lc_cust_tech LIKE uja_dimension-tech_name,
lc_slsd_tech LIKE uja_dim_attr-tech_name.
SELECT SINGLE tech_name FROM uja_dimension
INTO lc_cust_tech
WHERE appset_id = i_appset
AND dimension = i_dim.
lv_table = lc_cust_tech.
IF ( i_text_only NE abap_true ).
REPLACE ALL OCCURRENCES OF REGEX '/CPMB/' IN lv_table WITH '/B28/M'.
REPLACE ALL OCCURRENCES OF REGEX '/CPMB/' IN lc_cust_tech WITH '/B28/S_'.
APPEND lc_cust_tech TO lv_select.
IF ( i_attr NE '').
SELECT SINGLE tech_name FROM uja_dim_attr
INTO lc_slsd_tech
WHERE appset_id = i_appset
AND dimension = i_dim
AND attribute_name = i_attr.
REPLACE ALL OCCURRENCES OF REGEX '/CPMB/' IN lc_slsd_tech WITH '/B28/S_'.
ZBPC_GET_APPL_API_FOR_UJQ
FUNCTION zbpc_get_appl_api_for_ujq.
*"---------------------------------------------------------------------*"*"Local Interface:
*" IMPORTING
*"
REFERENCE(I_APPSET_ID) TYPE UJA_APPL-APPSET_ID
*"
REFERENCE(I_APPL_ID) TYPE UJ_APPL_ID
*"
REFERENCE(IT_DIM_NAME) TYPE UJA_T_DIM_LIST OPTIONAL
*"
REFERENCE(IF_INC_MEASURE) TYPE UJ_FLG DEFAULT 'X'
*" EXPORTING
*"
REFERENCE(ER_DATA) TYPE REF TO DATA
*"---------------------------------------------------------------------TYPE-POOLS: abap, rsd, ujr0, uj00.
DATA:
IF if_tech_name = uj00_cs_flg-true.
ls_comp-name = uj00_cs_iobj-keyfigure.
ELSE.
ls_comp-name = ujr0_c_keyfigure.
ENDIF.
ls_comp-type ?= cl_abap_datadescr=>describe_by_name( ld_signeddata ).
APPEND ls_comp TO lt_comp.
ENDIF.
lo_struct = cl_abap_structdescr=>create( p_components = lt_comp
p_strict
= abap_false ).
CREATE DATA lr_data TYPE HANDLE lo_struct.
ENDIF.
FIELD-SYMBOLS: <l_data> TYPE ANY.
ASSIGN lr_data->* TO <l_data>.
CREATE DATA er_data LIKE TABLE OF <l_data>.
ENDFUNCTION.
ZBPC_API_DRIVER
REPORT
zbpc_api_driver.
COMPONENT
COMPONENT
COMPONENT
COMPONENT
COMPONENT
COMPONENT
COMPONENT
ls_line-time = <ls_time>.
ls_line-p_acct = <ls_acct>.
ls_line-category = <ls_cate>.
ls_line-flow = <ls_flow>.
ls_line-p_datasrc = <ls_dsrc>.
ls_line-rptcurrency = <ls_curr>.
ls_line-signeddata = <ls_amount>.
WRITE: / ls_line-p_acct, ls_line-time, ls_line-signeddata.
APPEND <ls_data> TO <lt_final>.
ENDLOOP.
WRITE: / 'Reference data are collected continue with business logic,'.
Related Content
SDN Central Site for BPC
Dynamic Creation of internal table by RTTC
How to Pass Parameters to Custom Logic BADI using START_BADI
How to Pass Dynamic Parameters to Script Logic
For more information, visit the Enterprise Performance Management homepage.