Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Applies to:
SAP Netweaver 2004 (BW 3.x), Netweaver 2004S, EHP1 and EHP2 (BW 7.x). For more information, visit the
EDW homepage.
Summary
0ACCOUNT, 0PROFIT_CTR and 0STKEYFIG are some infoobjects that have hierarchies. Unfortunately, 1
infopackage is to load 1 hierarchy only.
If you have 500 hierarchies for all of them above, you have to manually click execute 500 times, or create
500 InfoPackages in process chain.
This solution will help you automate loading those hierarchies. It is BI (10%) and ABAP (90%) solution.
Author Bio
Dex has 15 years IT experience. First 8 years as programmer / system analyst. Remaining as SAP
consultant and his core skill is SAP BW + BO module.
SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com
2011 SAP AG 1
How to Automate Loading Hierarchies from R3 / ECC
Table of Contents
Purpose............................................................................................................................................................... 3
Case Study / Scenario sample ........................................................................................................................... 3
Solution ............................................................................................................................................................... 3
1: Using Standard SAP Function Module ....................................................................................................... 3
2: Creating Custom infoPackage with Embedded ABAP Code ...................................................................... 4
3: Call above Infopackage using BAPI Standard Function Module. BAPI_IPAK_START .............................. 4
4: Utilize TVARV Table ................................................................................................................................... 4
Step 1: ......................................................................................................................................................................... 4
Step 2: ......................................................................................................................................................................... 4
Step 3: ......................................................................................................................................................................... 4
Step 4: ......................................................................................................................................................................... 4
Step 5: ......................................................................................................................................................................... 5
Appendix A. How to use the Program ................................................................................................................ 6
Appendix B. Three additional infoObjects just for screen programming ............................................................ 8
Appendix C. Additional Match Code for Screen Programming ........................................................................ 11
Appendix D. Create InfoPackage which to be called by ZHIERLOAD ............................................................. 14
Appendix E. ZHIERLOAD Source Code ........................................................................................................... 17
Related Content ................................................................................................................................................ 20
Disclaimer and Liability Notice .......................................................................................................................... 21
SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com
2011 SAP AG 2
How to Automate Loading Hierarchies from R3 / ECC
Purpose
ZHIERLOAD is an ABAP Program created using SE38. The purpose of this program is to automate loading
hierarchies.
If we have 4 hierarchies like below, then we need to run this Infopackage one-by-one.
Solution
We will develop an ABAP program, and create some customized InfoPackage. It has 4 core components as
follow:
SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com
2011 SAP AG 3
How to Automate Loading Hierarchies from R3 / ECC
Step 1:
We reuse a SAP standard table for our purpose. The table is TVARV
Step 2:
We need to modify infopackage Load Hierarchy from ABAP (ZPAK_DA4ZAZIXQAWFVUZQ0F4HESSC2) as
follow
Step 3:
Use ABAP on Dynamic hierarchy Selection
Step 4:
Choose Determine Using Routine
SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com
2011 SAP AG 4
How to Automate Loading Hierarchies from R3 / ECC
Step 5:
In the routine just type as follow.
Appendix B and Appendix C are basically just for the sake of the screen programming and user interface
sake. The core engine and logic is summarized above.
Appendix D is a reference how to create a typical infopackage, which will be called by ZHIERLOAD .
SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com
2011 SAP AG 5
How to Automate Loading Hierarchies from R3 / ECC
SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com
2011 SAP AG 6
How to Automate Loading Hierarchies from R3 / ECC
Choose if you want to load the data. If you dont check, the program will skip the
hierarchy.
In our sample we want to load 0ACCOUNT Hierarchy with infopackage Load Hierarchy from ABAP
(ZPAK_DA4ZAZIXQAWFVUZQ0F4HESSC2). The source system is IDECLNT800 source system. Therefore
the screen should look like below:
SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com
2011 SAP AG 7
How to Automate Loading Hierarchies from R3 / ECC
Above types are infoObjects, and they are created for the sake of screen programming. You can create
above types by creating those InfoObjects as follow:
SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com
2011 SAP AG 8
How to Automate Loading Hierarchies from R3 / ECC
SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com
2011 SAP AG 9
How to Automate Loading Hierarchies from R3 / ECC
The master data / text configuration are identical for three of them. For the sake of simplicity, I just print
screen ZSK_HIER
SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com
2011 SAP AG 10
How to Automate Loading Hierarchies from R3 / ECC
Its based on a database view called by the same name, ZIPAK_LIST. ZIPAK_LIST View is based on
InfoPackage table: RSLDPIO and RSLDPIOT
SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com
2011 SAP AG 11
How to Automate Loading Hierarchies from R3 / ECC
SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com
2011 SAP AG 12
How to Automate Loading Hierarchies from R3 / ECC
SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com
2011 SAP AG 13
How to Automate Loading Hierarchies from R3 / ECC
SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com
2011 SAP AG 14
How to Automate Loading Hierarchies from R3 / ECC
Type sample 1, choose Hierarchies, Click save and you will see something like following:
Next, Choose determine using routine and click the new button:
SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com
2011 SAP AG 15
How to Automate Loading Hierarchies from R3 / ECC
Click the editor, and you will have screen similar to below.
SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com
2011 SAP AG 16
How to Automate Loading Hierarchies from R3 / ECC
REPORT zhierload.
DATA:
l_t_hiers LIKE TABLE OF rshiertrsf,
l_s_hiers LIKE rshiertrsf,
it_return LIKE TABLE OF bapiret2,
l_pc_hier TYPE /bic/oizpc_hier,
l_ac_hier TYPE /bic/oizac_hier,
l_sk_hier TYPE /bic/oizsk_hier,
d_ucomm LIKE sy-ucomm,
l_t_myscreen TYPE TABLE OF screen WITH HEADER LINE.
CONSTANTS:
ds_ac TYPE c LENGTH 60 VALUE '0ACCOUNT_0109_HIER',
ds_pc TYPE c LENGTH 60 VALUE '0PROFIT_CTR_0106_HIER',
ds_sk TYPE c LENGTH 60 VALUE '0STKEYFIG_0104_HIER'.
AT SELECTION-SCREEN.
d_ucomm = sy-ucomm.
AT SELECTION-SCREEN OUTPUT.
LOOP AT SCREEN.
IF p_ac0010 = ' ' AND screen-group1 = 'A01'.
screen-input = 0.
SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com
2011 SAP AG 17
How to Automate Loading Hierarchies from R3 / ECC
p_ac0030 = ''.
ENDIF.
IF p_ac0010 = 'X' AND screen-group1 = 'A01' AND screen-name = 'P_AC0030'.
screen-required = 1.
ENDIF.
MODIFY SCREEN.
ENDLOOP.
START-OF-SELECTION.
SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com
2011 SAP AG 18
How to Automate Loading Hierarchies from R3 / ECC
IF <l_myscreen_data> EQ 'X'.
l_process_this = 'X'. "sequence 100 determine to process seq 20 and onwards
* find the datasource from l_t_my_screen-name
CONCATENATE 'DS_' <l_t_myscreen>-name+2(2) INTO l_ds_variable.
ASSIGN (l_ds_variable) TO <l_ds_variable>.
l_chabasnm = <l_ds_variable>.
ENDIF.
ENDIF.
LEAVE PROGRAM
SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com
2011 SAP AG 19
How to Automate Loading Hierarchies from R3 / ECC
Related Content
NW70 Infopackage in detail
Defining Selection Screens (ABAP SE38)
Match code / ABAP Search Help
BAPI - In general
BAPI_IPAK_START - BAPI for infopackage
For more information, visit the EDW homepage.
SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com
2011 SAP AG 20
How to Automate Loading Hierarchies from R3 / ECC
SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com
2011 SAP AG 21