cancel
Showing results for 
Search instead for 
Did you mean: 

Layered CDS Definition For UDF Return Table

Former Member
0 Kudos

I get an error trying to use a layered CDS definition in a UDF (message below).

My type declaration in the hdbdd-file looks something like this:

...

type Base {

MANDT : String(3);    

KOKRS : String(4);

};

type Xtra {

BUKRS : String(4);     

SEGMENT : String(10);

};

type Useful {

BaseFields : Base;    

XtraFields : Xtra;

};


The function like this:


FUNCTION mySchema"."myPack::myFunction"

RETURNS "mySchema"."myPack::myDef.Useful"

...

RETURN SELECT MANDT, KOKRS, BUKRS, SEGMENT from ...

The error message is: "Could not create catalog object: return type mismatch; Attribute name "Useful.MANDT"  different from Attribute name: "MANDT" ....

Obviously this works:

type Useful {

MANDT : String(3);    

KOKRS : String(4);

BUKRS : String(4);     

SEGMENT : String(10);

  };


Is it not possible to use this type of layered declarations?

Accepted Solutions (1)

Accepted Solutions (1)

pfefferf
Active Contributor
0 Kudos

Hello Martin,

it is possible using the full qualified field name as alias.

According to your type definition the return statement should look like following:

RETURN SELECT "MANDT" as "BaseFields.MANDT", "KOKRS" as "BaseFields.KOKRS", "BUKRS" as "XtraFields.BUKRS", "SEGMENT" as "XtraFIelds.SEGMENT" from ...

I wonder a little bit about the attribute name "Useful.MANDT" in the error message, cause that does not match the type definition. But maybe that error message is from another try from you.

Regards,

Florian

Answers (0)