Docs / Connectors / Microsoft Fabric

Microsoft Fabric Connector

The ASAPIO Integration Add-on connects SAP systems with Microsoft Fabric — writing SAP business data directly to Fabric Lakehouse, or via Open Mirroring into Fabric mirrored databases.

Overview

You can connect SAP systems with Microsoft Fabric.

Required components of ASAPIO Integration Add-ons:

Add-on/Component NameType
ASAPIO Integration Add-on – FrameworkBase component (required)
ASAPIO Integration Add-on – Connector for Microsoft® Azure®Additional package

Pre-requisites for Microsoft® Fabric® Services

Note: The following settings are specific to the connector for Microsoft® Fabric®.

A Microsoft® Fabric® and Azure® account is required, with access to one of the following services:

Steps Required to Establish Connectivity

To establish connectivity with the Microsoft Fabric platform, please proceed with the following activities and refer to the specific documentation articles.

  1. Create RFC destinations to the Microsoft Fabric platform in SAP system settings
  2. Set up connection instance to the Microsoft Fabric platform in the ASAPIO Integration Add-on
  3. Endpoint configuration (Lakehouse) – see Authentication options for an overview of supported authentication options for the different endpoints
  4. See Custom Data Products for a simple example to test the connectivity

Predefined Content or Custom Data Products

You can either use predefined content from the data catalog or create your custom data products. The predefined content can either be used directly or as a template for further customization.

The chapters Create RFC Destination and Set-up Connection Instance are required for all approaches. After completing them, either go through the Predefined Content with Data Catalog or the Custom Data Products chapter.

Authentication Options

The Fabric service offers different authorization options:

  1. OAuth via Entra ID
  2. Managed Identities

To learn how to configure the service, see the specific article below.

Create RFC Destinations

Create RFC Destination for Messaging Endpoints

Create a new RFC destination of type “G” (HTTP Connection to External Server).

SM59 RFC destination for the OneLake messaging endpoint

Add the certificates for the created destinations to the certificate list selected in tab Logon & Security:

Certificate list for the messaging endpoint RFC destination

Create RFC Destination for OAuth Authentication

To use OAuth authentication with Entra ID, please configure an RFC destination specifying the OAuth endpoint:

SM59 RFC destination for OAuth authentication

Add the certificates for the created destinations to the certificate list selected in tab Logon & Security:

Certificate list for the OAuth RFC destination

Add Certificates to Trust Store

STRUST certificate import for Fabric

Set Up Connection Instance

Create the connection instance customizing that ties together the RFC destination created earlier and the cloud connector type:

Fabric connection instance customizing

Set Up Error Type Mapping

Create an entry in section Error Type Mapping and specify at least the following mapping:

Resp. CodeMessage Type
201Success
202Success
Fabric error type mapping

Save Secret in SAP Secure Store

For OAuth authentication, a secret has to be stored in the system’s SAP Secure Store: the Client Secret for OAuth.

Enter the secret in the SAP Secure Store:

Client secret in SAP Secure Store for Fabric

Fabric Open Mirroring

Mirroring in Fabric is a low-cost, low-latency way to bring data from various systems together into a single analytics platform. You can continuously replicate your existing data estate directly into Fabric’s OneLake from a variety of Azure databases and external data sources. See Microsoft Learn – Fabric Mirroring for more information.

With release 9.32504, the ASAPIO Integration Add-on supports Open Mirroring to bring your SAP data into Fabric.

The prerequisite for configuration in the SAP system is the creation of a mirrored database in Fabric. See Microsoft Learn – Tutorial: Configure Microsoft Fabric open mirrored databases.

Set Up Outbound Object

To support mirroring, data must be sent in Parquet format. The formatter to configure for this is /ASADEV/ACI_PARQUET_FORMATTER.

Outbound object Format Function set to the Parquet formatter

Set Up ‘Header Attributes’

The header attributes must be changed or added.

Header AttributeHeader Attribute Value
ACI_HTTP_METHODPATCH
AZURE_SERVICE_TYPEMIRRORING (can also be set in Default Values on instance level)
FABRIC_MIRROR_IDyour mirrored database ID specified in Fabric
FABRIC_MIRROR_TABLEmirror table name (how the table should be named in Fabric, e.g. SalesOrder)
FABRIC_WORKSPACEyour workspace ID specified in Fabric (can also be set in Default Values on instance level)
Open Mirroring header attributes

Managed Identities

Note: authentication based on managed identities only works if your SAP system is also running in the Azure cloud.

Create the RFC destination for the Managed Identities endpoint:

