Skip to Content
author's profile photo Former Member
Former Member

Layered CDS Definition For UDF Return Table

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?

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • Best Answer
    Posted on Jul 27, 2016 at 06:57 AM

    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

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.