Copy data from SAP Cloud for Customer (C4C) using Azure Data Factory

This article outlines how to use the Copy Activity in Azure Data Factory to copy data from/to SAP Cloud for Customer (C4C). It builds on the copy activity overview article that presents a general overview of copy activity.

Supported capabilities

You can copy data from SAP Cloud for Customer to any supported sink data store, or copy data from any supported source data store to SAP Cloud for Customer. For a list of data stores that are supported as sources/sinks by the copy activity, see the Supported data stores table.

Specifically, this connector enables Azure Data Factory to copy data from/to SAP Cloud for Customer including the SAP Cloud for Sales, SAP Cloud for Service, and SAP Cloud for Social Engagement solutions.

Getting started

You can create a pipeline with the copy activity by using one of the following tools or SDKs. Select a link to go to a tutorial with step-by-step instructions to create a pipeline with a copy activity.

The following sections provide details about properties that are used to define Data Factory entities specific to SAP Cloud for Customer connector.

Linked service properties

The following properties are supported for SAP Cloud for Customer linked service:

Property Description Required
type The type property must be set to: SapCloudForCustomer. Yes
url The URL of the SAP C4C OData service. Yes
username Specify the user name to connect to the SAP C4C. Yes
password Specify the password for the user account you specified for the username. Mark this field as a SecureString to store it securely in Data Factory, or reference a secret stored in Azure Key Vault. Yes
connectVia The Integration Runtime to be used to connect to the data store. If not specified, it uses the default Azure Integration Runtime. No for source, Yes for sink

Important

To copy data into SAP Cloud for Customer, explicitly create an Azure IR with a location near your SAP Cloud for Customer, and associate in the linked service as the following example:

Example:

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

Dataset properties

For a full list of sections and properties available for defining datasets, see the datasets article. This section provides a list of properties supported by SAP Cloud for Customer dataset.

To copy data from SAP Cloud for Customer, set the type property of the dataset to SapCloudForCustomerResource. The following properties are supported:

Property Description Required
type The type property of the dataset must be set to: SapCloudForCustomerResource Yes
path Specify path of the SAP C4C OData entity. Yes

Example:

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

Copy activity properties

For a full list of sections and properties available for defining activities, see the Pipelines article. This section provides a list of properties supported by SAP Cloud for Customer source.

SAP C4C as source

To copy data from SAP Cloud for Customer, set the source type in the copy activity to SapCloudForCustomerSource. The following properties are supported in the copy activity source section:

Property Description Required
type The type property must be set to: SapCloudForCustomerSource Yes
query Specify the custom OData query to read data. No

Sample query to get data for a specific day: "query": "$filter=CreatedOn ge datetimeoffset'2017-07-31T10:02:06.4202620Z' and CreatedOn le datetimeoffset'2017-08-01T10:02:06.4202620Z'"

Example:

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

To copy data to SAP Cloud for Customer, set the sink type in the copy activity to SapCloudForCustomerSink. The following properties are supported in the copy activity sink section:

Property Description Required
type The type property must be set to: SapCloudForCustomerSink Yes
writeBehavior The write behavior of the operation. Could be “Insert”, “Update”. No. Default “Insert”.
writeBatchSize The batch size of write operation. The batch size to get best performance may be different for different table or server. No. Default 10.

Example:

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

Data type mapping for SAP Cloud for Customer

When copying data from SAP Cloud for Customer, the following mappings are used from SAP Cloud for Customer data types to Azure Data Factory interim data types. See Schema and data type mappings to learn about how copy activity maps the source schema and data type to the sink.

SAP C4C OData Data Type Data factory interim data type
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

Next steps

For a list of data stores supported as sources and sinks by the copy activity in Azure Data Factory, see supported data stores.