SM59 RFC destination ACI_AZURE_TOKEN, Special Options
SM59 RFC destination ACI_AZURE_TOKEN, Technical Settings with the Azure Instance Metadata Service target host and path prefix
SM59 RFC destination ACI_AZURE_TOKEN, Logon & Security

Note: the destination must be configured to use HTTP (not HTTPS!).

For authentication based on Managed Identities, specify the following values:

Default AttributeDefault Attribute Value
AZURE_AUTH_TYPEMANAGED_IDENTITY
AZURE_SERVICE_TYPElakehouse
TOKEN_DESTINATIONRFC destination for the Managed Identity endpoint

In the default values for the connection:

Default Values for the FABRIC_MI connection instance

Header Attributes:

Header Attributes for an outbound object on the Managed Identity connection

Predefined Content with Data Catalog

The Data Catalog for Fabric provides a set of predefined message payloads based on SAP S/4HANA CDS views, as well as preconfigured interfaces for the Integration Add-on. This eliminates the need for users to perform significant configuration tasks, allowing for a rapid start and the execution of tests. This overview details the predefined content included: an instance (FABRIC) comprising several replication objects and the corresponding payload designs.

Predefined interfaces (Objects)

DescriptionReplication Object
GL DocumentsGL_ACCOUNT_ITEM_CHANGE, GL_ACCOUNT_ITEM_INITIAL
Operational accounting documentsOP_ACCOUNTING_ITEM_CHANGE, OP_ACCOUNTING_ITEM_INITIAL
Sales document itemsSALES_ORDER_ITEM_CHANGE, SALES_ORDER_ITEM_INITIAL
Billing documentsBILLING_ITEM_CHANGE, BILLING_ITEM_INITIAL
Delivery documentsDELIVERY_CHANGE, DELIVERY_INITIAL
Delivery document itemsDELIVERY_ITEM_CHANGE, DELIVERY_ITEM_INITIAL
Purchase requisitionPURCHASE_REQUISITION_CHANGE, PURCHASE_REQUISITION_INITIAL
Purchase ordersPURCHASE_ORDER_CHANGE, PURCHASE_ORDER_INITIAL
Purchase order itemsPURCHASE_ORDER_ITEM_CHANGE, PURCHASE_ORDER_ITEM_INITIAL
Production OrderPRODUCTION_ORDER_CHANGE, PRODUCTION_ORDER_INITIAL
CustomerCUSTOMER_CHANGE, CUSTOMER_INITIAL
EquipmentEQUIPMENT_CHANGE, EQUIPMENT_INITIAL
Functional LocationFUNCTIONAL_LOCATION_CHANGE, FUNCTIONAL_LOCATION_INITIAL
NotificationNOTIFICATION_CHANGE, NOTIFICATION_INITIAL
ProductPRODUCT_CHANGE, PRODUCT_INITIAL
ContractCONTRACT_ITEM_CHANGE, CONTRACT_ITEM_INITIAL
Request for Quotation (RFQ)RFQ_ITEM_CHANGE, RFQ_ITEM_INITIAL
Sales OrderSALES_ORDER_CHANGE, SALES_ORDER_INITIAL
Incoterms ClassificationINCOTERMSCLASSIFICATION_INITIA
LanguageLANGUAGE_INITIAL
Language TextLANGUAGE_TEXT_INITIAL
PlantPLANT_INITIAL
Product DescriptionsPRODUCT_DESCRIPTION_INITIAL
Product GroupPRODUCT_GROUP_2_INITIAL
Product Group – TextPRODUCTGROUPTXT2_INITIAL
Purchasing Document TypePURCHASING_DOCUMENT_TYPE_INIT
Purchasing GroupPURCHASING_GROUP_INITIAL
Purchasing OrganizationPURCHASING_ORGANIZATION_INIT
Item Category for Purchasing DocumentPURGDOCITEMCATEGORY_INITIAL

Predefined payloads

The following list of predefined objects is currently provided for the Fabric connector only, and is subject to change / extension. Payload design versions 2.0 and higher are based on CDS views and therefore require SAP S/4HANA.

