Skip to content

Issue with Batch call with dependent changeset #5842

@fahadcybertech

Description

@fahadcybertech

Describe the Bug

We are trying to execute batch call from BB/TP CAP application to create Nested Handling units in one go..
As part of this, HU batch API is being used as per the following documentation
https://help.sap.com/docs/SAP_S4HANA_CLOUD/9ce855c709ce4f5c99b685903461106e/8d4ac994e30848d695989961d418eef0.html?locale=en-US#example-create-nested-handling-unit

Here, the second HU is processed first and is being further referred in 1st HU changeset using $2 value.
Here is a sample of batch request body, which works fine from postman (which means there are no issue with S4HANA API):

--batch
Content-Type: multipart/mixed;boundary=change_set_1

--change_set_1
Content-Type: application/http
Content-Transfer-Encoding: binary
Content-ID: 1

POST HandlingUnit HTTP/1.1
Content-Type: application/json
prefer: return=representation

{
"HandlingUnitExternalID": "$1",
"Warehouse": "",
"PackagingMaterial": "BOX",
"_HandlingUnitItem": [
{
"HandlingUnitExternalID": "$1",
"HandlingUnitTypeOfContent": "3",
"HandlingUnitNestedExternalID" : "$2"
}
]
}

--change_set_1
Content-Type: application/http
Content-Transfer-Encoding: binary
Content-ID: 2

POST HandlingUnit HTTP/1.1
Content-Type: application/json
prefer: return=representation

{
"HandlingUnitExternalID": "$2",
"Warehouse": "",
"PackagingMaterial": "TUBE",
"_HandlingUnitItem":
[
{
"HandlingUnitExternalID": "$2",
"HandlingUnitTypeOfContent": "1",
"Material": "5920",
"HandlingUnitQuantity": 1,
"HandlingUnitQuantityUnit": "EA",
"Plant": "3011",
"StorageLocation": "301C",
"Batch":"MRKT18"
},
{
"HandlingUnitExternalID": "$2",
"HandlingUnitTypeOfContent": "1",
"Material": "5921",
"HandlingUnitQuantity": 1,
"HandlingUnitQuantityUnit": "EA",
"Plant": "3011",
"StorageLocation": "301C",
"Batch":"MRKT18"
}
]
}

--change_set_1--
--batch--

We have created changeset and batch body as per the above structure using SAP SDK for Javascript Client API. However, batch call fails as it is considering the two changesets as individual blocks, which won't work from S4HANA API perspective... If we using batch call for creating bulk HUs which are not dependent, there are no issues...

Please let us know how this can be handled from Cloud SDK for JS.

Steps to Reproduce

Create Client libraries for Handling Unit API
invoke the batch call with the details mentioned in the message

Expected Behavior

Successful batch call

Screenshots

No response

Used Versions

  • Node version via node -v: ...v22.13.1
  • NPM version via `npm -v: ...10.9.2
  • SAP Cloud SDK version: ...
    "@sap-cloud-sdk/connectivity": "^3",
    "@sap-cloud-sdk/http-client": "^3.26.4",
    "@sap-cloud-sdk/odata-v2": "^3.24.0",
    "@sap-cloud-sdk/resilience": "^3",
    "@sap/cds": "^8",
  • For CAP users, CAP version: ...
    "@cap-js-community/odata-v2-adapter": "^1.14.4",
    "@cap-js/hana": "^1",

Code Examples

No response

Log File

No response

Affected Development Phase

Development

Impact

Blocked

Timeline

No response

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature requestRequests for new functionality

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions