Vous êtes sur la page 1sur 10

How to

Upload CO-PA hierarchies


B USINESS I NFORMATION W AREHOUSE

ASAP How to Paper

Applicable Releases: BW 2.0B, 2.1C, 3.0, 3.1


February 2004

SAP (SAP America, Inc. and SAP AG) assumes no responsibility for errors or omissions in these materials.
These materials are provided as is without a warranty of any kind, either express or implied, including but not limited to, the
implied warranties of merchantability, fitness for a particular purpose, or non-infringement.
SAP shall not be liable for damages of any kind including without limitation direct, special, indirect, or consequential damages
that may result from the use of these materials.
SAP does not warrant the accuracy or completeness of the information, text, graphics, links or other items contained within
these materials. SAP has no control over the information that you may access through the use of hot links contained in these
materials and does not endorse your use of third party web pages nor provide any warranty whatsoever relating to third
party web pages.

HOW TO UPLOAD CO-PA HIERARCHIES

1 Business Scenario
You have setup an operating concern and self defined hierarchies for CO-PA in a R/3 system. You want
to use this hierarchy in the reporting of your connected BW system. The R/3 PlugIns provide
DataSources and extraction modules only for the upload of certain hierarchies, e.g. cost center, cost
element, account, customer, material, etc. No DataSources exist for self defined hierarchies in CO-PA.

2 The Result
In order to upload the self defined CO-PA hierarchies, you have to run a report to generate the
corresponding DataSource. After you have replicated this DataSource to the BW system, you can
upload the hierarchy with an InfoPackage and subsequently use it in your query definitions. The
prerequisite for uploading a CO-PA hierarchy to BW is the existence of the Plugin PI 2001.1 or PI-A
2001.1.
In addition to the PlugIn, you also need the report enclosed in the Appendix of this document. It is
planned to incorporate the report in the next version of the PlugIn. The report does not support the
creation of DataSources for compounded InfoObjects, since the compound information for an InfoObject
does not reside in the R/3 system any more (as in the BW release 1.2). The report also does not
perform extensive consistency checks. It is therefore not recommended to adapt the report to fit your
own requirements.

From Plug-In Release PI2004.1 the hierarchy extractor CO-PA was delivered in the standard release.
The new hierarchy extractor in Profitability Analysis (CO-PA) allows you to load into SAP BW
hierarchies for CO-PA characteristics that you have generated using the Define Characteristic Hierarchy
function (transaction KES3). Therefore, from PI2004.1, you no longer have to use program
ZRKEBWHIERARCHY to create the corresponding DataSource. In place of this program, you can use
the new IMG activity Create Hierarchy DataSource (transaction KEB1) in the IMG under Data Transfer
into the SAP Business Information Warehouse ? Setting for Application-Specific DataSources (PI) ?
Profitability Analysis.

2004 SAP AMERICA , I NC. AND SAP AG

HOW TO UPLOAD CO-PA HIERARCHIES

3 The Step By Step Solution


3.1

Generate the DataSource in the R/3 system

1. Use SE38 to create a report and


include the source coding from the
Appendix.
If you want to have proper selection
texts for the execution of the report,
define the text elements for the
selection texts as shown in the
picture.
From release PI2004.1 you have not
to implement this report in order to
create a DataSource for CO-PA
hierarchies. You can use new IMG
activity Create Hierarchy DataSource
(transaction KEB1).

2. (Only before release PI2004.1)


Activate the report, and exec ute it.
The parameters have to be filled as
follows:

Name of DataSource:
User defined name for the
DataSource

Description:
User defined description for the
DataSource

InfoObject:
InfoObject of the hierarchy
(has to be derived from BW)

CO-PA characteristic:
Name of the CO-PA

2004 SAP AMERICA , I NC. AND SAP AG

HOW TO UPLOAD CO-PA HIERARCHIES

characteristic as defined in the


operating concern

Operating concern:
Name of the operating concern

3. If you want to transport the created


DataSource, you have to assign a
customer defined development
class. You can enter the
development class and a
corresponding transport request in
the popup.

3.2

Upload hierarchy into BW system

2004 SAP AMERICA , I NC. AND SAP AG

HOW TO UPLOAD CO-PA HIERARCHIES

1. Enter the Administrator


Workbench, and select the view for
the Source Systems.
Pick your Source System, and select
DataSource Overview. Position on
the node for Profitability Analysis
and Replicate DataSources.

2. Verify that the hierarchy properties


of the InfoObject you are using are
maintained.

2004 SAP AMERICA , I NC. AND SAP AG

HOW TO UPLOAD CO-PA HIERARCHIES

3. Assign the DataSource to an


InfoSource.
You can either do so by assigning
an InfoSource to the DataSource in
the SourceSystem view or

in the maintenance of the


transfer rules in the InfoSource
view.

2004 SAP AMERICA , I NC. AND SAP AG

HOW TO UPLOAD CO-PA HIERARCHIES

4. After you have assigned the


DataSource to an InfoSource and
activated the Transfer Rules, you
can schedule an InfoPackage to
upload the hierarchy from your
R/3 system.

5. Activate the hierarchy to make it


available for use in queries.

Appendix
REPORT ZRKEBWHIERARCHY MESSAGE-ID RD.
* do not change this program because it updates dictionary
* tables without check of consistency. you have to do the check by
* your own. so avoid to create inconsistencies and ask responsible

2004 SAP AMERICA , I NC. AND SAP AG

HOW TO UPLOAD CO-PA HIERARCHIES