DescriptionCDS ViewPayload DesignPayload Design Version
GL DocumentsI_GLACCOUNTLINEITEMRAWDATA/ASAPIO/GLACCOUNTITEM2.0
Operational accounting documentsI_OPERATIONALACCTGDOCITEM/ASAPIO/OPACCOUNTINGITEM2.0
Sales document itemsC_SALESDOCUMENTITEMDEX_1/ASAPIO/SALESORDERITEM2.0
Billing documentsC_BILLINGDOCITEMBASICDEX_1/ASAPIO/BILLINGITEM2.0
Delivery documentsI_DELIVERYDOCUMENT/ASAPIO/DELIVERY2.0
Delivery document itemsI_DELIVERYDOCUMENTITEM/ASAPIO/DELIVERYITEM2.0
Purchase requisitionC_PURCHASEREQUISITIONITEMDEX/ASAPIO/PURCHASEREQUISITION2.0
Purchase ordersC_PURCHASEORDERDEX/ASAPIO/PURCHASEORDER2.0
Purchase order itemsC_PURCHASEORDERITEMDEX/ASAPIO/PURCHASEORDERITEM2.0
Production OrderA_ProductionOrder/ASAPIO/PRODUCTIONORDER2.0
CustomerI_CUSTOMER/ASAPIO/CUSTOMER2.0
EquipmentI_EQUIPMENT/ASAPIO/EQUIPMENT2.0
Functional LocationI_FunctionalLocation/ASAPIO/FUNCTIONALLOCATION2.0
Incoterms ClassificationI_INCOTERMSCLASSIFICATION/ASAPIO/INCOTERMSCLASSIFICATION2.0
LanguageI_LANGUAGE/ASAPIO/LANGUAGE2.0
Language TextI_LANGUAGETEXT/ASAPIO/LANGUAGETEXT2.0
NotificationI_Notification/ASAPIO/NOTIFICATION2.0
PlantI_PLANT/ASAPIO/PLANT2.0
ProductI_PRODUCT/ASAPIO/PRODUCT2.0
Product DescriptionI_PRODUCTDESCRIPTION/ASAPIO/PRODUCT_DESCRIPTION2.0
Product GroupI_PRODUCTGROUP_2/ASAPIO/PRODUCT_GROUP_22.0
Product Group TextI_PRODUCTGROUPTEXT_2/ASAPIO/PRODUCT_GROUP_TEXT22.0
ContractI_PurchaseContractAPI01/ASAPIO/CONTRACT2.0
Purchasing Document TypeI_PURCHASINGDOCUMENTTYPE/ASAPIO/PURCHASING_DOCUMENT_TYPE2.0
Purchasing GroupI_PURCHASINGGROUP/ASAPIO/PURCHASING_GROUP2.0
Purchasing OrganizationI_PURCHASINGORGANIZATION/ASAPIO/PURCHASING_ORGANIZATION2.0
Purchasing Document Item CategoryI_PURGDOCUMENTITEMCATEGORY/ASAPIO/PURGDOCUMENTITEMCATEGORY2.0
Request for QuotationI_Requestforquotation_Api01/ASAPIO/REQUESTFORQUOTATION2.0
Sales OrderI_SALESDOCUMENT/ASAPIO/SALESORDER2.0

Payload Designs for SAP ECC

DescriptionLeading TablePayload DesignPayload Design Version
Sales document itemsVBAP/ASAPIO/SALESORDERITEM1.0
Billing documentsVBRP/ASAPIO/BILLINGITEM1.0
Delivery documentsLIKP/ASAPIO/DELIVERY1.0
Delivery document itemsLIPS/ASAPIO/DELIVERYITEM1.0
Purchase requisitionEBAN/ASAPIO/PURCHASEREQUISITION1.0
Purchase ordersEKKO/ASAPIO/PURCHASEORDER1.0
Purchase order itemsEKPO/ASAPIO/PURCHASEORDERITEM1.0
Production OrderAFKO/ASAPIO/PRODUCTIONORDER1.0
CustomerKNA1/ASAPIO/CUSTOMER1.0
EquipmentEQUI/ASAPIO/EQUIPMENT1.0
Functional LocationIFLOT/ASAPIO/FUNCTIONALLOCATION1.0
Incoterms ClassificationTINC/ASAPIO/INCOTERMSCLASSIFICATION1.0
LanguageT002/ASAPIO/LANGUAGE1.0
Language TextT002T/ASAPIO/LANGUAGETEXT1.0
NotificationQMEL/ASAPIO/NOTIFICATION1.0
PlantT001W/ASAPIO/PLANT1.0
ProductMARA/ASAPIO/PRODUCT1.0
Product DescriptionMAKT/ASAPIO/PRODUCT_DESCRIPTION1.0
Product GroupT023/ASAPIO/PRODUCT_GROUP_21.0
Product Group TextT023T/ASAPIO/PRODUCT_GROUP_TEXT21.0
ContractEKKO/ASAPIO/CONTRACT1.0
Purchasing Document TypeT161/ASAPIO/PURCHASING_DOCUMENT_TYPE1.0
Purchasing GroupT024/ASAPIO/PURCHASING_GROUP1.0
Purchasing OrganizationT024E/ASAPIO/PURCHASING_ORGANIZATION1.0
Purchasing Document Item CategoryT163/ASAPIO/PURGDOCUMENTITEMCATEGORY1.0
Request for QuotationEKKO/ASAPIO/REQUESTFORQUOTATION1.0
Sales OrderVBAK/ASAPIO/SALESORDER1.0

