cancel
Showing results for 
Search instead for 
Did you mean: 

How to insert datetime through ODATA in Native Android App using SMP 3.0

Former Member
0 Kudos

Hi Folks,

I am struggling through inserting/updating datetime filed in MS SQL Server through OData service in my native android app.

i tried it by passing the hard code value "2015-07-05T12:00:00" but it does not work. I also tried to convert it into datetime format but no success.

Could you please help me in getting the right format for inserting datetime in my MS SQL database through OData service?

There is one more issue that when i am inserting or updating the value, the status code in response is 500 or Error. I am not getting the correct response from the server but my DB is getting updated.

I am unable to find the reason why the status code of response from server is 500 or Error? Could you please help me in this?

Thanks & Regards,

Deepak Sharma

Accepted Solutions (1)

Accepted Solutions (1)

Jitendra_Kansal
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Deepak,

Could you please share below info:

1.SMP server version? e.g. 3.0 SP08

2. Have you exposed MS-SQL server (DB) info into OData service via Integration Gateway?

3.if yes, "SAP Mobile Platform Tools" plugin version?

4. What is datatype of backend column?

5. What about value Type of property in OData model? Have you selected Edm.DataTime?

Does this discussion make sense ?

Regards,

JK

Former Member
0 Kudos

Hi JK,

Thanks for the quick response. Below are the following info :-

1.SMP server version?

3.0 SP05

2. Have you exposed MS-SQL server (DB) info into OData service via Integration Gateway?

YES

3.if yes, "SAP Mobile Platform Tools" plugin version?

SQL JDBC4-4.0.jar

4. What is datatype of backend column?

DateTime

5. What about value Type of property in OData model? Have you selected Edm.DataTime?

Yes In OData model it is Edm.DateTime

Actually i was trying to solve it by converting date value into Edm.DateTime by using ODataMetaProperty.EDMType.DateTime from front end but could not succeed.

Is there a way to convert date into Edm.DateTime from front-end?

Thanks & Regards,
Deepak

Jitendra_Kansal
Product and Topic Expert
Product and Topic Expert
0 Kudos

Before testing it from front-end, did you try if you were able to succeed in inserting data for the odata service using rest client?

Former Member
0 Kudos

I did not try for Post but i tried it for PUT. And it is working fine for PUT.

Jitendra_Kansal
Product and Topic Expert
Product and Topic Expert
0 Kudos

I am not sure how it can be done from front-end, i would loop to share some info on this.

Meanwhile, can you share piece of code how you have tried this particular use case?

Former Member
0 Kudos

Hi JK,

The issue is resolved. Now, I am able to insert date and time in my SQL Server database through ODATA.

Actually i tried it using dateTime, dateTimeOffset, long and Calendar by getting its instance.

But instead of simple calendar we have to use the Gregorian Calendar. So, I used Gregorian and it worked.

Thanks for your Quick response and help.

regards,

Deepak

Answers (0)