Skip to content

File Format for DDLS (CDS Data Definitions) #160

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Aug 13, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
125 changes: 125 additions & 0 deletions file-formats/ddls/ddls.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://github.com/SAP/abap-file-formats/blob/main/file-formats/ddls/ddls.json",
"title": "Object Type DDLS",
"description": "DDLS object type",
"type": "object",
"properties": {
"$schema": {
"title": "Schema",
"description": "Format version",
"type": "string"
},
"header": {
"title": "Header",
"description": "Header",
"type": "object",
"properties": {
"description": {
"title": "Description",
"description": "Description of the ABAP object",
"type": "string",
"maxLength": 60
},
"originalLanguage": {
"title": "Original Language",
"description": "Original language of the ABAP object",
"type": "string",
"maxLength": 2
},
"abapLanguageVersion": {
"title": "ABAP Language Version",
"description": "ABAP language version",
"type": "string",
"enum": [
"standard",
"keyUser",
"cloudDevelopment"
],
"enumDescriptions": [
"Standard",
"ABAP for key user extensibility",
"ABAP cloud development"
],
"default": "standard"
}
},
"additionalProperties": false,
"required": [
"description",
"originalLanguage"
]
},
"sourceOrigin": {
"title": "Source Origin",
"description": "Source Origin",
"type": "string",
"enum": [
"abapDevelopmentTools",
"customCdsViews",
"customAnalyticalQueries",
"customBusinessObject",
"customCodeList",
"customCdsViewsVariantConfg",
"customFields",
"extensionsForDataSources",
"customSearchModeler",
"serviceConsumptionModel"
],
"enumDescriptions": [
"ABAP Development Tools",
"Custom CDS Views",
"Custom Analytical Queries",
"Custom Business Object",
"Custom Code List",
"Custom CDS Views for Variant Configurations",
"Custom Fields",
"Extensions for Data Sources",
"Custom Search Modeler",
"Service Consumption Model"
]
},
"sourceType": {
"title": "Source Type",
"description": "Source Type",
"type": "string",
"enum": [
"view",
"viewEntity",
"viewExtend",
"viewEntityExtend",
"tableFunction",
"tableEntity",
"abstractEntity",
"customEntity",
"hierarchy",
"projectionView"
],
"enumDescriptions": [
"View",
"View Entity",
"View Extend",
"View Entity Extend",
"Table Function",
"Table Entity",
"Abstract Entity",
"Custom Entity",
"Hierarchy",
"Projection View"
]
},
"parentName": {
"title": "Parent Name",
"description": "DDLS Name of the parent of an extend",
"type": "string",
"maxLength": 40
}
},
"additionalProperties": false,
"required": [
"$schema",
"header",
"sourceOrigin",
"sourceType"
]
}
8 changes: 8 additions & 0 deletions file-formats/ddls/examples/z_aff_example_ddls.ddls.cds
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
define view entity z_aff_example_ddls
as select from spfli
{
key carrid as Carrid,
key connid as Connid,
countryfr as Countryfr,
countryto as Countryto
}
9 changes: 9 additions & 0 deletions file-formats/ddls/examples/z_aff_example_ddls.ddls.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"$schema": "https://github.com/SAP/abap-file-formats/blob/main/file-formats/ddls/ddls.json",
"header": {
"description": "AFF Example DDLS",
"originalLanguage": "EN"
},
"sourceOrigin": "abapDevelopmentTools",
"sourceType": "viewEntity"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"BASEINFO":
{
"FROM":
[
"SPFLI"
],
"ASSOCIATED":
[],
"BASE":
[],
"ANNO_REF":
[],
"VERSION":0,
"ANNOREF_EVALUATION_ERROR":""
}
}
12 changes: 12 additions & 0 deletions file-formats/ddls/format.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# File Format for Object Type DDLS

The files correspond to the CDS Data Definintion source code, enriched with metadata and translation relevant texts.
Files with the ending `.cds` contain plain CDS source code.
The JSON schema is provided [here](./ddls.json).

Example files for a CDS Data Definition `z_aff_example_ddls` are provided in the following table.
File | Content
--- | ---
[`z_aff_example_ddls.ddls.json`](./examples/z_aff_example_ddls.ddls.json) | Properties and descriptions of the CDS Data Definition
[`z_aff_example_ddls.ddls.cds`](./examples/z_aff_example_ddls.cds) | CDS Source Code
[`z_aff_example_ddls.ddls.objectdependencies.json`](./examples/z_aff_example_ddls.objectdependencies.json) | All direct objects that are used in the CDS Data Definition
110 changes: 110 additions & 0 deletions file-formats/ddls/type/zif_aff_ddls_v1.intf.abap
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
INTERFACE zif_aff_ddls_v1
PUBLIC.

