EDUCAÇÃO E TECNOLOGIA

Generic/Custom Master data extraction/load to B4HANA using ABAP CDS views

Introduction

In B4HANA system we can load data using SAP standard extractors(ODP – SAP (Extractors)) and with recent additions in b4hana we can load data from CDS views(ODP – ABAP CDS Views) created in the source or with CDS views created on the B4HANA system too. This blog discusses the master data extraction using the ABAP CDS views.

Applies to

BW/4HANA

Summary

In BW4HANA system we are going to extract the master data from source system the ABAP CDS views.

Author          : Lakshminarasimhan Narasimhamurthy

Created on   : 26/Sep/2021

Body

Requirement

Create a ABAP CDS view to extract all logon user details. So now we are going to create a ABAP CDS view based on table USR21 and then a CDS view based on table ADRP to support the text data.

ABAP CDS view of type with Dimension(Attr)

@Analytics.dataExtraction:{enabled: true} – To make the extraction possible. This is mandatory for the extraction to work.

@Analytics.dataCategory: #DIMENSION – Category can be either Dimension, Cube, Fact, Aggregation level. Here we have used Dimension.

@ObjectModel.dataCategory: #(DIMENSION)

@ObjectModel.representativeKey: – Needed when the CDS view is a Dimension or else you must have association defined in the CDS view to exclude this declaration

@AbapCatalog.sqlViewName: 'ZCDSSAPUSERS'
@AbapCatalog.compiler.compareFilter: true
@AbapCatalog.preserveKey: true
@AccessControl.authorizationCheck: #CHECK
@EndUserText.label: 'SAP Login Users' -- Analytics Data Extraction enabled true
@Analytics.dataExtraction:{enabled: true}
@Analytics.dataCategory: #DIMENSION @ObjectModel.dataCategory: #(DIMENSION)
-- Mandatory for @Analytics.dataCategory: #DIMENSION master data CDS view
@ObjectModel.representativeKey: 'bname' define view ZCDS_SAPUSER as select from usr21 {
key bname as Bname,
persnumber as Persnumber,
addrnumber as Addrnumber,
kostl as Kostl,
start_menu as StartMenu,
idadtype as Idadtype,
bpperson as Bpperson,
organization as Organization,
responsible as Responsible,
techdesc as Techdesc,
identity_guid as IdentityGuid,
template_orgtype as TemplateOrgtype,
template_orgaddr as TemplateOrgaddr }

DataSource created on based on the CDS view(Dimension)

Now further DTP can be created over this datasource and can be loaded further to the ADSO/Infoobject or can be directly consumed by Open ODS view in realtime.

ABAP CDS view of type with Dimension(Text)

The only difference with the previous annotations is the addition of

@ObjectModel.dataCategory: #TEXT

@AbapCatalog.sqlViewName: 'ZCDSSAPUSERT'
@AbapCatalog.compiler.compareFilter: true
@AbapCatalog.preserveKey: false
@AccessControl.authorizationCheck: #CHECK
@EndUserText.label: 'SAP Login Users - Text' -- Analytics Data Extraction enabled true
@Analytics.dataExtraction:{enabled: true}
@Analytics.dataCategory: #DIMENSION @ObjectModel.dataCategory: #TEXT
-- Mandatory for @Analytics.dataCategory: #DIMENSION master data CDS view
@ObjectModel.representativeKey: 'Persnumber' define view ZCDS_SAPUSERT as select from adrp { key persnumber as Persnumber, date_to as DateTo, title as Title, name_first as NameFirst, name_last as NameLast, namemiddle as Namemiddle, name_text as NameText }

DataSource created on based on the CDS view(Text)

Now further DTP can be created over this datasource and can be loaded further to the ADSO/Infoobject or can be directly consumed by Open ODS view.

So far all of these are full loads and in further blogs we will discuss on the Delta capable(Delta fields “Date” and “timestamp”) and the usage of Change data capture to support the delta capapbility,