cancel
Showing results for 
Search instead for 
Did you mean: 

Json Date Issue

Pavan_Golesar
Active Participant

Hi Gurus,

I am using get expanded http response as http request for creating inquiry,

It works fine with .xml format,

but when i go for json payload it gives xml parsing error for date.

kindly, Do i only need to remove results and corresponding brackets ?

 

Accepted Solutions (1)

Accepted Solutions (1)

Pavan_Golesar
Active Participant
0 Kudos

Hi,

I figured it out that issue was with DATE format gateway.

Carried out following changes in abap editor for that property in Entity Type.

path:

Entity Type ->your Date Property ->Select Abap Editor.

Issue got resolved .

Thanks,

Pavan G

Answers (1)

Answers (1)

AshwinDutt
Active Contributor
0 Kudos

Hello Pavan,

Please share the JSON payload here which you are using for Deep Insert.

Regards,

Ashwin

Pavan_Golesar
Active Participant
0 Kudos

{

  "d" : {

    "__metadata" : {

      "id" : "XXXXX/sap/opu/odata/SAP/ZTEST_SRV/INHeaderSet('0009595604')",

      "uri" : "XXXXX/sap/opu/odata/SAP/ZTEST_SRV/INHeaderSet('0009595604')",

      "type" : "ZTEST_SRV.INHeader"

    },

    "InquiryNum" : "0009595604",

    "CreatedBy" : "PAVAN",

    "DocDate" : "\/Date(1440460800000)\/",

    "DocType" : "AF",

    "NetValHd" : "169.000000000",

    "SalesOrg" : "2000",

    "DistrChan" : "03",

    "Division" : "00",

    "SalesGrp" : "",

    "SalesOff" : "2001",

    "SoldTo" : "0000089016",

    "INItemSet" :[

        {

          "__metadata" : {

            "id" : "XXXXX/sap/opu/odata/SAP/ZTEST_SRV/INItemSet(InquiryNum='0009595604',ItmNumber='000010')",

            "uri" : "XXXXX/sap/opu/odata/SAP/ZTEST_SRV/INItemSet(InquiryNum='0009595604',ItmNumber='000010')",

            "type" : "ZTEST_SRV.INItem"

          },

          "InquiryNum" : "0009595604",

          "ItmNumber" : "000010",

          "UpdateFlag" : "",

          "UnitPrice" : "0.000",

          "Material" : "A220A",

          "ShortText" : "GIGASET A220A",

          "SchLine" : "",

          "TargetQty" : "1.000",

          "Plant" : "2000",

          "StgeLoc" : "",

          "INConditionSet" : {

            "__deferred" : {

              "uri" : "XXXXX/sap/opu/odata/SAP/ZTEST_SRV/INItemSet(InquiryNum='0009595604',ItmNumber='000010')/INConditionSet"

            }

          },

          "INScheduleSet" : [

              {

                "__metadata" : {

                  "id" : "XXXXX/sap/opu/odata/SAP/ZTEST_SRV/INScheduleSet(InquiryNum='0009595604',ItmNumber='000010')",

                  "uri" : "XXXXX/sap/opu/odata/SAP/ZTEST_SRV/INScheduleSet(InquiryNum='0009595604',ItmNumber='000010')",

                  "type" : "ZTEST_SRV.INSchedule"

                },

                "InquiryNum" : "0009595604",

                "ItmNumber" : "000010",

                "SchedLine" : "0001",

                "DelDate" : "\/Date(1440460800000)\/",

                "ReqQty" : "1.000"

              }

            ]

      ]

    },

    "INPartnerSet" :[

        {

          "__metadata" : {

            "id" : "XXXXX/sap/opu/odata/SAP/ZTEST_SRV/INPartnerSet(InquiryNum='0009595604',Address='')",

            "uri" : "XXXXX/sap/opu/odata/SAP/ZTEST_SRV/INPartnerSet(InquiryNum='0009595604',Address='')",

            "type" : "ZTEST_SRV.INPartner"

          },

          "InquiryNum" : "0009595604",

          "Address" : "",

          "ItmNumber" : "",

          "PartnRole" : "VE",

          "Customer" : "",

          "INAddressSet" : {

            "__metadata" : {

              "id" : "XXXXX/sap/opu/odata/SAP/ZTEST_SRV/INAddressSet(InquiryNum='0009595604',Address='')",

              "uri" : "XXXXX/sap/opu/odata/SAP/ZTEST_SRV/INAddressSet(InquiryNum='0009595604',Address='')",

              "type" : "ZTEST_SRV.INAddress"

            },

            "InquiryNum" : "0009595604",

            "Address" : "",

            "Name" : "",

            "Street" : "",

            "PostlCode" : "",

            "City" : ""

          }

        },

        {

          "__metadata" : {

            "id" : "XXXXX/sap/opu/odata/SAP/ZTEST_SRV/INPartnerSet(InquiryNum='0009595604',Address='0000029753')",

            "uri" : "XXXXX/sap/opu/odata/SAP/ZTEST_SRV/INPartnerSet(InquiryNum='0009595604',Address='0000029753')",

            "type" : "ZTEST_SRV.INPartner"

          },

          "InquiryNum" : "0009595604",

          "Address" : "0000029753",

          "ItmNumber" : "",

          "PartnRole" : "WE",

          "Customer" : "0000089016",

          "INAddressSet" : {

            "__metadata" : {

              "id" : "XXXXX/sap/opu/odata/SAP/ZTEST_SRV/INAddressSet(InquiryNum='0009595604',Address='0000029753')",

              "uri" : "XXXXX/sap/opu/odata/SAP/ZTEST_SRV/INAddressSet(InquiryNum='0009595604',Address='0000029753')",

              "type" : "ZTEST_SRV.INAddress"

            },

            "InquiryNum" : "0009595604",

            "Address" : "0000029753",

            "Name" : "BETTER LIFE MOE S/R",

            "Street" : "",

            "PostlCode" : "",

            "City" : "DUBAI"

          }

        }

      ]

  }

}

AshwinDutt
Active Contributor
0 Kudos

With this payload what is the Header you are passing ?

You need to pass Content-Type : application/json

Please set this header and check again with the same payload which you have shared.

I suspect above mentioned header is missed sending along with the payload.

Pavan_Golesar
Active Participant
0 Kudos

hello Ashwin,

yes I had already addded header for json, still error pertains..

Thanks,

Pavan G

AshwinDutt
Active Contributor
0 Kudos

Ok fine then.

How do you know if parse error is happening because of date only ?

Can you pass date value as null and check ? like below,

.....

  "DelDate" : null,

.....


See if the parse error still occurs.

Pavan_Golesar
Active Participant
0 Kudos

yes ashwin ,I had made changes and deleted the date from payload..

now error is :


Error while parsing XML Stream

regards,

Pavan G

AshwinDutt
Active Contributor
0 Kudos

Have you set Date field as null-able in SEGW ?

If not make it null-able and generate run-time artifacts.

Clear Model Cache in /iwfnd/cache_cleanup now and check again by sending the payload with Date value as null as below :

.....

  "DelDate" : null,

.....