new template

This commit is contained in:
Wolfgang Koch
2021-05-12 10:03:58 +02:00
parent 70d132fed9
commit f952764b48
5 changed files with 241 additions and 0 deletions

View File

@@ -0,0 +1,44 @@
using {sap.capire.bookshop} from '_base/db/schema';
using {sap.capire.orders} from '_base/db/schema';
using from '_base/db/capire_common';
using {
cuid, managed, Country, sap.common.CodeList
} from '@sap/cds/common';
namespace Z_bookshop.extension;
// extend existing entity
extend orders.Orders with {
Z_newField : String default 'Default Value';
Z_NewAssociation : Association to one Z_NewEntity;
Z_NewCodeList : Association to one Z_NewCodeList;
Z_NewComposition : Composition of many Z_NewCompEntity on Z_NewComposition.parent = $self;
}
// new entity - as association target
entity Z_NewEntity : cuid, managed
{
description : String;
dateField : Date;
integerField : Integer;
stringField : String;
enumField : String @assert.range enum {high; medium; low} default 'medium';
rangeField : Decimal @assert.range: [ 1.0, 100.0 ] default 50.0;
}
// new entity - as code list
entity Z_NewCodeList : CodeList {
key code : String(11);
}
// new entity - as composition target
entity Z_NewCompEntity : cuid, managed
{
parent : Association to one orders.Orders;
description : String;
dateField : Date;
integerField : Integer;
stringField : String;
}