* persons (no error handling implemented yet)
type-pools: RKEA1, RSAP, RSAOT.
* DataSource structure
data:
ls_datasource
lt_datasourcefields
ls_datasourcetext
lt_datasourcetext
ls_oshiecat
ls_ohiecom
lt_ohiecom
lt_mess

TYPE
TYPE
LIKE
TYPE
TYPE
TYPE
TYPE
TYPE

data: g_err
G_FIELDTAB
g_s_FIELDTAB
G_TABNAME

sy-subrc,
RKEA1_FIELDTAB,
RKEA1_FIELDTAB_ENTRY,
DD02L-TABNAME.

like
TYPE
type
LIKE

rsaot_s_osgen,
rsaot_t_osgenfd,
rsgenost,
rsaot_t_osgentext,
rsaot_s_ohiecat,
rsaot_s_ohiecom,
rsaot_t_ohiecom,
rsaot_t_messages.

SELECTION-SCREEN BEGIN OF BLOCK INPN WITH FRAME.


PARAMETERS: P_DS LIKE ROOSOURCE-OLTPSOURCE OBLIGATORY,
P_DP(30)
OBLIGATORY,
P_CH LIKE ROOSOURCE-BASOSOURCE OBLIGATORY.
selection-screen end of block inpn.

" DataSource
" Description
" Basis char.

SELECTION-SCREEN
parameters: P_ER
P_C1
selection-screen

" Tabname ERGK


" CO-PA Char.

BEGIN OF BLOCK INPC WITH FRAME.


LIKE TKEBB-ERKRS OBLIGATORY.
LIKE TKEBWLF-FIELDNAME OBLIGATORY.
end of block inpc.

* Check CO-PA characteristic


at selection-screen on p_c1.
CONCATENATE 'CE0' p_er INTO G_TABNAME.
* Get information about co-pa characteristic. we need rollname and
* domname.
CALL FUNCTION 'RKE_FILL_FIELD_TABLE'
EXPORTING
ERKRS
= p_er
TABNAME
= G_TABNAME
IMPORTING
SUBRC
= g_err
TABLES
FIELDTAB
= G_FIELDTAB
EXCEPTIONS
LEDGER_NOT_DEF
= 1
LEDGER_NOT_FOUND = 2
TABLE_NOT_FOUND = 3
OTHERS
= 4.

2004 SAP AMERICA , I NC. AND SAP AG

HOW TO UPLOAD CO-PA HIERARCHIES


IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
loop at g_FIELDTAB into g_s_FIELDTAB
where FIELDNAME = p_c1.
endloop.
IF SY-SUBRC <> 0.
MESSAGE ID 'RD' TYPE 'E' NUMBER '301' WITH P_C1.
ENDIF.

start-of-selection.

* DataSource header
clear ls_datasource.
ls_datasource-OLTPSOURCE
ls_datasource-TYPE
ls_datasource-APPLNM
ls_datasource-BASOSOURCE
ls_datasource-EXMETHOD
ls_datasource-EXTRACTOR
ls_datasource-STRUCTURE
ls_datasource-TSTPNM
ls_datasource-TSTPDAT
ls_datasource-TSTPTIM

=
=
=
=
=
=
=
=
=
=

p_ds.
'HIER'.
'CO-PA'.
p_ch.
'F1'.
'RKE_BIW_HIERARCHY_TRANSFER'.
'ROHIEROS'.
sy-uname.
sy-datum.
sy-uzeit.

* DataSource text
ls_datasourcetext-LANGU
= SY-langu.
ls_datasourcetext-OLTPSOURCE = p_ds.
ls_datasourcetext-TXTSH
= p_dp.
ls_datasourcetext-TXTMD
= p_dp.
ls_datasourcetext-TXTLG
= p_dp.
append ls_datasourcetext to lt_datasourcetext.
* Hierarchy information
clear ls_oshiecat.
ls_oshiecat-oltpsource
ls_oshiecat-objvers
ls_oshiecat-typehc
ls_oshiecat-domanm
ls_oshiecat-rollnm
ls_oshiecat-fhcatalog
ls_oshiecat-hietabfl
APPEND 'OLTPSOURCE'

=
=
=
=
=
=
=

TO

p_ds.
'A'.
'EIS'.
g_s_FIELDTAB-domname.
g_s_FIELDTAB-rollname.
'RKE_BIW_HIERARCHY_CATALOG'.
'X'.
lt_datasourcefields.

2004 SAP AMERICA , I NC. AND SAP AG

HOW TO UPLOAD CO-PA HIERARCHIES


* Compound information
* Entry for basis characteristic
ls_ohiecom-oltpsource = p_ds.
ls_ohiecom-objvers
= 'A'.
ls_ohiecom-fieldnm
= p_ch.
ls_ohiecom-fieldcmp
= p_ch.
ls_ohiecom-posit
= '0001'.
ls_ohiecom-dtelnm
= g_s_fieldtab-rollname.
APPEND ls_ohiecom TO lt_ohiecom.
* Generate DataSource
CALL FUNCTION 'RSA1_OLTPSOURCE_GENERATE'
EXPORTING
*
I_TESTMODE
= 'X'
i_save_despite_warning = 'X'
i_s_oltpsource
= ls_datasource
i_t_oltpsourcefields
= lt_datasourcefields
i_t_ostext
= lt_datasourcetext
i_s_oshiecat
= ls_oshiecat
i_t_ohiecom
= lt_ohiecom
I_NO_TRANSPORT
= rsaot_c_flag-off
i_with_dynpro
= rsaot_c_flag-off.

2004 SAP AMERICA , I NC. AND SAP AG