Custom Data Products

Send Outbound Message

Create Message Type

Example: in the example below, we use the Material Change event. Please choose any other suitable example if required.

For each object to be sent via ACI you have to create a message type:

Description: description of the purpose

WE81 message type creation

Activate Message Type

The created message type has to be activated:

BD50 message type activation

Create Payload Design

Go to the ASAPIO Payload Designer with transaction /ASADEV/DESIGN. There you can create a new payload using Create payload (Shift+F4).

Now create a payload with the following criteria:

ASAPIO Payload Designer, creating a new payload

Push the join builder button to add your table, DB view or CDS view:

Payload Designer join builder

Use the button Insert table (Shift+F1).

Payload Designer insert table

Go back and save.

Payload Designer, saving the payload

Create Outbound Object Configuration

For the setup using Fabric Open Mirroring, see the Open Mirroring section above.

Outbound object configuration

Set Up ‘Business Object Event Linkage’

Link the configuration of the outbound object to a Business Object event:

SWE2 event linkage for Fabric

Set Up Target Endpoint in ‘Header Attributes’

Configure the Lakehouse endpoint:

Header AttributeHeader Attribute Value
ACI_HTTP_METHODPATCH
FABRIC_FILE_PATHyour path to file folder, e.g. “/Files”
FABRIC_LAKEHOUSEyour Lakehouse ID specified in Fabric
FABRIC_WORKSPACEyour workspace ID specified in Fabric
Fabric Lakehouse header attributes

Activating the Change Pointer Information with Header Attribute (Optional)

Configure the change pointer info:

Header AttributeHeader Attribute Value
ACI_HTTP_METHODPATCH
ACI_CP_INFOX
Change pointer header attribute configuration

Information can be transferred from the change pointer to the payload. The following information can be used:

Information FieldDescription
ACICPIDENTChange pointer ID
ACITABNAMETable name (Event Object Type)
ACITABKEYComposed of: Event Type, Mandt, Entry Key
ACICRETIMECreation time
ACIACTTIMEActivation time
ACICDCHGIDChange Indicator
Customize the Change Pointer Information

Fields can be renamed or omitted:

Target StructureTarget FieldDefault Value
FIELD_RENAMEACICDCHGIDChangeIndicator
SKIP_FIELDACITABKEY

Test the Outbound Event Creation

In the example above, please pick any test sales order in transaction /nVA02 and force a change event, e.g. by changing the requested delivery date on header level.

Set Up Packed Load / Initial Load (Split Large Data)

Create Payload

Note: e.g. payload design created in transaction /ASADEV/DESIGN.

Create Outbound Object Configuration

Set Up ‘Header Attributes’

Header AttributeHeader Attribute ValueExample
ACI_PACK_BDCP_COMMITFlag for change pointer creation. If set, change pointers will be generated for every entry. If this flag is set, a message type has to be maintained in the outbound object. Caution: this may heavily impact performance.X
ACI_PACK_TABLEName of the table to take the key fields from. This is typically different from the DB view specified in ACI_VIEW, as we only want to build packages based on the header object and the DB view typically contains sub-objects as well.VBAK
ACI_PACK_RETRY_TIMETime in seconds. The duration in which the framework will attempt to get a new resource from the server group.60
ACI_PACK_WHERE_CONDCondition that is applied to the table defined in ACI_PACK_TABLE.
ACI_PACK_SIZENumber of entries to send.500
ACI_PACK_KEY_LENGTHLength of the key to use from the ACI_PACK_TABLE (e.g. MANDT + MATNR).13
Packed load header attributes for Fabric

Execute the Initial Load

Warning: depending on the amount of data, this can stress the SAP system servers immensely. Please always consult with your basis team for the correct server group to use.

Initial packed load execution for Fabric

Monitoring, Traces and Logs

ASAPIO Integration Add-on Monitor allows for monitoring all outbound and inbound messages of the Add-on, with the following features:

  1. View statistical and graphical analysis of data volume, times, and errors
  2. Logging of HTTP return codes and messages
  3. Logging of requests (RAW data) can be switched on/off in application customizing (IMG)
  4. Retransmission control through SAP change pointers (to ensure event delivery) if errors occur
  5. Notification and/or escalation to system administrators (or through SAP Workflow) if errors occur

