Skip to Content
avatar image
Former Member

Not able to post sales order with items using odata interface - Bad Request response

Hi Experts,

Am trying post sales order with item using odata import service and getting "Bad request" response error.

Import service used:

https://host-api.s4hana.ondemand.com/sap/opu/odata/sap/CUAN_IMPORT_SRV/ImportHeaders

Method: Post

Example request:

{

"data": {

"Interactions": [

{ "CommunicationMedium" : "BUSINESS_DOCUMENT",

"ContactId" : "xyz@gmail.com",

"ContactIdOrigin" : "EMAIL",

"InteractionType" : "SALES_ORDER",

"IsAnonymous" : "false",

"Timestamp" : "/Date(20170801222212)/",

"Currency" : "DKK",

"Amount" : "250",

"Products" : [

{ "ItemId" : "354290",

"Quantity": "2",

"Currency" : "DKK",

"Amount": "100",

"Name": "TEST"

}

]

}

]

}

}

Response:

"The Data Services Request could not be understood due to malformed syntax"

Could you please let me know if am missing something in request.

Thanks and regards,

Dinesh.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Best Answer
    avatar image
    Former Member
    Sep 05, 2017 at 11:49 PM

    Dear Dinesh,

    I think you are missing the ItemType in your products, which is mandatory when uploading products in interactions.

    ItemTypeXProduct type, for example SAP_CRM_PRODUCT, SAP_HYBRIS_PRODUCT, SAP_ERP_MATNR

    Please read through following too:

    https://uacp2.hana.ondemand.com/viewer/c43005898be34c8ca6c433635fbb18ca/1708%20500/en-US/60ff8b5544fdbf5de10000000a423f68.html

    Add comment
    10|10000 characters needed characters exceeded

    • Hi Dinesh,

      JSON Syntax was having wrong format at AMOUNT field. Please find the corrected JSON:

      {
      "ID": "10004",
      "SourceSystemId": "ANY",
      "SourceSystemType": "",
      "Timestamp": "/Date(20170801222212)/",
      "UserName": "XYZ",
      "Interactions": [{
      "Key": "",
      "CommunicationMedium": "BUSINESS_DOCUMENT",
      "ContactId": "XYZ @gmail.com ",

      "ContactIdOrigin": "EMAIL",

      "InteractionType": "SALES_ORDER",

      "IsAnonymous": "false",

      "Timestamp": "/Date(20170801222212)/",

      "Products": [

      {
      "ItemId": "YYYYY0700S",

      "ItemType": "SAP_C4C_PRODUCT"
      }
      ]
      }]
      }

  • Sep 08, 2017 at 12:24 PM

    Hi Dinesh,

    It should accept Amount as well as long as its in the required format and is passed in between "23.50".

    Also i see that its the last value in your product segment can you remove the closing comma at the end of the amount.

    I believe the comma makes the system believe that another value is following while the data is being closed.

    I am not an expert on ODATA but i did check it in my system and Amount is working and last value should not be followed by comma.

    Thanks

    Vineet.

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi Vineet,

      Thanks for the response.

      I was able to post sales order successfully by modifying structure after validating JSON format.

      Thanks and regards,

      Dinesh.