https://github.com/nvm-sh/nvm
allows switching between multiple node versionsnpm i -g @Sap/cds-dk
npm i -g mbt --unsafe-perm=true --allow-root
npm i -g mta --unsafe-perm=true --allow-root
SAP
, install the following extensionsnpm i -g hana-cli
npm install -g mbt
cds init invoice_sample
This will create a default project structure
npm install
Pull all the required libraries, for example sqlite
schema.cds
file to contain the definitionsentity AccountingDocumentHeader {
CompanyCode : String(4);
AccDocNo : String;
Year : Date;
Vendor : String(50);
DocHeaderText : String;
Plant : String;
}
cds deploy --to sqlite
and examine our tableusing {com.cap.accountingDoc as accountingDoc} from '../db/schema'; service AccountingDocumentService @(path : '/api') { entity DocumentHeaderService as projection on accountingDoc.AccountingDocumentHeader; }
annotate com.cap.accountingDoc.AccountingDocumentHeader with @fiori.draft.enabled; annotate AccountingDocumentService.DocumentHeaderService with @odata.draft.enabled;
annotate AccountingDocumentService.DocumentHeaderService with @(
UI.HeaderInfo : {
TypeName : 'Accounting Documente',
TypeNamePlural : 'Accounting Documents',
Title : {
$Type : 'UI.DataField',
Value : companyCode
}
},
UI.LineItem : [
{
$Type : 'UI.DataField',
Value : companyCode
},
{
$Type : 'UI.DataField',
Value : accDocNo
},
{
$Type : 'UI.DataField',
Value : year
},
{
$Type : 'UI.DataField',
Value : docHeaderText
},
{
$Type : 'UI.DataField',
Value : plant
},
{
Value : sensitivity,
Criticality : criticality
}
],
UI.SelectionFields : [
companyCode,
accDocNo,
year,
plant,
sensitivity
],
UI.HeaderFacets : [{
$Type : 'UI.ReferenceFacet',
Target : '@UI.FieldGroup#IndustryDetail',
Label : '{i18n>Ind.HeaderFacetIndDetails}'
}],
UI.Facets : [{
$Type : 'UI.CollectionFacet',
Label : '{i18n>Ind.FacetIndustryInfo}',
Facets : [{
$Type : 'UI.ReferenceFacet',
Target : '@UI.FieldGroup#IndustryInfo',
Label : '{i18n>Ind.FacetRegionDescription}'
}, ]
}],
UI.FieldGroup #IndustryDetail : {Data : [
{
$Type : 'UI.DataField',
Value : companyCode
},
{
$Type : 'UI.DataField',
Value : accDocNo
},
{
$Type : 'UI.DataField',
Value : year
}
]},
UI.FieldGroup #IndustryInfo : {Data : [
{
$Type : 'UI.DataField',
Value : bp
},
{
$Type : 'UI.DataField',
Value : docHeaderText
},
{
$Type : 'UI.DataField',
Value : plant
},
{
Value : sensitivity,
Criticality : criticality
}
]}
);
cds watch
in the project directory and fire your localhost:4040You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
32 | |
24 | |
8 | |
7 | |
7 | |
6 | |
6 | |
6 | |
5 | |
4 |