The forum will be unavailable for maintenance at some point from Friday, April 13 at 19:00 EDT until Sunday, April 15 at 23:59 EDT. Downtime will be minimized but the exact timing is unknown.


here is another problem with the OData service.

I have a user-defined function like this:

create or replace function "SystemData".GetCurrentUtcTimestamp()
returns timestamp
     declare utc timestamp;
     select CURRENT UTC TIMESTAMP into utc;
     return utc;

I granted execution permission to the corresponding role.

At the end of the osdl-file I have the serviceop Definition as:

serviceop get "SystemData"."GetCurrentUtcTimestamp" returns multiplicity "1";

Taking a look at the generated metadata I see a FunctionImport element in the EntityContainer-object like:

<FunctionImport Name="GetCurrentUtcTimestamp" MethodAccess="GET" ReturnType="Edm.DateTime"/>

So at first glance everything seems to be fine ... but ;-)

When generating the service reference in Visual Studio I don't have an ability to call this function. And navigating to the following URL http://localhost:8090/odata/GetCurrentTimestamp doesn't work either.

What am I doing wrong or what is missing here?

Any help are very much appreciated.



asked 07 Oct '14, 11:12

Armin%20Back's gravatar image

Armin Back
accept rate: 0%

edited 08 Oct '14, 03:49

Volker%20Barth's gravatar image

Volker Barth

You are also using the wrong URL to access the service operation. The metadata states the name is GetCurrentUtcTimestamp not GetCurrentTimestamp.

(07 Oct '14, 13:49) PhilippeBert...

There is an issue with invoking SQL functions through Service Operations.

As a work around, try making the function a stored procedure instead.

permanent link

answered 07 Oct '14, 11:22

PhilippeBertrand%20_SAP_'s gravatar image

accept rate: 22%

edited 09 Oct '14, 10:59

Hi Philippe,

thanks, will give it a try and let you know if this works.


(07 Oct '14, 11:25) Armin Back

Just tried it with a stored procedure but that doesn't work either ;-(.

(07 Oct '14, 12:12) Armin Back
Replies hidden

The following works fine for me :

create procedure GetCurUTC()
result (t1 timestamp)

service {
  serviceop get "DBA"."GetCurUTC" returns multiplicity "1";

I can then browse to http://machine:port/model/GetCurUTC


(07 Oct '14, 12:21) Reg Domaratzki

I just did a test again and you're absolute right that it works with a stored procedure ... don't know what I have done wrong yesterday ... maybe it was an URL typo as Philippe noted ... but I can't really believe it because I have checked everything twice before posting a question ... anyway, problem solved ;-)

(08 Oct '14, 03:48) Armin Back
Replies hidden

Well, I have another question regarding the stored procedure: calling it via the browser works fine ... but how to call it from within Visual Studio?

I had expected to find a static method at the generated service reference class, but there is no method or something called GetCurrentUtcTimestamp ...

Am I doing something wrong or can't a stored procedure be called through the service reference class (or an instance of it)?


(08 Oct '14, 08:30) Armin Back

The use of functions as service operations has been fixed for build

permanent link

answered 23 Oct '14, 19:54

PhilippeBertrand%20_SAP_'s gravatar image

accept rate: 22%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text]( "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:


question asked: 07 Oct '14, 11:12

question was seen: 718 times

last updated: 23 Oct '14, 19:54