"! <p class="shorttext">Source Type</p>
"! Source Type
"! $values {@link zif_aff_ddls_v1.data:co_source_type}
TYPES ty_source_type TYPE c LENGTH 1.

"! <p class="shorttext">Source Origin</p>
"! Source Origin
"! $values {@link zif_aff_ddls_v1.data:co_source_origin}
TYPES ty_source_origin TYPE c LENGTH 1.

CONSTANTS:
"! <p class="shorttext">Source Type</p>
"! Source type
BEGIN OF co_source_type,
"! <p class="shorttext">View</p>
"! View
view TYPE ty_source_type VALUE 'V',
"! <p class="shorttext">View Entity</p>
"! View Entity
view_entity TYPE ty_source_type VALUE 'W',
"! <p class="shorttext">View Extend</p>
"! View Extend
view_extend TYPE ty_source_type VALUE 'E',
"! <p class="shorttext">View Entity Extend</p>
"! View Entity Extend
view_entity_extend TYPE ty_source_type VALUE 'X',
"! <p class="shorttext">Table Function</p>
"! Table Function
table_function TYPE ty_source_type VALUE 'F',
"! <p class="shorttext">Table Entity</p>
"! Table Entity
table_entity TYPE ty_source_type VALUE 'T',
"! <p class="shorttext">Abstract Entity</p>
"! Abstract Entity
abstract_entity TYPE ty_source_type VALUE 'A',
"! <p class="shorttext">Custom Entity</p>
"! Custom Entity
custom_entity TYPE ty_source_type VALUE 'Q',
"! <p class="shorttext">Hierarchy</p>
"! Hierarchy
hierarchy TYPE ty_source_type VALUE 'H',
"! <p class="shorttext">Projection View</p>
"! Projection View
projection_view TYPE ty_source_type VALUE 'P',
END OF co_source_type,

"! <p class="shorttext">Source Origin</p>
"! Source origin
BEGIN OF co_source_origin,
"! <p class="shorttext">ABAP Development Tools</p>
"! ABAP Development Tools
abap_development_tools TYPE ty_source_origin VALUE '0',
"! <p class="shorttext">Custom CDS Views</p>
"! Custom CDS Views
custom_cds_views TYPE ty_source_origin VALUE '1',
"! <p class="shorttext">Custom Analytical Queries</p>
"! Custom Analytical Queries
custom_analytical_queries TYPE ty_source_origin VALUE '2',
"! <p class="shorttext">Custom Business Object</p>
"! Custom Business Object
custom_business_object TYPE ty_source_origin VALUE '3',
"! <p class="shorttext">Custom Code List</p>
"! Custom Code List
custom_code_list TYPE ty_source_origin VALUE '4',
"! <p class="shorttext">Custom CDS Views for Variant Configurations</p>
"! Custom CDS Views for Variant Configurations
custom_cds_views_variant_confg TYPE ty_source_origin VALUE '5',
"! <p class="shorttext">Custom Fields</p>
"! Custom Fields
custom_fields TYPE ty_source_origin VALUE '6',
"! <p class="shorttext">Extensions for Data Sources</p>
"! Extensions for Data Sources
extensions_for_data_sources TYPE ty_source_origin VALUE '7',
"! <p class="shorttext">Custom Search Modeler</p>
"! Custom Search Modeler
custom_search_modeler TYPE ty_source_origin VALUE '8',
"! <p class="shorttext">Service Consumption Model</p>
"! Service Consumption Model
service_consumption_model TYPE ty_source_origin VALUE '9',
END OF co_source_origin.

TYPES:
"! <p class="shorttext">Object Type DDLS</p>
"! DDLS object type
BEGIN OF ty_main,
"! <p class="shorttext">Schema</p>
"! Format version
"! $required
schema TYPE string,
"! <p class="shorttext">Header</p>
"! Header
"! $required
header TYPE zif_aff_types_v1=>ty_header_60,
"! <p class="shorttext">Source Origin</p>
"! Source Origin
"! $required
source_origin TYPE ty_source_origin,
"! <p class="shorttext">Source Type</p>
"! Source Type
"! $required
source_type TYPE ty_source_type,
"! <p class="shorttext">Parent Name</p>
"! DDLS Name of the parent of an extend
parent_name TYPE c LENGTH 40,
END OF ty_main.

ENDINTERFACE.
8 changes: 8 additions & 0 deletions file-formats/ddls/type/zif_aff_ddls_v1.intf.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"$schema": "https://github.com/SAP/abap-file-formats/blob/main/file-formats/intf/intf.json",
"header": {
"description": "AFF type for DDLS objects",
"originalLanguage": "EN",
"abapLanguageVersion": "standard"
}
}