cancel
Showing results for 
Search instead for 
Did you mean: 

Expose Structured Types (CDS) as valid OData v2

karstenvoigt
Participant
0 Kudos

Hi there,

we use structured types in our HANA CDS definitions like:

type LABCOLORTYPE {
    L: Decimal(25,5);
    A: Decimal(25,5);
    B: Decimal(25,5);
}

in different entities:

Entity Color {
       key id: PRIMKEYTYPE;
           materialnumber: String(20) not null;
           labcolor: LABCOLORTYPE not null;
           ...
   };

Now we expose that table as OData Service:

"my.db::color.Color" 
   as "Color"
   navigates (....;

Everything works well and the table is exposed as OData Service, but an integration with SAP Cloud Integration is not possible (EdmTypeException). The generate object names for structured types contain a dot (e.g. labcolor.L). The dot is not allowed in names according to OData specification.

Is there a way to avoid the dot in names in the generated OData Service? It seems that there is no way to map the dot to something like underscore (_) and I don't want to remove all structured types.

(We use the HANA service in SCP Neo.)

Any help is welcome!

Thanks.

Karsten

Accepted Solutions (1)

Accepted Solutions (1)

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

Actually the view is valid for write operations as long as you use an exit to perform the write.

But this is really the only choice if you want to use CDS and structured types. Of course you could just not use structured types. Or not use CDS at all. These are all options.

But also long as you use structured types the generated element names must be prefixed in such a way to ensure uniqueness. From the OData side it will simply expose whatever the DB has. We discussed but ultimately decided not to implement some kind of translation in the OData layer. Instead if you want to use the DB as your source you must ensure you only use names and constructs that would be compatible with OData. This means views or avoid this structured element feature.

karstenvoigt
Participant
0 Kudos

That's annoying, we will remove our structured types.

Answers (1)

Answers (1)

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

Put a CDs view on top of the entity and use the view as your source in OData. From the view you can alias the column names.

karstenvoigt
Participant
0 Kudos

Correct me if I'm wrong; but this will not solve our issue

The view can be used for read operations, but is not valid for write operations. In addition this will generate a lot of boilerplate views and every time I change the entities I have to adjust the views.

Isn't better a better way to 'work-a-round' that issue.