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:
Scenario
In this instruction you will learn how to:
- Create a Bulk Lookup and Read a Bulk Lookup,
- Create a Bulk Fetch and Read a Bulk Fetch,
- 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.
- Use the Create Bulk Lookup endpoint to send the request,
- Select the Create Bulk Business Partner Lookup with Tasks example,
- Click the Send button.
Expand to see the JSON and curl payload.
- Payload
- curl
{- "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"
}
]
}
}
}
]
}
- Check the details of the response.
If the response status is 200, you will receive a response similar to the below example:
{
"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"]
}
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.
- Use the Read Bulk Lookup endpoint to send the request,
- Paste the
id
of the bulk received in the previous step and paste it to theid
field in the parameters, - Click the Send button.
- Check the details of the response.
If the response status is 200, you will receive a response similar to the below example:
{
"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"
}
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.
- Use the Create Bulk Fetch endpoint to send the request.
- Select the Create Bulk Business Partner Fetch with Tasks example.
- Click the Send button.
Expand to see the JSON and curl payload.
- Payload
- curl
{- "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"
}
]
}
}
}
]
}
- Check the details of the response.
If the response status is 200, you will receive a response similar to the below example:
{
"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"]
}
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.
- Use the Read Bulk Fetch endpoint to send the request,
- Paste the
id
of the bulk received in the previous step and paste it to theid
field in the parameters, - Click the Send button.
- Check the details of the response.
If the response status is 200, you will receive a response similar to the below example:
{
"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"
}
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