Technology Blogs by SAP
Learn how to extend and personalize SAP applications. Follow the SAP technology blog for insights into SAP BTP, ABAP, SAP Analytics Cloud, SAP HANA, and more.
cancel
Showing results for 
Search instead for 
Did you mean: 
jaigupta
Product and Topic Expert
Product and Topic Expert
8,017

Introduction

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. 

  1. An Introduction to Hierarchy with Directory 
  2. Modeling a basic Hierarchy with Directory
  3. Modeling an advanced Hierarchy with Directory
  4. Guide: Create SAP S/4HANA External GL Account Hierarchy within SAP Datasphere through Community Content packages (Current Blog)
  5. Walkthrough of different Enterprise Scenarios via Community Content package – GL Account External Hi...
  6. Explanation of Community Content Package - GL Acco... - SAP Community
  7. Order siblings in a Hierarchy with Directory

Further, in the current and upcoming blogs, we will be explore this feature with the help of community content delivered packages, present @ GITHUB, within context of SAP S/4HANA External Hierarchies like GL Account, Cost Center etc. in SAP Datasphere.
In current blog, I am going to use the GL Account replication flow package from the community content. This package contains the GL Account entities as shown within the the red rectangle in Fig 1.

Fig 1 :GL Account Entities Logical Diagram

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

On a 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.
Please refer to blog - Walkthrough of different Enterprise Scenarios via Community Content package – GL Account External Hi... which build upon current blog knowledge and further explains how community content package can be used for different enterprise scenarios.

Prerequisites

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  help.sap 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 - https://help.sap.com/docs/SAP_DATASPHERE/be5967d099974c69b77f4549425ca4c0/b607a12931d74c4a93506ea64c...

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

Step 1: Import Package

1.1 First step, download the Community Content package - GL Account External Hierarchy with 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


Purpose


Technical Name


Business Name


Semantic


1

GL Account Hierarchy Directory

SAP_CC_FI_HRF_GLAccountHierDir

HRF: G/L Account Hierarchy Directory (DIM)

Dimension

GL Account Hierarchy Directory Text

SAP_CC_FI_HRF_IL_T_GLAccountHierDir

HRF: G/L Account Hierarchy Directory - Text (IL)

Text

2

GL Account Hierarchy Directory Node

SAP_CC_FI_HRF_GLAccountHierNode

HRF: G/L Account Group (Hierarchy Node) (DIM)

Dimension

GL Account Hierarchy Directory Node Text

SAP_CC_FI_HRF_IL_T_GLAccountHierNode

HRF: G/L Account Group (Hierarchy Node) - Text (IL)

Text

3

GL Account Master Data External Hierarchy

SAP_CC_FI_HRF_GLAccountHierarchyView

HRF: G/L Account Hierarchy (Hierarchy with Directory)

Hierarchy with directory

4

GL Account Master Data Text

SAP_CC_FI_H_IL_T_GLAccount

HRF: G/L Account - Text (IL)

Text

5

GL Account Master Data Dimension

SAP_CC_FI_HRF_GLAccount

HRF: G/L Account (DIM)

Dimension

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.

Step 2: Replication Flow

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


Purpose


I_GLACCOUNTHIERARCHY

SAP_CC_FI_HRF_IL_I_GLACCOUNTHIERARCHY

Local Table for GL Account Hierarchy View

I_GLACCOUNTHIERARCHYTEXT

SAP_CC_FI_HRF_IL_I_GLACCOUNTHIERARCHYTEXT

Local Table for GL Account Hierarchy Text

I_GLACCOUNTHIERARCHYNODE

SAP_CC_FI_HRF_IL_I_GLACCOUNTHIERARCHYNODE

Local Table for GL Account Hierarchy Node

I_GLACCOUNTHIERARCHYNODET

SAP_CC_FI_HRF_IL_I_GLACCOUNTHIERARCHYNODET

Local Table for GL Account Hierarchy Node Text

I_GLACCOUNTINCHARTOFACCOUNTS

SAP_CC_FI_HRF_IL_I_GLACCOUNTINCHARTOFACCOUNTS

Local Table for GL Account Master data Attributes

I_GLACCOUNTTEXTRAWDATA

SAP_CC_FI_HRF_IL_I_GLACCOUNTTEXTRAWDATA

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

Step 3: Fact

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 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).

Step 4: Analytical Model

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.

Step 5: Analytic Model Preview

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

Conclusion

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, you can now refer to next blog - Walkthrough of different Enterprise Scenarios via Community Content package – GL Account External Hi... which build upon current blog knowledge and further explains how community content package can be used for different enterprise scenarios.

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 .

8 Comments