Skip to Content

Deep Insert in Json Format

Hi Team,

I am facing  issue in JSON format which i can achieve using XML format for Create Deep Insert.Can you please have a look and provide your inputs.

SP is 740 SP4

Here for below, Navigation name is Nav2ReqProducts.

I am getting error while passing XML stream, I already referred below link, not able to trace out, and also please give sample JSON data which has multiple inputs as deep insert

http://scn.sap.com/message/14659195#14659195

{

"d":{

"__metadata":{

"uri" : "http://XXXXXXX.XXXX.com:8000/sap/opu/odata/sap/ZGW_TIRES_CASE_DETAIL_SRV/CaseHeaderSet('')",

  "type" : "ZGW_TIRES_CASE_DETAIL_SRV.CaseHeader"},

"PhoneNumber":"405-595-9130",

"DeviceId":"TEST",

"IvCaseNumber":"8000000519",

"CallDate":"/Date(1407110400000)/",

"CallTime":"PT11H55M00S",

"ServiceNeeded":"Tire Replacement",

"Location":"N bound on i-235 East of ball park",

"Latitude":"0.000000000000",

"Longitude":"0.000000000000",

"VehType":"01",

"VehYear":"2010",

"VehMake":"MACK",

"VehColor":"GREEN",

"VehLicplate":"KJI900",

"VehUnitnum":"54",

"TrailerNumber":"35",

"MaddencoInvoice":"",

"PaymentMethod":"01",

"AccountNo":"23234",

"ReferenceNo":"",

"Technician":"FRED SMITH",

"LoyaltyCard":"",

"StoreDate":"/Date(1407110400000)/",

"StoreTime":"PT12H00M00S",

"ArrivDate":"/Date(1407110400000)/",

"ArrivTime":"PT14H02M15S",

"RollDate":null,

"RollTime":"PT00H00M00S",

"DepDate":null,

"DepTime":"PT00H00M00S",

"EtaDate":"/Date(1407110400000)/",

"EtaTime":"PT13H30M00S",

"ReturnDate":null,

"ReturnTime":"PT00H00M00S",

"AuthPhone":"",

"MobileSentDate":"/Date(1407283200000)/",

"MobileSentTime":"PT14H21M51S",

"Nav2ReqProducts":

[{

"__metadata":{

"uri":"http://tcmod.XX.com/sap/opu/odata/sap/ZGW_TIRES_CASE_DETAIL_SRV/CaseReqProductsSet('0000000010')",

"type":"ZGW_TIRES_CASE_DETAIL_SRV.CaseReqProducts"},

"ItemNo":"0000000010",

"ProductId":"G27373",

"Description":"275/80R24.5 TR144 LRG TL",

"WheelPos":"02",

"TirePos":"02"}]}}

Thanks,

Vijay V

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

