使用 Azure Data Factory 或 Synapse Analytics 將資料複製到 SAP Cloud for Customer (C4C)

適用于: Azure Data Factory Azure Synapse Analytics

提示

試用 Microsoft Fabric 中的 Data Factory,這是適用于企業的單一分析解決方案。 Microsoft Fabric 涵蓋從資料移動到資料科學、即時分析、商業智慧和報告等所有專案。 瞭解如何 免費啟動新的試用版

本文概述如何使用 Azure Data Factory 或 Synapse Analytics 管線中的「複製活動」,從 SAP Cloud for Customer 複製資料(C4C)。 它會以 複製活動概觀 一文為基礎,提供複製活動的一般概觀。

提示

若要瞭解服務對 SAP 資料整合案例的整體支援,請參閱 使用 Azure Data Factory 白皮書 進行 SAP 資料整合,並詳細說明每個 SAP 連接器、比較和指引。

支援的功能

下列功能支援此 SAP Cloud for Customer 連接器:

支援的功能 IR
複製活動 (來源/接收) ① ②
查閱活動 ① ②

(1) Azure 整合執行時間 (2) 自我裝載整合執行時間

如需支援作為來源/接收的資料存放區清單,請參閱 支援的資料存放區 資料表。

具體而言,此連接器可讓服務將資料從 SAP Cloud for Customer 複製到 SAP Cloud for Customer,包括 SAP Cloud for Sales、SAP Cloud for Service,以及 SAP Cloud for Social Engagement 解決方案。

開始使用

若要使用管線執行複製活動,您可以使用下列其中一個工具或 SDK:

使用 UI 建立 SAP Cloud for Customer 的連結服務

使用下列步驟,在 Azure 入口網站 UI 中建立 SAP Cloud for Customer 的連結服務。

  1. 流覽至 Azure Data Factory 或 Synapse 工作區中的 [管理] 索引標籤,然後選取 [連結服務],然後按一下 [新增]:

  2. 搜尋 SAP,然後選取 SAP Cloud for Customer 連接器。

    Select the SAP Cloud for Customer connector.

  3. 設定服務詳細資料、測試連線,並建立新的連結服務。

    Configure a linked service to SAP Cloud for Customer.

連線or 組態詳細資料

下列各節提供屬性的相關詳細資料,這些屬性是用來定義 SAP Cloud for Customer 連接器專屬的 Data Factory 實體。

連結的服務屬性

SAP Cloud for Customer 連結服務支援下列屬性:

屬性 描述 必要
type type 屬性必須設定為: SapCloudForCustomer Yes
URL SAP C4C OData 服務的 URL。 Yes
username 指定要連線到 SAP C4C 的使用者名稱。 Yes
password 指定您為使用者名稱指定的使用者帳戶密碼。 將此欄位標示為 SecureString 以安全地儲存,或 參考儲存在 Azure 金鑰保存庫 中的秘密。 Yes
connectVia 用於連線到資料存放區的 Integration Runtime。 如果未指定,就會使用預設的 Azure Integration Runtime。 No

範例:

{
    "name": "SAPC4CLinkedService",
    "properties": {
        "type": "SapCloudForCustomer",
        "typeProperties": {
            "url": "https://<tenantname>.crm.ondemand.com/sap/c4c/odata/v1/c4codata/" ,
            "username": "<username>",
            "password": {
                "type": "SecureString",
                "value": "<password>"
            }
        },
        "connectVia": {
            "referenceName": "<name of Integration Runtime>",
            "type": "IntegrationRuntimeReference"
        }
    }
}

資料集屬性

如需可用來定義資料集的完整區段和屬性清單,請參閱 資料集 一文。 本節提供 SAP Cloud for Customer 資料集所支援的屬性清單。

若要從 SAP Cloud for Customer 複製資料,請將資料集的 type 屬性設定為 SapCloudForCustomerResource 。 支援下列屬性:

屬性 描述 必要
type 資料集的類型屬性必須設定為: SapCloudForCustomerResource Yes
path 指定 SAP C4C OData 實體的路徑。 Yes

範例:

{
    "name": "SAPC4CDataset",
    "properties": {
        "type": "SapCloudForCustomerResource",
        "typeProperties": {
            "path": "<path e.g. LeadCollection>"
        },
        "schema": [],
        "linkedServiceName": {
            "referenceName": "<SAP C4C linked service>",
            "type": "LinkedServiceReference"
        }
    }
}

