cancel
Showing results for 
Search instead for 
Did you mean: 

Deep Insert in Json Format

vijaybhaskarraju_vegesana
Active Participant
0 Kudos

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

Accepted Solutions (1)

Accepted Solutions (1)

AshwinDutt
Active Contributor
0 Kudos

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

AshwinDutt
Active Contributor
0 Kudos

Hello Vijay,

The Body which u have shared here, from where are u getting this ? is it manually built by you ? Because i strongly feel that payload u have shared is not correct.

Payload shared by you :

{

         "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",                              " , " not needed

             }],

         "Nav2RemProducts":

         [{

               "SvcItem" : "00",

               "FailureCause" : "",

               "RemovalTread" : "",

               "DeleteInd" : "",                                " , " not needed

             }]}

Comments as per my knowledge:


For Date : Please check format once.


For null values : U need to send Null value inside "" .. like "null'" not just null with out quotes.


An extra comma added which is not needed.


Did u check the error log ?

what does it says ?

can u share error log please ?


also can u share the abap type which u have used in abap editor for date alone ?


regards,

Ashwin

vijaybhaskarraju_vegesana
Active Participant
0 Kudos

Thanks a ton Ashwin and thanks to Arun as well for your promt response.

Regards,

Vijay V

Answers (3)

Answers (3)

AshwinDutt
Active Contributor
0 Kudos

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

AshwinDutt
Active Contributor
0 Kudos

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

arunchembra1
Participant
0 Kudos

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

vijaybhaskarraju_vegesana
Active Participant
0 Kudos

Thanks for quick turnaround Arun.

Its working for XML. then I need to implement this note.Will try and let you know. Thanks.

Vijay V

vijaybhaskarraju_vegesana
Active Participant
0 Kudos

Hi Arun,

We have GW_FND component, hence this note already  is part of it.

I am not able to sort out in Json format Can you please build my XML data in JSON format.

Thanks,

Vijay V