Create and process bulks with SAP ODM using CDQ services.

Overview

This guide provides a step-by-step process on how to interact with the SAP ODM using CDQ services. It covers how to create and process data in bulk, specifically focusing on bulk lookup and bulk fetch operations.

info

The provided instruction is based on below API documentation:

  1. Bulk Fetch
  2. Bulk Lookup

Scenario

In this instruction you will learn how to:

  1. Create a Bulk Lookup and Read a Bulk Lookup,
  2. Create a Bulk Fetch and Read a Bulk Fetch,
  3. Handle response statuses.

Step 1: Create a Bulk Lookup

To create a bulk lookup, you need to send a request to the SAP ODM using the Create Bulk Lookup endpoint. The request should contain the tasks you want to perform in bulk.

  1. Use the Create Bulk Lookup endpoint to send the request,
  2. Select the Create Bulk Business Partner Lookup with Tasks example,
  3. Click the Send button.
Loading...
Expand to see the JSON and curl payload.
application/json
{
  • "featuresOn": [
    • "SHOW_DEBUG_INFO"
    ],
  • "tasks": [
    • {
      • "id": "42010AEF0CEB1EEEACF7ECD80452F903__-/-",
      • "businessPartner": {
        • "jsonRecord": {
          • "addressData": [
            • {
              • "organizationPostalAddress": {
                • "country": {
                  • "code": "DE"
                  },
                • "postCode": "69190",
                • "houseNumber": "16",
                • "street": {
                  • "name": "Dietmar-Hopp-Allee"
                  },
                • "primaryRegion": {
                  • "code": "08"
                  },
                • "town": {
                  • "name": "Walldorf"
                  }
                }
              }
            ],
          • "businessPartnerType": "organization",
          • "identifications": [
            • {
              • "identificationType": {
                • "code": "BUP002"
                },
              • "identificationNumber": "HRB 719915",
              • "entryDateVc": "-",
              • "country": {
                • "code": "DE"
                },
              • "institute": "Local Court Mannheim",
              • "validFrom": "2024-01-15",
              • "validTo": "9999-12-31"
              },
            • {
              • "identificationType": {
                • "code": "DPI001"
                },
              • "identificationNumber": "GR.LEI:529900PM64WH8AF1E917HQ",
              • "entryDateVc": "-",
              • "validFrom": "2024-01-15",
              • "validTo": "9999-12-31"
              }
            ],
          • "organization": {
            • "nameDetails": {
              • "formattedOrgNameLine1": "SAP SE",
              • "formattedOrgName": "SAP SE"
              }
            },
          • "taxNumbers": [
            • {
              • "taxNumberType": {
                • "code": "DE0"
                },
              • "taxNumber": "DE143454214"
              }
            ]
          }
        }
      }
    ]
}
  1. Check the details of the response.

If the response status is 200, you will receive a response similar to the below example:

Copy
Copied
{
    "id": "065fda25-e594-4472-a5fc-f51c38f2f40e",
    "createdAt": "2024-02-23T10:49:09.651857409Z",
    "createdBy": "f1241873-7f01-41fa-b1c5-e747b630da61",
    "status":
    {
        "technicalKey": "RUNNING"
    },
    "featuresOn": ["SHOW_DEBUG_INFO"]
}
The first important attribute is technicalKey of the response status. Status RUNNING means that the bulk is still in progress. Copy the id of the bulk and use it in the next step.
warning

Do not start the next bulk job until the previous one is finished. To check the status of the bulk, go to the next step.

info

If a status other than 200 is returned, go to Developer Guidelines to check extended descriptions.

Step 2: Read a Bulk Lookup

To read a bulk lookup, you need to send a request using the Read Bulk Lookup endpoint.

  1. Use the Read Bulk Lookup endpoint to send the request,
  2. Paste the id of the bulk received in the previous step and paste it to the id field in the parameters,
  3. Click the Send button.
Loading...
  1. Check the details of the response.

If the response status is 200, you will receive a response similar to the below example:

Copy
Copied
{
    "id": "f90b3fd3-ef5a-4909-9c67-a3648b69dcd1",
    "createdAt": "2024-02-23T11:34:44.940Z",
    "finishedAt": "2024-02-23T11:34:45.528Z",
    "createdBy": "f1241873-7f01-41fa-b1c5-e747b630da61",
    "status": {
        "technicalKey": "FINISHED"
    },
    "progress": 100,
    "results": [{
        "total": 55,
        "limit": 10,
        "startAfter": "RVtH+Q==",
        "nextStartAfter": "RVtH8w==",
        "values": [],
        "debugInfo": {},
        "id": "65d882d57c7b4014524c7814"
    }],
    "nextStartAfter": "MA%3D%3D"

}
The first important attribute is technicalKey of the response status. Status FINISHED means that the bulk is finished and the bulk lookup results are available in the results attribute in the value. Explore it for Business Partners Data.
success