複製活動屬性

如需可用來定義活動的區段和屬性的完整清單,請參閱 管線 一文。 本節提供 SAP Cloud for Customer 來源所支援的屬性清單。

SAP C4C 作為來源

若要從 SAP Cloud for Customer 複製資料,請將複製活動中的來源類型設定為 SapCloudForCustomerSource 。 複製活動 來源 區段中支援下列屬性:

屬性 描述 必要
type type 屬性必須設定為: SapCloudForCustomerSource Yes
query 指定要讀取資料的自訂 OData 查詢。 No
HTTPRequestTimeout HTTP 要求取得回應的逾時 ( TimeSpan 值)。 此值是取得回應的逾時,而不是讀取回應資料的逾時。 如果未指定,預設值為 00:30:00 (30 分鐘)。 No

取得特定日期資料的範例查詢: "query": "$filter=CreatedOn ge datetimeoffset'2017-07-31T10:02:06.4202620Z' and CreatedOn le datetimeoffset'2017-08-01T10:02:06.4202620Z'"

範例:

"activities":[
    {
        "name": "CopyFromSAPC4C",
        "type": "Copy",
        "inputs": [
            {
                "referenceName": "<SAP C4C input dataset>",
                "type": "DatasetReference"
            }
        ],
        "outputs": [
            {
                "referenceName": "<output dataset>",
                "type": "DatasetReference"
            }
        ],
        "typeProperties": {
            "source": {
                "type": "SapCloudForCustomerSource",
                "query": "<custom query e.g. $top=10>"
            },
            "sink": {
                "type": "<sink type>"
            }
        }
    }
]

SAP C4C 作為接收

若要將資料複製到 SAP Cloud for Customer,請將複製活動中的接收類型設定為 SapCloudForCustomerSink 。 複製活動 接收 區段中支援下列屬性:

屬性 描述 必要
type type 屬性必須設定為: SapCloudForCustomerSink Yes
writeBehavior 作業的寫入行為。 可以是 「Insert」、「Update」。  否。 預設 「插入」。
writeBatchSize 寫入作業的批次大小。 要取得最佳效能的批次大小可能會因不同的資料表或伺服器而有所不同。 否。 預設值 10。 
 maxConcurrent連線ions 在活動執行期間,與資料存放區建立的並行連線上限。 只有在您想要限制並行連線時,才指定值。  不

範例:

"activities":[
    {
        "name": "CopyToSapC4c",
        "type": "Copy",
        "inputs": [{
            "type": "DatasetReference",
            "referenceName": "<dataset type>"
        }],
        "outputs": [{
            "type": "DatasetReference",
            "referenceName": "SapC4cDataset"
        }],
        "typeProperties": {
            "source": {
                "type": "<source type>"
            },
            "sink": {
                "type": "SapCloudForCustomerSink",
                "writeBehavior": "Insert",
                "writeBatchSize": 30
            },
            "parallelCopies": 10,
            "dataIntegrationUnits": 4,
            "enableSkipIncompatibleRow": true,
            "redirectIncompatibleRowSettings": {
                "linkedServiceName": {
                    "referenceName": "ErrorLogBlobLinkedService",
                    "type": "LinkedServiceReference"
                },
                "path": "incompatiblerows"
            }
        }
    }
]

SAP Cloud for Customer 的資料類型對應

從 SAP Cloud for Customer 複製資料時,下列對應會從 SAP Cloud for Customer 資料類型使用到服務內部使用的過渡資料類型。 請參閱 架構和資料類型對應 ,以瞭解複製活動如何將來源架構和資料類型對應至接收。

SAP C4C OData 資料類型 過渡期服務資料類型
Edm.Binary Byte[]
Edm.Boolean Bool
Edm.Byte Byte[]
Edm.DateTime Datetime
Edm.Decimal Decimal
Edm.Double 雙重
Edm.Single Single
Edm.Guid Guid
Edm.Int16 Int16
Edm.Int32 Int32
Edm.Int64 Int64
Edm.SByte Int16
Edm.String String
Edm.Time TimeSpan
Edm.DateTimeOffset DateTimeOffset

查閱活動屬性

若要瞭解屬性的詳細資料,請檢查 查閱活動

如需複製活動支援做為來源和接收的資料存放區清單,請參閱 支援的資料存放區