4 Answers

  • Best Answer
    avatar image
    Former Member
    Aug 12, 2014 at 04:13 PM

    Hello Vijay,

    Header:

    Pass the Token value

    Content-Type : application/json

    Accept : application/json ( to accept response in json format )

    Use the below payload :

    {

    "PhoneNumber":"405-595-9130",

    "DeviceId":"TEST",

    "IvCaseNumber":"8000000519",

    "CallDate":"2013-10-23T10:10:10",

    "CallTime":"PT11H55M00S",

    "ServiceNeeded":"Tire Replacement",

    "Location":"N bound on i-235 East of ball park",

    "Latitude":"0.000000000000",

    "Longitude":"0.000000000000",

    "VehType":"01",

    "VehYear":"2010",

    "VehMake":"MACK",

    "VehColor":"GREEN",

    "VehLicplate":"KJI900",

    "VehUnitnum":"54",

    "TrailerNumber":"35",

    "MaddencoInvoice":"",

    "PaymentMethod":"01",

    "AccountNo":"23234",

    "ReferenceNo":"",

    "Technician":"FRED SMITH",

    "LoyaltyCard":"",

    "StoreDate":"2013-10-23T10:10:10",

    "StoreTime":"PT12H00M00S",

    "ArrivDate":"2013-10-23T10:10:10",

    "ArrivTime":"PT14H02M15S",

    "RollDate":"null",

    "RollTime":"PT00H00M00S",

    "DepDate":"null",

    "DepTime":"PT00H00M00S",

    "EtaDate":"2013-10-23T10:10:10",

    "EtaTime":"PT13H30M00S",

    "ReturnDate":"null",

    "ReturnTime":"PT00H00M00S",

    "AuthPhone":"",

    "MobileSentDate":"2013-10-23T10:10:10",

    "MobileSentTime":"PT14H21M51S",

    "Nav2ReqProducts":

    [{

    "ItemNo":"0000000010",

    "ProductId":"G27373",

    "Description":"275/80R24.5 TR144 LRG TL",

    "WheelPos":"02",

    "TirePos":"02"

    }]

    }

    Regards,

    Ashwin

    Add comment
    10|10000 characters needed characters exceeded

  • Aug 12, 2014 at 07:58 AM

    Hi Vijay,

    I have faced the same issue which we resolved using implementing  SAP Note#1874920 with below URL and Request body.

    Note: Before trying with JSON make sure its working for XML

    URL : http://XXXXXXXX:8000/sap/opu/odata/sap/opu/odata/sap/ZMOB_AASTMGMT_SRV/NOTIFHEADER

    Header:  X-CSRF-==487fvi6p89p9-0unt8oh

                Content-Type : application/json

                Accept : application/json

    Request Body:

    {

    "d":{

    "__metadata":{

    "uri":"http://XXXXXXXX:8000/sap/opu/odata/sap/ZMOB_AASTMGMT_SRV/

    NOTIFHEADER('10000012')","type":"ZMOB_AASTMGMT_SRV.NOTIFHEADER"},

    "NotifLongtext": " Test ",

    "Maintloc": "100",

    "NotifNo": "10000012",

    "Maintplant": "1100",

    "Planplant": "1100",

    "LocAcc": "000000002216",

    "AddrNumber": "22874","QMNUM":

    [{

    "__metadata":{

    "uri":"http://XXXXXXXX:8000/sap/opu/odata/sap/ZMOB_AASTMGMT_SRV/

    NOTIFITEM(NotifNo='10000012',ItemKey='0001')","type":"ZMOB_AASTMGMT_SRV.NOTIFITEM"},

    "NotifNo":"10000012",

    "ItemKey":"0001",

    "CreatedDate":"\/Date(1384992000000)\/",

    "Prilang":"E",

    "PosTime":"PT14H03M33S",

    "ChangeTime":"PT00H00M00S",

    "ItemSortNo":"0001"}]}}

    Thanks,

    Arun

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Aug 13, 2014 at 05:27 AM

    Hello Vijay,

    Try with this please :

    {

             "PhoneNumber" : "405-595-9130",

             "DeviceId" : "TEST",

             "IvCaseNumber" : "8000000519",

             "CallDate" : "\/Date(1405382400000)\/",      

             "CallTime" : "PT08H00M00S",

             "ServiceNeeded" : "",

             "Location" : "loc1",

             "Latitude" : "293.320000000000",

             "Longitude" : "923.420000000000",

             "VehType" : "01",

             "VehYear" : "2004",

             "VehMake" : "TOYOTA",

             "VehColor" : "PINK",

             "VehLicplate" : "9B2127",

             "VehUnitnum" : "10923823",

             "TrailerNumber" : "",

             "MaddencoInvoice" : "AB1829APD",

             "PaymentMethod" : "04",

             "AccountNo" : "192AB39E23",

             "ReferenceNo" : "",

             "Technician" : "JEFF",

             "LoyaltyCard" : "",

             "StoreDate" : "\/Date(1405382400000)\/",

             "StoreTime" : "PT08H10M00S",

             "ArrivDate" : "\/Date(1405382400000)\/",

             "ArrivTime" : "PT08H28M00S",

             "RollDate" : "\/Date(1405382400000)\/",

             "RollTime" : "PT08H44M00S",

             "DepDate" : "\/Date(1405382400000)\/",

             "DepTime" : "PT08H17M00S",

             "EtaDate" : "\/Date(1405382400000)\/",

             "EtaTime" : "PT08H35M00S",

             "ReturnDate" : "\/Date(1405382400000)\/",

             "ReturnTime" : "PT08H59M00S",

             "AuthPhone" : "",

             "MobileSentDate" : "null",

             "MobileSentTime" : "PT00H00M00S",

             "Nav2ReqProducts":

             [{

                   "ItemNo" : "0000000010",

                   "ProductId" : "M00692",

                   "Description" : "225/70R19.5 G XST4",

                   "WheelPos" : "01",

                   "TirePos" : "06"

                 }],

             "Nav2RemProducts":

             [{

                   "SvcItem" : "00",

                   "FailureCause" : "",

                   "RemovalTread" : "",

                   "DeleteInd" : ""

                 }]

    }


    regards,

    Ashwin

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Aug 13, 2014 at 05:50 AM

    Hello Vijay,

    I think error is because of date field.

    Please do the following with some changes to payload and check :

    1. Change ABAP type to DATE in ABAP Type Editor in service builder.

    2. Regenerate objects.

    3. Clear /n/iwfnd/cache_cleanup, /n/iwbep/cache_cleanup & smicm cache to be on safer side.

    4. In a new session fire the service with the below payload.

    {

             "PhoneNumber" : "405-595-9130",

             "DeviceId" : "TEST",

             "IvCaseNumber" : "8000000519",

             "CallDate" : "\/Date(1405382400000)\/",    

             "CallTime" : "PT08H00M00S",

             "ServiceNeeded" : "",

             "Location" : "loc1",

             "Latitude" : "293.320000000000",

             "Longitude" : "923.420000000000",

             "VehType" : "01",

             "VehYear" : "2004",

             "VehMake" : "TOYOTA",

             "VehColor" : "PINK",

             "VehLicplate" : "9B2127",

             "VehUnitnum" : "10923823",

             "TrailerNumber" : "",

             "MaddencoInvoice" : "AB1829APD",

             "PaymentMethod" : "04",

             "AccountNo" : "192AB39E23",

             "ReferenceNo" : "",

             "Technician" : "JEFF",

             "LoyaltyCard" : "",

             "StoreDate" : "\/Date(1405382400000)\/",

             "StoreTime" : "PT08H10M00S",

             "ArrivDate" : "\/Date(1405382400000)\/",

             "ArrivTime" : "PT08H28M00S",

             "RollDate" : "\/Date(1405382400000)\/",

             "RollTime" : "PT08H44M00S",

             "DepDate" : "\/Date(1405382400000)\/",

             "DepTime" : "PT08H17M00S",

             "EtaDate" : "\/Date(1405382400000)\/",

             "EtaTime" : "PT08H35M00S",

             "ReturnDate" : "\/Date(1405382400000)\/",

             "ReturnTime" : "PT08H59M00S",

             "AuthPhone" : "",

             "MobileSentDate" : "null",

             "MobileSentTime" : "PT00H00M00S",

             "Nav2ReqProducts":

             [{

                   "ItemNo" : "0000000010",

                   "ProductId" : "M00692",

                   "Description" : "225/70R19.5 G XST4",

                   "WheelPos" : "01",

                   "TirePos" : "06"

                 }],

             "Nav2RemProducts":

             [{

                   "SvcItem" : "00",

                   "FailureCause" : "",

                   "RemovalTread" : "",

                   "DeleteInd" : ""

                 }]

    }

    Or

    {

    "PhoneNumber":"405-595-9130",

    "DeviceId":"TEST",

    "IvCaseNumber":"8000000519",

    "CallDate":"2013-10-23T10:10:10",

    "CallTime":"PT11H55M00S",

    "ServiceNeeded":"Tire Replacement",

    "Location":"N bound on i-235 East of ball park",

    "Latitude":"0.000000000000",

    "Longitude":"0.000000000000",

    "VehType":"01",

    "VehYear":"2010",

    "VehMake":"MACK",

    "VehColor":"GREEN",

    "VehLicplate":"KJI900",

    "VehUnitnum":"54",

    "TrailerNumber":"35",

    "MaddencoInvoice":"",

    "PaymentMethod":"01",

    "AccountNo":"23234",

    "ReferenceNo":"",

    "Technician":"FRED SMITH",

    "LoyaltyCard":"",

    "StoreDate":"2013-10-23T10:10:10",

    "StoreTime":"PT12H00M00S",

    "ArrivDate":"2013-10-23T10:10:10",

    "ArrivTime":"PT14H02M15S",

    "RollDate":"null",

    "RollTime":"PT00H00M00S",

    "DepDate":"null",

    "DepTime":"PT00H00M00S",

    "EtaDate":"2013-10-23T10:10:10",

    "EtaTime":"PT13H30M00S",

    "ReturnDate":"null",

    "ReturnTime":"PT00H00M00S",

    "AuthPhone":"",

    "MobileSentDate":"2013-10-23T10:10:10",

    "MobileSentTime":"PT14H21M51S",

    "Nav2ReqProducts":

    [{

    "ItemNo":"0000000010",

    "ProductId":"G27373",

    "Description":"275/80R24.5 TR144 LRG TL",

    "WheelPos":"02",

    "TirePos":"02"

    }]

    }

    both should work.

    revert if any issues. we can check.

    Regards,

    Ashwin

    Add comment
    10|10000 characters needed characters exceeded