You have successfully created and processed a bulk lookup.

info

If a status other than 200 is returned, go to Developer Guidelines to check extended descriptions.

Step 3: Create a Bulk Fetch

To create a bulk fetch, you need to send a request to the SAP ODM using the Create Bulk Fetch endpoint. The request should contain the tasks you want to perform in bulk.

  1. Use the Create Bulk Fetch endpoint to send the request.
  2. Select the Create Bulk Business Partner Fetch with Tasks example.
  3. Click the Send button.
Loading...
Expand to see the JSON and curl payload.
application/json
{
  • "featuresOn": [
    • "SHOW_DEBUG_INFO"
    ],
  • "tasks": [
    • {
      • "id": "42010AEF0CEB1EEEACF7ECD80452F903__-/-",
      • "businessPartner": {
        • "jsonRecord": {
          • "addressData": [
            • {
              • "organizationPostalAddress": {
                • "country": {
                  • "code": "DE"
                  },
                • "postCode": "69190",
                • "houseNumber": "16",
                • "street": {
                  • "name": "Dietmar-Hopp-Allee"
                  },
                • "primaryRegion": {
                  • "code": "08"
                  },
                • "town": {
                  • "name": "Walldorf"
                  }
                }
              }
            ],
          • "businessPartnerType": "organization",
          • "identifications": [
            • {
              • "identificationType": {
                • "code": "BUP002"
                },
              • "identificationNumber": "HRB 719915",
              • "entryDateVc": "-",
              • "country": {
                • "code": "DE"
                },
              • "institute": "Local Court Mannheim",
              • "validFrom": "2024-01-15",
              • "validTo": "9999-12-31"
              },
            • {
              • "identificationType": {
                • "code": "DPI001"
                },
              • "identificationNumber": "GR.LEI:529900PM64WH8AF1E917HQ",
              • "entryDateVc": "-",
              • "validFrom": "2024-01-15",
              • "validTo": "9999-12-31"
              }
            ],
          • "organization": {
            • "nameDetails": {
              • "formattedOrgNameLine1": "SAP SE",
              • "formattedOrgName": "SAP SE"
              }
            },
          • "taxNumbers": [
            • {
              • "taxNumberType": {
                • "code": "DE0"
                },
              • "taxNumber": "DE143454214"
              }
            ]
          }
        }
      }
    ]
}
  1. Check the details of the response.

If the response status is 200, you will receive a response similar to the below example:

Copy
Copied
{
    "id": "058d20f2-6138-4b73-bf2b-bed6adeb6e34",
    "createdAt": "2024-02-23T11:45:32.396046663Z",
    "createdBy": "f1241873-7f01-41fa-b1c5-e747b630da61",
    "status": {
        "code": 200,
        "technicalKey": "OK",
        "details": [{
            "id": 200000006,
            "message": "The bulk is currently being executed.",
            "technicalKey": "BULK_RUNNING"
        }]
  },
  "featuresOn": ["SHOW_DEBUG_INFO"]
}
The first important attribute is technicalKey of the response status. Status RUNNING means that the bulk is still in progress. Copy the id of the bulk and use it in the next step.
warning

Do not start the next bulk job until the previous one is finished. To check the status of the bulk, go to the next step.

info

If a status other than 200 is returned, go to Developer Guidelines to check extended descriptions.

Step 4: Read a Bulk Fetch

To read a bulk fetch, you need to send a request using the Read Bulk Fetch endpoint.

  1. Use the Read Bulk Fetch endpoint to send the request,
  2. Paste the id of the bulk received in the previous step and paste it to the id field in the parameters,
  3. Click the Send button.
Loading...
  1. Check the details of the response.

If the response status is 200, you will receive a response similar to the below example:

Copy
Copied
{
    "id": "058d20f2-6138-4b73-bf2b-bed6adeb6e34",
    "createdAt": "2024-02-23T11:45:32.396Z",
    "finishedAt": "2024-02-23T11:45:32.464Z",
    "createdBy": "f1241873-7f01-41fa-b1c5-e747b630da61",
    "status": {
        "code": 200,
        "technicalKey": "OK",
        "details": [{
            "id": 200000007,
            "message": "The bulk has been executed successfully.",
            "technicalKey": "BULK_FINISHED",
            "jsonRecord":{}
        }]
    },
    "progress": 100,
    "results": [],
    "nextStartAfter": "MA%3D%3D"
}
The first important attribute is technicalKey of the response status. Status FINISHED means that the bulk is finished and the bulk fetch results are available in the results attribute in the value. Explore it for Business Partners Data.
success

You have successfully created and processed a bulk fetch.

info

Ifa status other than 200 is returned, go to Developer Guidelines to check extended descriptions.


Your opinion matters!

We are constantly working on providing an outstanding user experience with our products. Please share your opinion about this tutorial!

Mail our developer-portal team: developer-portal@cdq.com