Guide:Create SAP S/4HANA External GL Account Hierarchy within SAP Datasphere through Community Content packages
2024-1-15 23:32:44 Author:查看原文) 阅读量:33 收藏

Recently, Analytical models within SAP Datasphere started supporting the External Hierarchy Directory feature. To assist SAP Datasphere users with this feature, we are starting with this new blog series.In the blog series, we will be using the community content delivered packages, present @ GITHUB, for creating SAP S/4HANA External Hierarchies like GL Account, Cost Center in SAP Datasphere.

For the first blog in this journey, I am going to use the GL Account replication flow package from the community content. This package contains GL Account objects within the the red rectangle as shown in the Fig 1.

Fig 1 :GL Account Entities Logical Diagram

Once we import this package, these objects will get created within the SAP Datasphere and , thereafter, they can be linked to facts and subsequently consumed via Analytic Models.

On high level, below steps will be shown in this blog.

  • Download and Import Package – This will create the data entities related to GL Account Master Data Dimension along with Texts and External Directory Hierarchy in SAP Datasphere, as shown in Fig 1.
  • Replication Flow – This is required to replicate data into the underlying Local tables of the Hierarchy objects, imported in the previous step, via ABAP CDS views from SAP S/4HANA.
  • Create/Adapt Fact – Create or reuse transactional data objects(Facts) for GL Account Line-Item data and then associate it with the GL Account Master Data Dimension from previous step.
  • Create/Adapt Analytic Model – Create or reuse Analytic Model on top of Fact created/adapted in the previous step.
  • Analytic Model Preview – Last step, use Analytic Model preview to view the External GL Account Hierarchy.

Please note that community content package can only be imported to default SAP_COMMUNITY space. This may or may not fit your Datasphere landscape architecture, and for this a new blog will be published explaining how to make use community content package for different enterprise scenarios.

First and foremost, please ensure that the target space – SAP_COMMUNITY, is already present/created within your SAP Datasphere tenant because, as mentioned previously, we can only import the community content package into this space. Also, please make sure you have the relevant Scoped roles assigned to you on this space for working on these imported objects.

If you are working with community content for the first time then please make yourself familiar with it by checking the documentation, mainly section – ‘How to download and install community content in general‘.

Also, check if you have proper configurations in place in SAP Datasphere, as mentioned in Downloading and Uploading Local Files with the Content Network | SAP Help Portal.

Further, please note that only DW Administrator or DW Space Administrator can import the packages within SAP Datasphere tenant as mentioned in –

Last but not least always refer to README file in the GITHUB for specific installation instructions before proceeding with the package installation.


1.1 First step, download the community content package for GL Account for Replication flow  from GITHUB URL.

Fig 1.1: GITHUB GL Account package

1.2 Once the file is downloaded, go to the Transport->Import and click on the Upload icon, as shown below.


Fig 1.2: Community Package – Start Import Process

1.3 Next, select the downloaded package and choose Open.

Fig 1.3: Select the package

1.4 Once the package is uploaded, refresh the screen and search for your package.

Fig 1.4: Check Uploaded Package

1.5 To start the import of the package, click on the package name and then select the ‘Import options’ and Click on Import button, as shown below .

Fig 1.5: Select Import options and Start Import

1.6 Once import is done, refresh the screen to get the Success message.Further, you can click on Success to view the Import Summary.


Fig 1.6: Import Success message

1.7 After the import, please check if below objects are available within the SAP_COMMUNITY space.


Fig 1.7: Imported Objects

1.8 Finally, deploy all the objects by selecting the checkbox icon on the left and then clicking on Deploy icon.

Fig 1.8 Deploy objects

Therefore, by the end of this step, for each Numerical value,1-5, mentioned in the Fig 1.9, a corresponding data object gets created in space SAP_COMMUNITY matching with the Numerical value mentioned in the column ‘Numerical Value’ in Table 1.

Fig 1.9: GL Account Entity Logical Diagram

Numerical Value


Technical Name

Business Name


GL Account Hierarchy Directory
HRF: G/L Account Hierarchy Directory (DIM)
GL Account Hierarchy Directory Text
HRF: G/L Account Hierarchy Directory – Text (IL)
GL Account Hierarchy Directory Node
HRF: G/L Account Group (Hierarchy Node) (DIM)
GL Account Hierarchy Directory Node Text
HRF: G/L Account Group (Hierarchy Node) – Text (IL)
GL Account Master Data External Hierarchy
HRF: G/L Account Hierarchy (Hierarchy with Directory)
Hierarchy with directory
GL Account Master Data Text
HRF: G/L Account – Text (IL)
GL Account Master Data Dimension
HRF: G/L Account (DIM)

Table 1: GL Account Logical Diagram and Community package objects Relationship

Please note that Table 1 doesn’t list all the intermediate or wrapper views which are imported as well from the package.


As external hierarchies are data-driven, therefore, to feed the imported Local tables from the community content package below mentioned ABAP CDS views will be used in the replication flow.

Source CDS View

Imported Local Table


Local Table for GL Account Hierarchy View
Local Table for GL Account Hierarchy Text
Local Table for GL Account Hierarchy Node
Local Table for GL Account Hierarchy Node Text
Local Table for GL Account Master data Attributes
Local Table for GL Account Master data Text

Table 2: Replication Flow ABAP CDS View mapping

Please note that before creating a replication flow, an active SAP S/4HANA connection is needed for this scenario.

2.1 Go to SAP_COMMUNITY within Data Builder and choose ‘New Replication flow‘.


Fig 2.1: Create New Replication Flow

2.2 Next, Select ‘Browse Source Connection’ and choose desired SAP S/4HANA connection in your landscape.


Fig 2.2 Add Source Connection