See the Monitoring documentation for details.

Import CSV Files into Lakehouse

A generic Fabric Notebook can be used to automate the import of CSV files into a Lakehouse database.

Create a Fabric Notebook

Create a new notebook in your Lakehouse and use the example code below.

Importing the ASAPIO Fabric notebook

Configure the Notebook

To use the notebook, first personalize the file name, the path to the files, and the path to the database.

VariableDescription
path_to_csv_filesPath of the CSV file folder
path_to_delta_tablePath of the database
patternThe regular expression pattern of the CSV file name; must be modified to align with the configured file name in SAP. Only the marked part needs to be changed.
pattern_with_groupsThe regular expression pattern of the CSV file name with named capture groups; must be modified to align with the configured file name in SAP. Only the marked part needs to be changed.
Configuring the Fabric notebook variables

Schedule the Notebook as a Job

You can schedule the notebook as a job, e.g. hourly.

Scheduling the Fabric notebook as a recurring job

Example code:

from pyspark.sql import SparkSession
from delta.tables import DeltaTable
import re

# Initialize a SparkSession with Hive support enabled.
spark = SparkSession.builder.appName("LakehouseUpdater").enableHiveSupport().getOrCreate()

# Specify the path to the CSV files.
path_to_csv_files = "abfss://AsapioDemoWorkspace@onelake.dfs.fabric.microsoft.com/AsapioDemoLakehouse.Lakehouse/Files/SalesOrder"

# Specify the path to the Delta table.
path_to_delta_table = "abfss://AsapioDemoWorkspace@onelake.dfs.fabric.microsoft.com/AsapioDemoLakehouse.Lakehouse/Tables/aci_sales_order"

# Compile a regex pattern to filter the file names.
pattern = re.compile(r'aci_sales_order_\d{8}_\d{6}_[a-f0-9]{6}\.csv')

# Define the pattern with groups for sorting based on date and time.
pattern_with_groups = re.compile(r'aci_sales_order_(\d{8})_(\d{6})_([a-f0-9]{6})\.csv')

# Retrieve a list of file names.
files = mssparkutils.fs.ls(path_to_csv_files)

# Initialize a list to hold filtered file names.
filtered_files = []

# Iterate through the file list and add names that match the pattern to the list.
for file in files:
    if pattern.match(file.name):
        filtered_files.append(file.name)

# Sort the file list based on the defined pattern.
filtered_files.sort(key=lambda x: pattern_with_groups.match(x).groups())

# Create a DeltaTable object for the specified Delta table.
delta_table = DeltaTable.forPath(spark, path_to_delta_table)

# Loop over each file in the filtered list.
for file in files:

    # Load the content of the file into an RDD.
    rdd = spark.sparkContext.textFile(file.path)
    # Retrieve the first line which contains field names.
    first_line = rdd.first()

    # Extract field names from the first line.
    _, field_names_str = first_line.split("=")
    field_names = field_names_str.split(",")

    # Construct a condition format for merging data based on field names.
    condition_format = " AND ".join([f"old_data.{field} = new_data.{field}" for field in field_names])

    # Create a new RDD without the first line.
    rdd_without_first_line = rdd.filter(lambda line: line != first_line)

    # Convert the RDD to a DataFrame, now that the non-CSV compliant first line is removed.
    df = spark.read.csv(rdd_without_first_line, header=True, inferSchema=True)

    # Perform a merge operation between the existing Delta table and the new data,
    # updating existing records and inserting new ones as necessary.
    (delta_table
        .alias("old_data")
        .merge(df.alias("new_data"), condition_format)
        .whenMatchedUpdateAll()
        .whenNotMatchedInsertAll()
        .execute()
    )

    # Remove the processed file.
    mssparkutils.fs.rm(file.path, True)

Optimized Incremental Load Handling with Packed Reprocessing

Due to the incrementing mechanism used for Parquet file numbers in Fabric, it is more efficient not to send data in real time. Instead, data should be processed and transferred in batch intervals, for example every 5 minutes or every minute.

For this purpose, use Packed Reprocessing (see the Outbound Messaging documentation).

The first Outbound Object (used for incremental load) writes the Change Pointers but does not send any data.

The second Outbound Object then collects the previously written Change Pointers and sends them in packages, triggered by a background job that runs every 5 minutes or every minute.

In the monitor, you may see “500 lock object could not be set”. This indicates that another process is currently accessing the same object, which is expected behavior when Change Pointers are being processed in parallel. The packed reprocessing job will prevent the lock.