cancel
Showing results for 
Search instead for 
Did you mean: 

Deep insert JSON error

former_member184739
Contributor
0 Kudos

Dear all,

    Deep insert functionality works like a charm for XML but not for JSON. I dont know where i went wrong. Can you please help?

    I referred similar threads on this and I removed "results" tag from the request.


JSON data:


var data_json = {

  "d":{

  "__metadata":{

  "uri":"http://xxxx.xxxx.com:8000/sap/opu/odata/sap/Z_SRV_CL_FLIGHT_DETAILS/Airline_Details(CARRID='AA',CONN...')","type":"Z_SRV_CL_FLIGHT_DETAILS.FlightDetails"},

  "CARRID":"AA",

  "CONNID":"1234","FL_TO_BOOK_LIST":[{

  "__metadata":{  "uri":"http://xxxx.xxxx.com:8000/sap/opu/odata/sap/Z_SRV_CL_FLIGHT_DETAILS/Booking_Details(CARRID='AA',CONN...')","type":"Z_SRV_CL_FLIGHT_DETAILS.BookingDetails"},

  "CARRID":"AA",

  "CONNID":"1234",

  "BOOKID" : "8000"}]}};



Request payload is attached.


Should I implement this SAP note  # 1874920 for the following system release too ?

GW_CORE 200 0005

IW_BEP 200 0005

IW_FND 250 0005


Please suggest .


Regards

Prabaharan

Accepted Solutions (1)

Accepted Solutions (1)

former_member184867
Active Contributor
0 Kudos

Try something like

"d":{

  "FIELD1":"XX",

  "FIELD2":"SSS",

  "NAVIGATION_PROP_NAME":[{ "DFIELD1" : "VAL1" ,

                            "DFIELD2" : "VAL2"

                          }, {

     "DFIELD1" : "VAL1" ,

                            "DFIELD2" : "VAL2"

  }]

}

former_member184739
Contributor
0 Kudos

Hi Atanu,

I tried your suggestion but still same error. I am passing "Content-Type" as json but its throwing me XML error and the return type is "application/xml".

Do we need to apply these 2 notes?

1874920 - Error in "deep insert" case when parsing JSON

1751991 - OData Channel - Deep Insert in JSON Format Leads to Error

Thanks for your help.

Regards

Prabaharan

former_member184867
Active Contributor
0 Kudos

Check the notes if they are useful..

Hope you are passing all the properties of the entity

former_member184739
Contributor
0 Kudos

Hi Atanu,

Also i am getting in below method. Is this same as "Error while parsing an XML stream" (CX_SXML_PARSE_ERROR exception)" explained in Note 1751991(1751991 - OData Channel - Deep Insert in JSON Format Leads to Error).

method CONSTRUCTOR .

   if ( type <> if_sxml~co_xt_xml10 and

        type <> if_sxml~co_xt_binary and

        type <> if_sxml~co_xt_xop ).

     raise exception type cx_sxml_illegal_argument_error

       exporting

         textid = cx_sxml_illegal_argument_error=>illegal_xml_type.

   endif.

   me->if_sxml~type = type.

endmethod.


Regards

Prabaharan

arunchembra1
Participant
0 Kudos

Hi Prabharan,

Please find the below URL :

Thanks,

Arun

Answers (0)