2.3 Then, click on ‘Select Container’ and choose ‘CDS_Extraction’, as shown below.


Fig 2.3: Select container

2.4 After this, click on ‘Add Source Objects’ button in the Canvas, as shown below.


Fig 2.4: Add Source objects

2.5 In the pop up window, search for the term I_GLACCOUNT to get the list of CDS views related to GL Account, choose the one mentioned in the Table 2 column ‘Source CDS View’ at the beginning of this section, and click on Next.


Fig 2.5 Choose CDS Objects

2.6 Next, click on ‘Add selection’, as shown below.


Fig 2.6: Add Selected CDS objects

2.7 Then, add the target repository, as shown below:


Fig 2.7 Choose Target Repository

2.8 For target, please choose ‘SAP Datasphere Local repository‘, as shown below.


Fig 2.8: Add Datasphere as target repository

2.9 Next, click on ellipsis icon next to each target object and select ‘Map to Existing Target object’.


Fig 2.9: Map to Existing Target local Table

2.10 Then, choose the corresponding local tables which are imported via community content as per Table 2 columns ‘Source CDS View’ and ‘Imported Local Table’, mentioned at the beginning of this step.


Fig 2.10: Choose Imported Local Tables

Here, I am not using any filters, projections and doing the initial/full load to replicate the data within GL Account community package local tables because none of these ABAP CDS views support Change Data Capture.

2.11 Next, deploy the replication flow.


Fig 2.11: Deploy RF

2.12 Once deployed, trigger the replication flow by clicking on Run icon, as shown below.


Fig 2.12: Run RF

2.13 Next, wait for the status to change to Completed. Further, to get detail logs, please open Replication Flow monitor, as shown below.


Fig 2.13: RF Status

2.14 As a quick validation step, please check the Initial Load operations in Metrics to check the no of rows added to each view.


Fig 2.14: RF Monitor


3.1 Next, please replicate the GL Account line-item data(Fact) using replication flow. For replication flow, please follow the same steps as shown in Step 2 and this time use ABAP CDS VIEW, I_GLACCOUNTLINEITEMRAWDATA.

Fig 3.1: GL Account line Item RF

In my scenario, I am only loading data for FY 2022 but feel free to change or alter it as per your requirement.

3.2 After that, please build a view with semantic as Fact on top of the local table.Fig%203.3%20Create%20GL%20Account%20fact

Fig 3.2: Create GL Account fact

3.3 Once Fact view is there, please associate it with the GL Account Master Data Dimension – HRF: G/L Account (DIM) (SAP_CC_FI_HRF_GLAccount), as shown below:


Fig 3.3: Associate fact with GL Account Master data

At the end of this step, you should have built the GL Account Fact source and associated it with the GL Account Master Data dimension view – HRF: G/L Account (DIM) (SAP_CC_FI_HRF_GLAccount).


4.1 As the final step,please create an analytical model on the Fact Source created in the previous step by clicking on ‘Create Analytic Model’ option in the Fact View.


Fig 4.1: Create Analytic Model

4.2 Once the Analytic model is created, then please select the required dimensions, attributes and measures from the Fact Source. Please don’t forget to add the GL Account Master data dimension as it will be used for showing the Hierarchy feature later.


Fig 4.2: Analytic model

4.3 Further in my Analytic model, I have also created the Reference Date variable as well which will be used to identify the valid time intervals for the time-dependent feature within hierarchies like valid hierarchies and their description, valid hierarchy nodes and their descriptions etc. within the Datasphere.


Fig 4.3 Ref Date Variable AM

Please note in the absence of this variable, for time-dependent related features current date is used as default.

4.4 Finally, deploy the Analytic Model.


5.1 Next, to view the GL Account External Hierarchy, please switch to Analytic Model preview and  enter the relevant input Key Date to get the relevant time-dependent Hierarchy data in the preview.


Fig 5.1 Analytic Model Preview

5.2 After entering the relevant Input Date, please drag the GL Account into the Rows/Columns.


Fig 5.2 Drag GL Account To Rows/Columns

5.3 Then, right click and choose Hierarchy->Select Hierarchy.


Fig 5.3 Select GL Account Hierarchy

5.4 Next, from the opened dialog box, please select the relevant hierarchy.


Fig 5.4 Choose Hierarchy

Please note that here the hierarchy list and its descriptions will be different in your system and they are loaded based on the valid time intervals on the input reference date variable. Further, for the descriptions/texts, default language setting in the Datasphere user account is used.

5.5 Once the hierarchy is selected, preview screen gets refresh to show the selected hierarchy, as shown below.


Fig 5.5 GL Account Hierarchy Output

• For the root node, the Parent Node value must be NULL. Otherwise, you might experience an error, during the data preview of the Analytical Model. In BW, the parent node value was 00000 instead of NULL for the node type R (root node). And the system was searching for the parent node 00000 which is not available. In this a formula or a transformation should be applied accordingly.

• If the data is not replicated, and if it’s getting fetched from remote system, please expect a delayed response. To have better performance of the Analytical Models, please replicate the data in local tables.

In this blog, I have shown a quick approach on How to use the community content GL Account Replication Flow package for consuming the GL Account External Hierarchy from S/4HANA within SAP Datasphere.

Further, I have shown how it can be linked to the GL Account transaction data and consumed for further analysis within Analytic Model for analytical scenarios within SAP Datasphere.

Also, as mentioned in beginning for enterprise scenarios, where you may want to use you different space or spaces instead of SAP_COMMUNITY, a new blog will be published sooner.

Thanks for reading! I hope you find this blog helpful. For any questions or feedback just leave a comment.

Best wishes,

Jai Gupta

Find more information and related blog posts on the topic page for SAP Datasphere .