分享方式:


使用 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
複製活動 (來源/接收) ① ②
查閱活動 ① ②

① Azure 整合執行階段 ② 自我裝載整合執行階段

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

具體而言,此連接器可讓服務從 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.

連接器設定詳細資料

下列各節提供屬性的相關詳細資料,這些屬性是用來定義 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 指定您為 username 指定之使用者帳戶的密碼。 將此欄位標記為 SecureString 以便安全儲存,或參考 Azure Key Vault 中儲存的祕密 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 資料集的 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。 複製活動的 source 區段支援下列屬性:

屬性 描述 必要
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。 複製活動的 sink 區段支援下列屬性:

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

範例:

"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 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

查閱活動屬性

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

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