SAP Datasphere replication with Change Data Capture on a custom SAP S4 CDS view.

本文详细介绍了如何在S4HANAon-premise环境中创建自定义CDS视图,配置ChangeDataCapture和GenericDate/TimestampDelta,然后在SAPDataSphere中使用InitialplusDelta方式消费这些视图,实现实时材料主数据更新的监控和同步。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Introduction

In this article I will share some experiences of using a custom CDS view on MARA table in S4HANA (onpremise SAP_BASIS 755) and consuming it in SAP Datasphere (version 2024.2.79) for delta enabled replication (Change Data Capture). I will showcase the following : 

  1. Create a Custom CDS view using ADT ( Abap Development Tools) in Eclipse Studio. 
  2. Define CDS annotations for "dataExtraction" and "changeDataCapture".
  3. Consume the CDS view in Datasphere using "Initial plus Delta" option. 
  4. Create a new Material master in S/4HANA & see the updated delta in SAP Datasphere. 

Prerequisties 

Please note before using any CDS view from S4HANA for replication in Datasphere you should ascertain that data replication prerequisites are installed in the S4HANA system. Please refer the following sapnote : 

SAP ABAP Integration Central note

Note : It is recommended to use a standalone SLT server for replicating Tables from S4HANA into datasphere as highlighted in the Abap Integration Central note. 

highly recommend reading this excellent blog post by Simon - CDS based data extraction - Part II Delta Handling.

This blog presents conceptual understanding on the two common mechanisms of capturing Delta and the core concepts around Delta Handling : 

  •  Generic Date/Timestamp Delta

 

 

<span style="background-color:#f5f2f0"><span style="color:#000000"><code class="language-abap"><span style="color:#999999">:</span><span style="color:#999999">{</span>
  dataCategory<span style="color:#999999">:</span> #FACT<span style="color:#999999">,</span>
  dataExtraction<span style="color:#999999">:</span> <span style="color:#999999">{</span>
	<span style="color:#0077aa">enabled</span><span style="color:#999999">:</span> true
	delta<span style="color:#999999">.</span>byElement<span style="color:#999999">:</span> <span style="color:#999999">{</span>
	   <span style="color:#0077aa">name</span><span style="color:#999999">:</span> <span style="color:#669900">'LastChangeDateTime'</span>
	   <span style="color:#999999">}</span>
    <span style="color:#999999">}</span>
  <span style="color:#999999">}</span></code></span></span>

 

 

  • Change Data Capture Delta

 

 

<span style="background-color:#f5f2f0"><span style="color:#000000"><code class="language-abap"><span style="color:#999999">:</span><span style="color:#999999">{</span>
    dataCategory<span style="color:#999999">:</span> #DIMENSION
    dataExtraction<span style="color:#999999">:</span> <span style="color:#999999">{</span>
       <span style="color:#0077aa">enabled</span><span style="color:#999999">:</span> true<span style="color:#999999">,</span>
       delta<span style="color:#999999">.</span>changeDataCapture<span style="color:#999999">:</span> <span style="color:#999999">{</span>
	 automatic <span style="color:#999999">:</span> true
         <span style="color:#999999">}</span>
      <span style="color:#999999">}</span>
<span style="color:#999999">}</span></code></span></span>

 

 

1. Create a Custom CDS View : ADT on Eclipse 

First step here is to install Eclipse Studio & Abap Development tools(ADT) plugin on the Eclipse Studio. Follow the SAP Development Tools page for detailed instructions.

You can also follow instructions from developers tutorial to install ADT.

  • Create new Abap Project and connect to your S4 system
  • Create new Abap Repository Object 

VinayBhatt_1-1706841603575.png

Click on the drop down for Core Data Services and click on Data Definitions : 

VinayBhatt_0-1706853710436.png

Choose a name for the object and then select a Referenced Object from the data dictionary , this can be another CDS view or other Objects like a physical table. Here I have selected MARA table : 

VinayBhatt_3-1706841771126.png

Fill a change request : 

VinayBhatt_4-1706841816285.png

Here we select a Template view : Define View , this step will generate the CDS code along with needed annotations and also using the selected Referenced Object and its data structure for example MARA table will have many different Fields/Columns, all of these will be available to use in the CDS view 

VinayBhatt_5-1706841846630.png

As we see below the CDS code is generated , enter a name for the SQL view and note here that all needed Fields can be selected and new label names can be assigned to standard fields for example : ERNAM field contains name of the person who changed the entry, we can assign a better label here if needed. 

Also note we can use Where clause here to futher filter the data, please follow the developer guide linked above which contains detailed steps.

VinayBhatt_6-1706842140215.png

2. Define CDS annotations 

Put in below annotations for "dataExtraction" and "changeDataCapture" :

 

 

<span style="background-color:#f5f2f0"><span style="color:#000000"><code class="language-abap"><span style="color:#999999">:</span><span style="color:#999999">{</span>
  dataCategory<span style="color:#999999">:</span> #FACT<span style="color:#999999">,</span>
  dataExtraction<span style="color:#999999">:</span> <span style="color:#999999">{</span>
    <span style="color:#0077aa">enabled</span><span style="color:#999999">:</span> true<span style="color:#999999">,</span>
    delta<span style="color:#999999">.</span>changeDataCapture<span style="color:#999999">.</span>automatic<span style="color:#999999">:</span>true
    
    <span style="color:#999999">}</span>
  <span style="color:#999999">}</span></code></span></span>

 

 

This is how the CDS view looks now : 

VinayBhatt_7-1706842278214.png

Save & Activate the View.

Right click the view to change the API state : 

VinayBhatt_8-1706842419437.png

VinayBhatt_9-1706842507337.png

VinayBhatt_10-1706842572863.png

VinayBhatt_11-1706842593976.png

3. Consume the CDS View in SAP Datasphere

In SAP datasphere goto the Data Builder & Click on new Replication flow.

VinayBhatt_12-1706842844119.png

VinayBhatt_13-1706842918270.png

Select source connection & from the drop down select your S4 HANA system connection.

VinayBhatt_14-1706842975458.png

Select CDS as "container".

VinayBhatt_15-1706843079929.png

Select the CDS view developed in Eclipse : 

VinayBhatt_16-1706843139743.png

Click Add Selection : 

VinayBhatt_17-1706843171456.png

Go to the Settings Tab, here you can now see the Delta Option Available : 

VinayBhatt_18-1706843237137.png

Select Delta load Frequency : 

VinayBhatt_19-1706843308198.png

Select a Target - in this case I have selected a Table in Datasphere, Table name is by default the same as the source name. Finally, give a name fo the Replication Flow (Business Name and Technical Name): 

VinayBhatt_0-1706845211703.png

Save & Deploy the Replication view : 

VinayBhatt_1-1706845307674.png

VinayBhatt_2-1706845400612.png

VinayBhatt_3-1706845519960.png

Run the Replication Flow : 

When we run the Replication flow the first step is that the Initial load will be started and then based on the delta load frequency a subsequent run will start to copy over the delta.

VinayBhatt_1-1706846212977.png

Monitor the Run : 

Here we can monitor the Initial Load progress and also check for any errors being reported.

VinayBhatt_2-1706846312004.png

Initial load has finished & now the Replication flow waits for the next Delta run, which will depend on the Frequency selected during the configuration of the Replication Flow : 

VinayBhatt_3-1706846534350.png

VinayBhatt_4-1706846599787.png

4. Create a new Material master in S4HANA

Now we create a new Material in S4HANA and wait for it to be replicated in SAP Datasphere table using the replication flow that we have deployed. 

VinayBhatt_6-1706847114157.png

VinayBhatt_7-1706847202129.png

Replication Flow in Datasphere will start the next run to consume the delta in few mins, but lets check the data in the Replicated Table and filter with this new Material Record : 

VinayBhatt_8-1706847497379.png

Filter the new record : 

VinayBhatt_9-1706847558418.png

The New Material is not available yet, let's wait for the delta run ( 05:00 UTC time as seen previously ) : 

VinayBhatt_10-1706847631800.png

New Delta Run was performed at 05:00 UTC : 

VinayBhatt_0-1706851537802.png

Let's look at the record in the replicated Table and as we see below the new data record is now available : 

VinayBhatt_1-1706851793958.png

Conclusion

This article is an attempt to showcase the various features available in SAP Datasphere and also how some of the S4 CDS views (extraction enabled) can be consumed in SAP Datasphere. Please note the CDS based extraction will be limited based on the S4 version being used and the scenario/tables being used.

This article only covers an example scenario from S4HANA onpremise system (SAP_BASIS 755).

