Skip to content

Commit

Permalink
readme
Browse files Browse the repository at this point in the history
  • Loading branch information
ThePlenkov committed Nov 11, 2024
1 parent 6692329 commit 980c524
Showing 1 changed file with 72 additions and 4 deletions.
76 changes: 72 additions & 4 deletions samples/cds/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,75 @@
# samples/cds
# [POC] Compile ABAP artifacts from CAP CDS models

This library was generated with [Nx](https://nx.dev).
## The idea

## Running unit tests
The idea is to compile ABAP artifacts from CAP CDS models.

Run `nx test samples/cds` to execute the unit tests via [Vitest](https://vitest.dev/).
For example if we have an existing model like this:

```cds
entity projects {
key id: String;
type: projectTypes:projectType;
status: ProjectStatus;
description: String;
```

we can annotate it with ABAP annotations like this:

```cds
using { projects } from './projects';
@abap.ddic.table: 'ZPROJECTS'
annotate projects with {
@abap.ddic: {
dataElement: {
generate: true,
name: 'ZPROJECT_ID',
domain: {
description: 'Project Id',
dataType: 'CHAR',
length: 32
}
}
}
id;
...
};
```

and then compile it to ABAP artifacts like this:

data element ZPROJECT_ID.dtel.xml

```xml
<abapGit version="v1.0.0" serializer="LCL_OBJECT_DTEL" serializer_version="v1.0.0">
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
<asx:values>
<DD04V>
<ROLLNAME>ZPROJECT_ID</ROLLNAME>
<DDLANGUAGE>E</DDLANGUAGE>
<DTELMASTER>E</DTELMASTER>
</DD04V>
</asx:values>
</asx:abap>
</abapGit>
```

and corresponding domain ZPROJECT_ID:

```xml
<abapGit version="v1.0.0" serializer="LCL_OBJECT_DOMA" serializer_version="v1.0.0">
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
<asx:values>
<DD01V>
<DOMNAME>ZPROJECT_ID</DOMNAME>
<DATATYPE>CHAR</DATATYPE>
<LENG>32</LENG>
</DD01V>
</asx:values>
</asx:abap>
</abapGit>
```

Of course - there will be much more properties and artifacts supported, this is just the simplest example.

0 comments on commit 980c524

Please sign in to comment.