SAP Business Data Cloud Series – Part 3: Customer-Managed Data Products
Share

[[{“value”:”

Introduction:

In Part 1(SAP Business Data Cloud Series – Part 1: Introduction to Data Products) of this blog series, we explored the fundamentals of Data Products in SAP Business Data Cloud (BDC). In Part 2(SAP Business Data Cloud Series – Part 2: Extend SAP S/4HANA Managed Data Products) we explored on how to extend SAP S/4HANA Data Products. Now, in Part 3, we dive into the practical aspect of creating custom data products for the source SAP S/4HANA Cloud Private Edition and Share it with SAP databricks.

In this article, we’ll explore a common scenario where a customer has a custom CDS entity in SAP S/4HANA and wants to harmonize its data with SAP-managed data products. We’ll demonstrate how to create a custom data product based on that custom CDS entity, for example, ZCDS_CAMPAIGN and how to delta-share with SAP databricks. 

High-level Workflow for the SAP S/4HANA, Customer Managed Data Product:

jeetendrakapase_0-1757470973135.png

Steps to create a SAP S/4HANA Customer Managed Data Product.

1. Identify, create, or extend a CDS entity: To build a customer-managed data product in an SAP S/4HANA system, the recommended approach is to leverage CDS views/entities. In this example, we’ll create a custom CDS entity as shown below.

Note: As a best practice, customers should leverage SAP-released CDS views first, extend them where needed, and only create custom CDS views when business requirements demand it. This is fully permissible under the clean core paradigm, as business requirements ultimately take priority.

@ObjectModel.usageType.dataClass: #TRANSACTIONAL
@ObjectModel.usageType.serviceQuality: #A
@ObjectModel.usageType.sizeCategory: #XL
@ObjectModel.representativeKey: ‘CampaignID’
@ObjectModel.modelingPattern: #ANALYTICAL_DIMENSION
@ObjectModel.supportedCapabilities: [ #ANALYTICAL_DIMENSION,
#CDS_MODELING_DATA_SOURCE,
#CDS_MODELING_ASSOCIATION_TARGET,
#SQL_DATA_SOURCE,
#EXTRACTION_DATA_SOURCE ]

@ObjectModel.sapObjectNodeType.name: ‘CampaignID’
@EndUserText.label: ‘CDS View for Campaigning Data’
@Analytics.dataCategory: #DIMENSION
@Analytics.internalName: #LOCAL
@Analytics: {
dataExtraction: {
enabled: true,
delta.changeDataCapture: {
mapping:[
{
table: ‘zcampaign’, role: #MAIN,
viewElement: [‘CampaignID’],
tableElement: [‘campaign_id’]
}
]
}
}
}

@VDM.viewType: #BASIC
@Metadata.allowExtensions: true
@Metadata.ignorePropagatedAnnotations: true

define view entity ZCDS_campaign as select from zcampaign
{
@EndUserText.label: ‘Campaign_ID’
key zcampaign.campaign_id as CampaignId,
@EndUserText.label: ‘Campaign_Name’
zcampaign.campaign_name as CampaignName,
@EndUserText.label: ‘Channel’
zcampaign.channel as Channel,
zcampaign.type as Type,
zcampaign.start_date as StartDate,
zcampaign.end_date as EndDate,
zcampaign.status as Status,
@Semantics.amount.currencyCode: ‘BudgetCurrency’
zcampaign.budget as Budget,
zcampaign.budget_currency as BudgetCurrency,
@Semantics.amount.currencyCode: ‘ActualSpendCurrency’
zcampaign.actual_spend as ActualSpend,
zcampaign.actual_spend_currency as ActualSpendCurrency,
zcampaign.created_by as CreatedBy,
zcampaign.created_on as CreatedOn

}

2. SAP S/4HANA Private Cloud or On-Premise Edition requires a Cloud Connector: Configure the Cloud Connector to enable communication between your on-premise/private cloud system and SAP Datasphere (public cloud). This setup is a prerequisite for creating an SAP S/4HANA or ABAP connection in SAP Datasphere for using the replication flow feature.

3. Create a Datasphere Space of Type HANA Data Lake Files:  An administrator can create a space backed by SAP HANA Data Lake Files in the object store. File spaces are designed for cost-efficient staging, loading, and preparing large volumes of data.

For detailed instructions, refer to the help guide: Create a File Space in the Object Store.

Additional configuration is required while configuring the SAP Datasphere tenant. e.g.  Memory must be 128GB or more. Check via SAP BDC Estimator.

jeetendrakapase_0-1757439837802.png

If you have configured correctly then you should also see the same under the SAP Datasphere, Tenant configuration. Please note this view is only available to the SAP Datasphere system owner.

jeetendrakapase_1-1757440104618.png

SAP Datasphere object store: Storage type will be SAP HANA Data Lake Files. In our scenario we have created a space with a name Workshop: OBJECT STORE.

jeetendrakapase_0-1757440332599.png

4. Create a SAP S/4HANA Connection in the SAP Datasphere Object Store Space, Workshop: OBJECT STORE :

4.1 Create a new connection or use the existing connection of type SAP S/4HANA on-premise or ABAP:

jeetendrakapase_1-1757440527188.png

 

4.2 Fill in the connection configuration details as show below and important step is select the cloud connector which was setup and configured in the step 2.

jeetendrakapase_1-1757438559949.png

4.3 Provide the connection name and description:

jeetendrakapase_2-1757438613408.png

4.4 Validate and test the connection making sure replication flows are enabled:

jeetendrakapase_2-1757440616171.png

You can also use or create the SAP ABAP connection type for this use case.

jeetendrakapase_0-1757441448676.png

5. Create a Replication Flow to Load Data from CDS Entity into SAP Datasphere Object Store (HDLF):
Set up a replication flow with the source system SAP_S4H_RI4 and CDS entity ZCDS_CAMPAIGN. Define the target as a Datasphere local table ZCDS_CAMPAIGN_BRONZE. This table, serving as the Bronze layer, will store source records and structures in their original form.

5.1 Create a new replication flow

jeetendrakapase_0-1757442253861.png

5.2 Select the Source SAP_S4H_RI4 and Container (Source Objects) ZCDS_CAMPAIGN

jeetendrakapase_1-1757442337508.png

jeetendrakapase_2-1757442489540.png

5.3 Select the target as connection as a SAP Datasphere

jeetendrakapase_0-1757446943694.png

5.4 Provide the target object local table name ZCDS_CAMPAIGN_BRONZE and Deploy the replication flow.

jeetendrakapase_2-1757447070646.png

5.5 Execute the replication flow and check the run details.

jeetendrakapase_3-1757447133249.png

5.6 Perform the merge table activity:

jeetendrakapase_4-1757447196060.png

jeetendrakapase_5-1757447342809.png

5.7 Post merge table activity, data will be available to preview and Test it.

jeetendrakapase_6-1757447404478.png

6. Bronze to Silver layer medallion transformation using a Transformation Flow:  In many cases, data from the Bronze layer needs to be refined into a Silver layer through transformations such as splitting, merging, adding/removing columns, joins, or unions.

In our scenario, we will split the values in the Channel column into two columns Channel, Allocated Percentage (multiple rows) and apply necessary calculations.

6.1 Create a new Transformation Flow

jeetendrakapase_0-1757453446185.png

6.2 Define the transformation steps:

Source table:HDLFT_CAMPAIGN_BRONZE  and Target table: HDLFT_CAMPAIGN_SILVER . Python script operator for performing the transformation logic.

jeetendrakapase_1-1757453655211.png

jeetendrakapase_2-1757453734167.png

def transform(data):
“””
This function body should contain all the desired transformations on incoming data of Pandas DataFrame.
Permitted builtin functions as well as permitted NumPy and Pandas objects and functions are available inside this function.
Permitted NumPy and Pandas objects and functions can be used with aliases ‘np’ and ‘pd’ respectively.
Python standard libraries like ‘time’, ‘datetime’, ‘re’, ‘random’, ‘math’, ‘calendar’ and ‘dateutil.parser’ can be used without any alias.
This function executes in a sandbox mode. Please refer the documentation for permitted objects and functions.
Using any restricted functions or objects would cause an internal exception and result in a run failure.
Any code outside this function body will not be executed and inclusion of such code is discouraged.
:param data: Pandas DataFrame
:return: Pandas DataFrame
“””
#####################################################
# Provide the function body for data transformation #
#####################################################
rows = []

for _, row in data.iterrows():
channel_str = row[‘Channel’]

if pd.isnull(channel_str) or not str(channel_str).strip():
continue

entries = str(channel_str).split(‘;’)
channel_map = {} # To store channel_name -> summed Decimal %

for entry in entries:
entry = entry.strip()
if not entry:
continue

if ‘(‘ in entry and ‘%’ in entry:
channel_name = entry.split(‘(‘)[0].strip()
percent_str = entry.split(‘(‘)[1].replace(‘)’, ”).replace(‘%’, ”).strip()

try:
percent_val = Decimal(percent_str)
except:
percent_val = Decimal(‘0’)

if channel_name in channel_map:
channel_map[channel_name] += percent_val
else:
channel_map[channel_name] = percent_val

for channel_name, total_percent in channel_map.items():
new_row = row.copy()
new_row[‘Channel’] = channel_name
new_row[‘AllocatedPercentage’] = total_percent

if total_percent > 0:
new_row[‘ActualSpend’] = (new_row[‘ActualSpend’] * (total_percent/100) )

rows.append(new_row)

data = pd.DataFrame(rows)
return data

6.3 Execute the transformation flow and test the output from the local table HDLFT_CAMPAIGN_SILVER:

jeetendrakapase_1-1757466839017.png

jeetendrakapase_0-1757466699277.png

Wonderful our silver layer of the data is ready and transformed as per the business requirement. Now let us create the customer managed data product and share with the SAP databricks. You can also share the local table from HANA Data Lake File space to HANA cloud DB space and build the models on top of it, e.g. Building a report that provides access to 5 years of worth where most recent 2 years are persisted on the storage type in-memory/disk while rest 3 years are persisted on the storage type file and union model is build to combine this data.

7. Creating Custom Delta Share Data ProductsCreate a Formations Profile with Data Product visibility option as Formations.

jeetendrakapase_0-1757467550978.png

 

jeetendrakapase_0-1757467495757.png

8. Context is automatically created.

jeetendrakapase_1-1757467607998.png

 

9. After creating your Unified Customer Landscape Formations profile, you can proceed to create a Delta Share data product:

jeetendrakapase_2-1757467878540.png

10. List the Custom Data Product, so that It will be discoverable in the SAP BDC Catalog & Marketplace:

jeetendrakapase_3-1757467991597.png

jeetendrakapase_4-1757468025227.png

11. Search and Discover the Data Product “Sales Campaign Gold Data” in SAP BDC Catalog & Marketplace:

jeetendrakapase_5-1757468149233.png

 

12. Share the Data Product “Sales Campaign Gold Data”  with supported BDC target systems in our scenario it is SAP databricks: We are sharing the data product with SAP databricks workspace WS_IT.

jeetendrakapase_6-1757468242453.png

Note: SAP databricks is part of our SAP BDC formation, hence it is available under the target system options.

jeetendrakapase_7-1757468350476.png

13. Validate the sharing is enabled and correct target system: 

jeetendrakapase_0-1757470106343.png

14. Validate the Delta-Shared Sales Campaign Gold Data product in SAP Databricks by checking the WS_IT workspace with verifying its presence and data preview in the Unity Catalog.

jeetendrakapase_2-1757470388857.png

 

 

jeetendrakapase_1-1757470227392.png

 

Summary: 

In this part of the SAP Business Data Cloud (BDC) series focusing on the data products, we explored how to build a custom data product in SAP S/4HANA Cloud Private Edition using a custom CDS entity (e.g., ZCDS_CAMPAIGN). We walked through setting up prerequisites like the Cloud Connector, creating a Datasphere file space, and configuring connections. Using the bronze–silver transformation approach, we replicated and refined campaign data for harmonization. Finally, we created and published a custom Delta Share data product, making it discoverable in the BDC Catalog and consumable in SAP Databricks for advanced analytics and ML scenarios.

“}]] 

 [[{“value”:”Introduction:In Part 1(SAP Business Data Cloud Series – Part 1: Introduction to Data Products) of this blog series, we explored the fundamentals of Data Products in SAP Business Data Cloud (BDC). In Part 2(SAP Business Data Cloud Series – Part 2: Extend SAP S/4HANA Managed Data Products) we explored on how to extend SAP S/4HANA Data Products. Now, in Part 3, we dive into the practical aspect of creating custom data products for the source SAP S/4HANA Cloud Private Edition and Share it with SAP databricks.In this article, we’ll explore a common scenario where a customer has a custom CDS entity in SAP S/4HANA and wants to harmonize its data with SAP-managed data products. We’ll demonstrate how to create a custom data product based on that custom CDS entity, for example, ZCDS_CAMPAIGN and how to delta-share with SAP databricks. High-level Workflow for the SAP S/4HANA, Customer Managed Data Product:Steps to create a SAP S/4HANA Customer Managed Data Product.1. Identify, create, or extend a CDS entity: To build a customer-managed data product in an SAP S/4HANA system, the recommended approach is to leverage CDS views/entities. In this example, we’ll create a custom CDS entity as shown below.Note: As a best practice, customers should leverage SAP-released CDS views first, extend them where needed, and only create custom CDS views when business requirements demand it. This is fully permissible under the clean core paradigm, as business requirements ultimately take priority.@ObjectModel.usageType.dataClass: #TRANSACTIONAL
@ObjectModel.usageType.serviceQuality: #A
@ObjectModel.usageType.sizeCategory: #XL
@ObjectModel.representativeKey: ‘CampaignID’
@ObjectModel.modelingPattern: #ANALYTICAL_DIMENSION
@ObjectModel.supportedCapabilities: [ #ANALYTICAL_DIMENSION,
#CDS_MODELING_DATA_SOURCE,
#CDS_MODELING_ASSOCIATION_TARGET,
#SQL_DATA_SOURCE,
#EXTRACTION_DATA_SOURCE ]

@ObjectModel.sapObjectNodeType.name: ‘CampaignID’
@EndUserText.label: ‘CDS View for Campaigning Data’
@Analytics.dataCategory: #DIMENSION
@Analytics.internalName: #LOCAL
@Analytics: {
dataExtraction: {
enabled: true,
delta.changeDataCapture: {
mapping:[
{
table: ‘zcampaign’, role: #MAIN,
viewElement: [‘CampaignID’],
tableElement: [‘campaign_id’]
}
]
}
}
}

@VDM.viewType: #BASIC
@Metadata.allowExtensions: true
@Metadata.ignorePropagatedAnnotations: true

define view entity ZCDS_campaign as select from zcampaign
{
@EndUserText.label: ‘Campaign_ID’
key zcampaign.campaign_id as CampaignId,
@EndUserText.label: ‘Campaign_Name’
zcampaign.campaign_name as CampaignName,
@EndUserText.label: ‘Channel’
zcampaign.channel as Channel,
zcampaign.type as Type,
zcampaign.start_date as StartDate,
zcampaign.end_date as EndDate,
zcampaign.status as Status,
@Semantics.amount.currencyCode: ‘BudgetCurrency’
zcampaign.budget as Budget,
zcampaign.budget_currency as BudgetCurrency,
@Semantics.amount.currencyCode: ‘ActualSpendCurrency’
zcampaign.actual_spend as ActualSpend,
zcampaign.actual_spend_currency as ActualSpendCurrency,
zcampaign.created_by as CreatedBy,
zcampaign.created_on as CreatedOn

}2. SAP S/4HANA Private Cloud or On-Premise Edition requires a Cloud Connector: Configure the Cloud Connector to enable communication between your on-premise/private cloud system and SAP Datasphere (public cloud). This setup is a prerequisite for creating an SAP S/4HANA or ABAP connection in SAP Datasphere for using the replication flow feature.3. Create a Datasphere Space of Type HANA Data Lake Files:  An administrator can create a space backed by SAP HANA Data Lake Files in the object store. File spaces are designed for cost-efficient staging, loading, and preparing large volumes of data.For detailed instructions, refer to the help guide: Create a File Space in the Object Store.Additional configuration is required while configuring the SAP Datasphere tenant. e.g.  Memory must be 128GB or more. Check via SAP BDC Estimator.If you have configured correctly then you should also see the same under the SAP Datasphere, Tenant configuration. Please note this view is only available to the SAP Datasphere system owner.SAP Datasphere object store: Storage type will be SAP HANA Data Lake Files. In our scenario we have created a space with a name Workshop: OBJECT STORE.4. Create a SAP S/4HANA Connection in the SAP Datasphere Object Store Space, Workshop: OBJECT STORE :4.1 Create a new connection or use the existing connection of type SAP S/4HANA on-premise or ABAP: 4.2 Fill in the connection configuration details as show below and important step is select the cloud connector which was setup and configured in the step 2.4.3 Provide the connection name and description:4.4 Validate and test the connection making sure replication flows are enabled:You can also use or create the SAP ABAP connection type for this use case.5. Create a Replication Flow to Load Data from CDS Entity into SAP Datasphere Object Store (HDLF):Set up a replication flow with the source system SAP_S4H_RI4 and CDS entity ZCDS_CAMPAIGN. Define the target as a Datasphere local table ZCDS_CAMPAIGN_BRONZE. This table, serving as the Bronze layer, will store source records and structures in their original form.5.1 Create a new replication flow5.2 Select the Source SAP_S4H_RI4 and Container (Source Objects) ZCDS_CAMPAIGN5.3 Select the target as connection as a SAP Datasphere5.4 Provide the target object local table name ZCDS_CAMPAIGN_BRONZE and Deploy the replication flow.5.5 Execute the replication flow and check the run details.5.6 Perform the merge table activity:5.7 Post merge table activity, data will be available to preview and Test it.6. Bronze to Silver layer medallion transformation using a Transformation Flow:  In many cases, data from the Bronze layer needs to be refined into a Silver layer through transformations such as splitting, merging, adding/removing columns, joins, or unions.In our scenario, we will split the values in the Channel column into two columns Channel, Allocated Percentage (multiple rows) and apply necessary calculations.6.1 Create a new Transformation Flow6.2 Define the transformation steps:Source table:HDLFT_CAMPAIGN_BRONZE  and Target table: HDLFT_CAMPAIGN_SILVER . Python script operator for performing the transformation logic.def transform(data):
“””
This function body should contain all the desired transformations on incoming data of Pandas DataFrame.
Permitted builtin functions as well as permitted NumPy and Pandas objects and functions are available inside this function.
Permitted NumPy and Pandas objects and functions can be used with aliases ‘np’ and ‘pd’ respectively.
Python standard libraries like ‘time’, ‘datetime’, ‘re’, ‘random’, ‘math’, ‘calendar’ and ‘dateutil.parser’ can be used without any alias.
This function executes in a sandbox mode. Please refer the documentation for permitted objects and functions.
Using any restricted functions or objects would cause an internal exception and result in a run failure.
Any code outside this function body will not be executed and inclusion of such code is discouraged.
:param data: Pandas DataFrame
:return: Pandas DataFrame
“””
#####################################################
# Provide the function body for data transformation #
#####################################################
rows = []

for _, row in data.iterrows():
channel_str = row[‘Channel’]

if pd.isnull(channel_str) or not str(channel_str).strip():
continue

entries = str(channel_str).split(‘;’)
channel_map = {} # To store channel_name -> summed Decimal %

for entry in entries:
entry = entry.strip()
if not entry:
continue

if ‘(‘ in entry and ‘%’ in entry:
channel_name = entry.split(‘(‘)[0].strip()
percent_str = entry.split(‘(‘)[1].replace(‘)’, ”).replace(‘%’, ”).strip()

try:
percent_val = Decimal(percent_str)
except:
percent_val = Decimal(‘0’)

if channel_name in channel_map:
channel_map[channel_name] += percent_val
else:
channel_map[channel_name] = percent_val

for channel_name, total_percent in channel_map.items():
new_row = row.copy()
new_row[‘Channel’] = channel_name
new_row[‘AllocatedPercentage’] = total_percent

if total_percent > 0:
new_row[‘ActualSpend’] = (new_row[‘ActualSpend’] * (total_percent/100) )

rows.append(new_row)

data = pd.DataFrame(rows)
return data6.3 Execute the transformation flow and test the output from the local table HDLFT_CAMPAIGN_SILVER:Wonderful our silver layer of the data is ready and transformed as per the business requirement. Now let us create the customer managed data product and share with the SAP databricks. You can also share the local table from HANA Data Lake File space to HANA cloud DB space and build the models on top of it, e.g. Building a report that provides access to 5 years of worth where most recent 2 years are persisted on the storage type in-memory/disk while rest 3 years are persisted on the storage type file and union model is build to combine this data.7. Creating Custom Delta Share Data Products: Create a Formations Profile with Data Product visibility option as Formations. 8. Context is automatically created. 9. After creating your Unified Customer Landscape Formations profile, you can proceed to create a Delta Share data product:10. List the Custom Data Product, so that It will be discoverable in the SAP BDC Catalog & Marketplace:11. Search and Discover the Data Product “Sales Campaign Gold Data” in SAP BDC Catalog & Marketplace: 12. Share the Data Product “Sales Campaign Gold Data”  with supported BDC target systems in our scenario it is SAP databricks: We are sharing the data product with SAP databricks workspace WS_IT.Note: SAP databricks is part of our SAP BDC formation, hence it is available under the target system options.13. Validate the sharing is enabled and correct target system: 14. Validate the Delta-Shared Sales Campaign Gold Data product in SAP Databricks by checking the WS_IT workspace with verifying its presence and data preview in the Unity Catalog.   Summary: In this part of the SAP Business Data Cloud (BDC) series focusing on the data products, we explored how to build a custom data product in SAP S/4HANA Cloud Private Edition using a custom CDS entity (e.g., ZCDS_CAMPAIGN). We walked through setting up prerequisites like the Cloud Connector, creating a Datasphere file space, and configuring connections. Using the bronze–silver transformation approach, we replicated and refined campaign data for harmonization. Finally, we created and published a custom Delta Share data product, making it discoverable in the BDC Catalog and consumable in SAP Databricks for advanced analytics and ML scenarios.”}]] Read More Technology Blog Posts by SAP articles 

#SAPCHANNEL

By ali