<think>好的,我需要帮助用户了解如何在SAP BW和FIORI之间进行集成,特别是最佳实践和教程。首先,我应该回忆一下SAP BW和FIORI的基本概念。SAP BW是数据仓库解决方案,用于数据整合和报表,而FIORI是SAP的用户体验设计,提供现代化的用户界面。集成这两者可能需要通过数据服务和前端展示的结合。 根据用户提供的引用,特别是引用[3]提到ODataSAP应用中暴露数据的首选协议,很多产品都支持OData来简化集成。这可能是一个关键点。另外,引用[4]提到SAP HANA和BW的关系,可能涉及数据实时性,但用户的问题是关于集成的,所以可能需要更多关注接口和协议。 接下来,我需要考虑集成的步骤。通常,集成可能包括后端数据暴露(如通过OData服务),前端FIORI应用调用这些服务。SAP BW需要将数据以OData形式发布,然后FIORI应用通过消费这些服务来展示数据。引用[5]提到的CDS可能在这里有用,因为CDS可以定义数据模型,可能用于生成OData服务。 最佳实践方面,可能需要提到使用SAP Gateway来创建OData服务,确保性能优化(引用[2]中的性能优化建议),以及遵循SAP的最佳实践,比如合理的数据模型设计。此外,引用[1]提到Datasphere可能替代BW,但用户目前的问题是关于现有BW和FIORI的集成,所以暂时可以忽略这个,但可能需要提到未来的趋势。 可能的步骤包括:1. 在BW中创建查询或信息提供者,2. 通过REST或OData服务暴露数据,3. 使用SAP Gateway发布服务,4. 在FIORI中开发应用调用这些服务。此外,权限管理和性能优化也是需要考虑的。 用户可能需要具体的教程链接或操作步骤,但根据提供的引用,没有直接给出教程链接,所以可能需要建议官方文档或社区资源。同时,引用[5]提到CDS的创建,可能在ABAP环境中创建CDS视图,然后暴露为OData服务,这也是一个可能的途径。 需要确保回答结构清晰,分步骤说明,引用相关的引用内容,比如提到OData时引用[3],性能优化引用[2],数据模型引用[5]等。最后生成相关问题,可能需要围绕其他集成方式、权限管理、性能优化、未来趋势等。</think>### SAP BW与FIORI集成的最佳实践及教程分步说明 #### 1. **后端数据建模与暴露** - **步骤1:在SAP BW中准备数据模型** 通过BW的ADSO(Advanced DataStore Object)或复合提供者(CompositeProvider)构建数据集市,确保数据模型合理设计以避免冗余(引用[^2])。 - 示例:创建BW查询(BEx Query)并激活,支持OLAP多维分析。 - **步骤2:通过OData服务暴露BW数据** 使用SAP Gateway将BW查询或CDS视图(引用[^5])转换为OData服务。 - 技术实现:事务码`/IWFND/MAINT_SERVICE`创建服务,绑定BW对象作为数据源。 - 代码示例(CDS视图): ```abap @AbapCatalog.sqlViewName: 'ZCDS_BW_DATA' define view ZBW_FIORI_Integration as select from /BIC/AZSD_SALES { key region, key product, amount } ``` #### 2. **前端FIORI应用开发** - **步骤3:创建FIORI应用并集成OData服务** 使用SAP Web IDE或Business Application Studio开发FIORI应用,通过`manifest.json`配置OData服务连接。 - 示例代码(UI5控制器中调用OData): ```javascript onInit: function() { var oModel = new sap.ui.model.odata.v2.ODataModel("/sap/opu/odata/sap/ZBW_SERVICE_SRV/"); this.getView().setModel(oModel); } ``` - **步骤4:设计响应式界面** 使用SAPUI5控件(如`SmartTable`、`Chart`)动态展示BW数据,支持实时交互(引用[^4]提到的实时场景)。 #### 3. **权限与性能优化** - **步骤5:配置权限管控** 通过BW的权限对象或HANA数据库角色限制数据访问,确保FIORI应用仅展示授权内容。 - **步骤6:优化性能** 采用BW聚合、HANA计算视图加速查询(引用[^2]),或启用OData分页(`$skip`和$top`参数)减少数据传输量。 #### 4. **测试与部署** - **步骤7:端到端测试** 验证数据一致性及响应速度,使用SAT事务码分析ABAP层性能(引用)。 - **步骤8:部署到SAP Fiori Launchpad** 通过Catalogs和Groups配置应用入口,确保用户可通过统一门户访问。 #### 教程资源推荐 - **官方指南**:参考[SAP Help Portal](https://help.sap.com)中“Integrating BW with SAP Fiori”专题。 - **社区资源**:SAP Community博客搜索“BW FIORI OData Integration”获取实战案例。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

ChampaignWolf

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值