42

SAP S/4HANA: ODP-Based CDS Extractor Creation

 3 years ago
source link: https://blogs.sap.com/2021/04/15/sap-s-4hana-odp-based-cds-extractor-creation/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client
Technical Articles
Posted on April 15, 2021 5 minute read

SAP S/4HANA: ODP-Based CDS Extractor Creation

0 Likes 40 Views 0 Comments

Introduction:

This blog post will explain how to create a CDS view to be used as an ODP-based extractor in BW. Included will be step-by-step details of all necessary objects and code.

Overview:

CDS views have quickly become a core technology for data modeling within the SAP landscape. These views, which are consumed at the database level, allow developers to create structured and performant models that can be directly exposed to reporting tools or used for data extraction.

NIMBL has successfully utilized CDS views as the source for BW extractions across multiple SAP S/4HANA conversion projects. Faced with extractors not replaced by SAP throughout various modules – including, but not limited to: FI, EH&S, PM, and master data – we were able to effectively implement new, high-performing sources, capable of both full and delta extraction.

How-to:

Prerequisites

  1. First, Eclipse IDE should be installed.
  2. Next, SAP ABAP tools should be installed using the following steps:
    1. On the navigation menu, select Help > Install New SoftwarePicture1-4.png
    2. Add a new repository to add SAP development tools. This link is for the 2019-12 version of Eclipse, and is provided as an example: https://tools.hana.ondemand.com/2019-12Picture2-6.png
    3. For this development, ABAP and BW tools are necessary. Check both options and follow the installation wizard, selecting to allow all installations throughout the process. Eclipse will restart multiple times.Picture3-3.png

Project Creation

  1. In the project explorer of the ABAP perspective, right-click and select New > ABAP Project.Picture4-3.png
  2. Select the system that you wish to work in and proceed through the wizard to connect.Picture5-3.png

View Creation

  1. Under your new ABAP project, either create or navigate to the package you want to work in.
  2. Expanding the package, right-click and select New > Other ABAP Repository Object.Picture6-3.png
  3. In the creation wizard, search for “Data,” and choose “Data Definition” (DDL).Picture7-3.png
  4. The DDL name is limited to 30 characters. NIMBL has found success adhering to the following naming convention: ZCDS_BW<module><view type>_<name>_<data type>
    1. View Types:
      1. BASIC = I
      2. COMPOSITE = C
      3. CONSUMPTION = S
    2.  Data Types:
      1. Attribute = ATTR
      2. Text = TEXT
      3. Hierarchy = HIER
      4. Transactional = TRAN
    3. Example: ZCDS_BWFII_WBRP_TRAN

Using a CDS view as the source for a BW extractor requires the use of two view types:

  1. Basic views, which are created on database tables and fetch results without redundancies. These views are simply raw data from the source tables.
  2. Composite views, which are created on basic views and are used to join/union multiple basic views and perform calculations.

Basic Views

This example is a basic view that pulls data from SAP table WBRK, Settlement Management Document Header.

Picture8-2.png

Annotations

Annotations allow metadata, which is evaluated by either the ABAP runtime environment or the relevant SAP framework. The annotations used in a basic view, and the functions they serve, are described as follows:

@AbapCatalog.sqlViewName: ‘<name>’

Defines the name of the CDS database view. It is limited to 16 characters, and adheres to the following conventions: ZV_BW<SAP module><type><data type>_<name>

Data types are abbreviated as follows: Attribute = A, Text = X, Hierarchy = H, Transactional = T

@AbapCatalog.compiler.compareFilter: true

Defines the evaluation of filter conditions (i.e., INNER, LEFT OUTER, WHERE) in path expressions.

@AccessControl.authorizationCheck: #NOT_REQUIRED

AccessControl annotations restrict the data returned based on CDS roles, access rules, or conditions.

@VDM.viewType: #BASIC

Defines the category of data represented by values.

@ObjectModel.representativeKey: ‘WBELN’

The most specific element of the primary key(s) that represents the entity which the view is based on.

Composite View

This example is a composite view that joins two basic views: one sourced from WBRK, Settlement Management Document Header, and the other from WBRP, Settlement Management Document Item.

Picture9-4.png

Annotations

New annotations and ones that have changed from the basic views are as follows:

@VDM.viewType: #COMPOSITE

Defines the category of data represented by values.

@Analytics.dataCategory: #FACT

Tells the analytic manager how to interpret entities. #FACT represents transactional data.

@Analytics.dataExtraction.enabled: true

Represents a view that is suitable for data replication.

@Analytics.dataExtraction.delta.byElement.detectDeletedRecords

Using this annotation, the system will remember all key combinations of the view that were extracted in delta mode. If a key combination does not occur in the view anymore, this will automatically generate a delete image in the extracted data.

@Analytics.dataExtraction.delta.byElement.name: ‘AEDAT’

Enables the generic delta extraction. This is the element that should be used for filtering during generic delta extraction. This element can either be a date or a UTC timestamp.

@Semantics.quantity.unitOfMeasure

Defines an element as a quantity field, to which a unit of measure key is assigned

@Semantics.unitOfMeasure

Defines an element as a unit of measure key

Datasource Creation

At this phase of development, the BASIS team will generally hold the responsibility of creating the new ODP connection.

  1. In the BW Modeling perspective in Eclipse, expand Data Sources > your ODP CDS folder > your ODP connection to S4.Picture10-5.png
  2. To create the data source
    1. Right-click the source system, select New, and then DataSourcesPicture11-4.png
    2. The project should be defaulted to your BW project and the source system to that selected.Picture12-1.png
    3. Choose Proposal from Operational Data ProviderPicture13-2.png
    4. Search for the desired CDS view and select NextPicture14-1.png
    5. Give the DataSource a description and select Finish

Subsequent steps follow the standard BW development process.

Conclusion:

From this blog post, you should now understand the prerequisites necessary to write CDS views, and to then source BW extractors with those views.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK