Skip to Content
0

HANA XSA: Using table functions in CDS Views

Jun 17, 2017 at 07:19 AM

223

avatar image

Dear Experts,

I would like to use a user defined table function in a cds view. But I will get a syntax error in CDS code editor.

Function definition:

FUNCTION "xyz.db.function::getUserClientIdsFromRoles" ( )    
RETURNS TABLE ( "Id"   NVARCHAR(10) )  
   LANGUAGE SQLSCRIPT SQL 
   SECURITY INVOKER               
AS 
BEGIN ..... END

View definition:

DEFINE VIEW UserClientView AS
           SELECT FROM "xyz.db.function::getUserClientIdsFromRoles"() 
           {
                Id AS "Client"
           };        

The WebIDE CDS Editor is showing an error in the view definition:

"CDS: error: Unexpected token "(""

Regards

Achim

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

2 Answers

Valery Semichev Jul 09 at 08:44 AM
1

Hi Achim!

Table functions were not available in Core Data Services view definition since XS and HANA 1.0. I don't know reason why, and it's not clearly stated in SAP official docs. There are workarounds how to overcome this, but they are weird and I gave up and implemented same logic into the view itself.

Regards, Valery

Show 1 Share
10 |10000 characters needed characters left characters exceeded

How did u manage it in XS Valery Semichev?

0
avatar image
Former Member
Jun 23, 2017 at 05:26 PM
0

Hello Achim:

I don't know what causes that problem, but I have alerted some colleagues on the WebIDE team to the problem you are seeing.

Regards,

Carl Soane

Share
10 |10000 characters needed characters left characters exceeded