diff --git a/file-formats/ttyp/README.md b/file-formats/ttyp/README.md new file mode 100644 index 000000000..366988660 --- /dev/null +++ b/file-formats/ttyp/README.md @@ -0,0 +1,13 @@ +# Table Type File Format + +## Object Type Information + +Object Type | Description | Group +:--- | :--- | :--- +TTYP | Table Type | Dictionary + +## File Structure + +File | Cardinality | Definition | Schema | Example +:--- | :--- | :--- | :--- | :--- +`.ttyp.json` | 1 | [`zif_aff_ttyp_v1.intf.abap`](./type/zif_aff_ttyp_v1.intf.abap) | [`ttyp-v1.json`](./ttyp-v1.json) | [`z_aff_example_ttyp.ttyp.json`](./examples/z_aff_example_ttyp.ttyp.json) diff --git a/file-formats/ttyp/examples/z_aff_example_ttyp.ttyp.json b/file-formats/ttyp/examples/z_aff_example_ttyp.ttyp.json new file mode 100644 index 000000000..4f80491c6 --- /dev/null +++ b/file-formats/ttyp/examples/z_aff_example_ttyp.ttyp.json @@ -0,0 +1,31 @@ +{ + "formatVersion": "1", + "header": { + "description": "Example table type for ABAP file formats", + "originalLanguage": "en" + }, + "rowType": { + "typeKind": "dictionaryType", + "typeName": "Z_AFF_EXAMPLE_STRUC" + }, + "initAndAccess": { + "accessType": "sorted", + "initialRowCount": 10 + }, + "keySettings": { + "primaryKey": { + "definition": "keyComponents", + "kind": "unique", + "components": [ + { + "name": "FIELD1" + }, + { + "name": "FIELD2" + } + ] + }, + "secKeysAllowed": "notAllowed", + "secondaryKeys": [] + } +} diff --git a/file-formats/ttyp/ttyp-v1.json b/file-formats/ttyp/ttyp-v1.json new file mode 100644 index 000000000..efc6f19cc --- /dev/null +++ b/file-formats/ttyp/ttyp-v1.json @@ -0,0 +1,368 @@ +{ + "$comment": "This file is autogenerated, do not edit manually, see https://github.com/SAP/abap-file-formats for more information.", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://github.com/SAP/abap-file-formats/blob/main/file-formats/ttyp/ttyp-v1.json", + "title": "Table Type", + "description": "ABAP dictionary table type (TTYP)", + "type": "object", + "properties": { + "formatVersion": { + "title": "Format Version", + "description": "Format version", + "type": "string", + "const": "1" + }, + "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", + "minLength": 2 + } + }, + "additionalProperties": false, + "required": [ + "description", + "originalLanguage" + ] + }, + "rowType": { + "title": "Row Type", + "description": "Definition of the table line type", + "type": "object", + "properties": { + "typeKind": { + "title": "Type Kind", + "description": "How the row type is specified", + "type": "string", + "enum": [ + "dictionaryType", + "refToDictionaryType", + "refToClassOrInterfaceType", + "rangeTypeOnDataelement", + "rangeTypeOnPredefinedType", + "predefinedAbapType", + "refToPredefinedAbapType" + ], + "enumTitles": [ + "Dictionary Type", + "Reference to Dictionary Type", + "Reference to Class or Interface", + "Range Type on Data Element", + "Range Type on Predefined Type", + "Predefined ABAP Type", + "Reference to Predefined ABAP Type" + ], + "enumDescriptions": [ + "Line type is a named dictionary type (structure, table type, data element, etc.)", + "Line type is a reference to a named dictionary type", + "Line type is a reference to a class or interface type", + "Line type is a ranges table based on a data element", + "Line type is a ranges table based on a predefined ABAP type", + "Line type is a predefined ABAP built-in type", + "Line type is a reference to a predefined ABAP built-in type" + ], + "default": "dictionaryType" + }, + "typeName": { + "title": "Type Name", + "description": "Name of the referenced dictionary type, class, interface, or data element. Relevant when typeKind is dictionaryType, refToDictionaryType, refToClassOrInterfaceType, or rangeTypeOnDataelement.", + "type": "string", + "maxLength": 30 + }, + "builtInType": { + "title": "Built-In Type", + "description": "Details of the built-in ABAP type used as row type. Relevant when typeKind is predefinedAbapType or refToPredefinedAbapType.", + "type": "object", + "properties": { + "dataType": { + "title": "Data Type", + "description": "ABAP built-in data type name (e.g. CHAR, INT4, STRING)", + "type": "string", + "maxLength": 10 + }, + "length": { + "title": "Length", + "description": "Length of the built-in type (relevant for length-variable types such as CHAR, NUMC)", + "type": "integer", + "minimum": 0, + "maximum": 2147483647 + }, + "decimals": { + "title": "Decimals", + "description": "Number of decimal places (relevant for DEC, CURR, QUAN)", + "type": "integer", + "minimum": 0, + "maximum": 2147483647 + } + }, + "additionalProperties": false, + "required": [ + "dataType" + ] + }, + "rangeType": { + "title": "Range Type", + "description": "Name of the predefined ABAP type for the RANGES row. Relevant when typeKind is rangeTypeOnPredefinedType.", + "type": "string", + "maxLength": 10 + } + }, + "additionalProperties": false, + "required": [ + "typeKind" + ] + }, + "initAndAccess": { + "title": "Initialization and Access", + "description": "Access type and initial fill size", + "type": "object", + "properties": { + "accessType": { + "title": "Access Type", + "description": "Internal table access type", + "type": "string", + "enum": [ + "standard", + "sorted", + "hashed", + "index", + "notSpecified" + ], + "enumTitles": [ + "Standard", + "Sorted", + "Hashed", + "Index", + "Not Specified" + ], + "enumDescriptions": [ + "Standard table (access by index or key)", + "Sorted table (access by key with binary search)", + "Hashed table (access by unique hash key only)", + "Any index table type (standard or sorted, determined at usage)", + "Access type not specified (fully generic table type)" + ], + "default": "standard" + }, + "initialRowCount": { + "title": "Initial Row Count", + "description": "Expected initial number of rows; used for memory pre-allocation", + "type": "integer", + "minimum": 0, + "maximum": 2147483647 + } + }, + "additionalProperties": false + }, + "keySettings": { + "title": "Key Settings", + "description": "Primary and secondary key definitions", + "type": "object", + "properties": { + "primaryKey": { + "title": "Primary Key", + "description": "Primary key definition", + "type": "object", + "properties": { + "definition": { + "title": "Key Definition", + "description": "How the primary key fields are determined", + "type": "string", + "enum": [ + "rowType", + "keyComponents", + "standard" + ], + "enumTitles": [ + "Row Type (All Non-Reference Fields)", + "Key Components", + "Standard (Empty Key)" + ], + "enumDescriptions": [ + "Key consists of all non-reference fields of the row type (classic default)", + "Key fields are listed explicitly in key components", + "Empty primary key; used for standard tables without explicit key definition" + ], + "default": "rowType" + }, + "kind": { + "title": "Key Uniqueness", + "description": "Whether the primary key is unique or non-unique", + "type": "string", + "enum": [ + "unique", + "nonUnique", + "notSpecified" + ], + "enumTitles": [ + "Unique", + "Non-Unique", + "Not Specified" + ], + "enumDescriptions": [ + "Duplicate key values are not allowed", + "Duplicate key values are allowed", + "Uniqueness not specified" + ], + "default": "notSpecified" + }, + "alias": { + "title": "Alias", + "description": "Optional alias name for the primary key; only relevant for sorted or hashed tables", + "type": "string", + "maxLength": 30 + }, + "components": { + "title": "Key Components", + "description": "Explicitly named key fields; relevant when definition is keyComponents", + "type": "array", + "items": { + "title": "Key Component", + "description": "A single explicitly named key field", + "type": "object", + "properties": { + "name": { + "title": "Name", + "description": "Field name of the key component", + "type": "string", + "maxLength": 30 + } + }, + "additionalProperties": false, + "required": [ + "name" + ] + } + } + }, + "additionalProperties": false + }, + "secKeysAllowed": { + "title": "Further Secondary Keys", + "description": "Whether additional secondary keys beyond those listed may be defined at usage", + "type": "string", + "enum": [ + "notAllowed", + "allowed" + ], + "enumTitles": [ + "Not Allowed", + "Allowed" + ], + "enumDescriptions": [ + "No further secondary keys may be defined at usage", + "Further secondary keys may be defined at usage" + ], + "default": "notAllowed" + }, + "secondaryKeys": { + "title": "Secondary Keys", + "description": "Defined secondary keys", + "type": "array", + "items": { + "title": "Secondary Key", + "description": "Definition of a single secondary table key", + "type": "object", + "properties": { + "identifier": { + "title": "Identifier", + "description": "Name of the secondary key (up to 30 characters)", + "type": "string", + "maxLength": 30 + }, + "description": { + "title": "Description", + "description": "Short description of the secondary key", + "type": "string", + "maxLength": 80 + }, + "access": { + "title": "Access Type", + "description": "Access type of the secondary key", + "type": "string", + "enum": [ + "uniqueHashed", + "uniqueSorted", + "nonUniqueSorted" + ], + "enumTitles": [ + "Unique Hashed", + "Unique Sorted", + "Non-Unique Sorted" + ], + "enumDescriptions": [ + "Secondary key is a unique hashed key", + "Secondary key is a unique sorted key", + "Secondary key is a non-unique sorted key" + ], + "default": "uniqueHashed" + }, + "definition": { + "title": "Key Definition", + "description": "How the secondary key fields are determined", + "type": "string", + "enum": [ + "rowType", + "keyComponents" + ], + "enumTitles": [ + "Row Type (All Fields)", + "Key Components" + ], + "enumDescriptions": [ + "All fields of the row type are secondary key fields", + "Key fields are listed explicitly in key components" + ], + "default": "rowType" + }, + "components": { + "title": "Key Components", + "description": "Explicitly named key fields; relevant when definition is keyComponents", + "type": "array", + "items": { + "title": "Key Component", + "description": "A single explicitly named key field", + "type": "object", + "properties": { + "name": { + "title": "Name", + "description": "Field name of the key component", + "type": "string", + "maxLength": 30 + } + }, + "additionalProperties": false, + "required": [ + "name" + ] + } + } + }, + "additionalProperties": false, + "required": [ + "identifier" + ] + } + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false, + "required": [ + "formatVersion", + "header", + "rowType" + ] +} diff --git a/file-formats/ttyp/type/zif_aff_ttyp_v1.intf.abap b/file-formats/ttyp/type/zif_aff_ttyp_v1.intf.abap new file mode 100644 index 000000000..cf70ca647 --- /dev/null +++ b/file-formats/ttyp/type/zif_aff_ttyp_v1.intf.abap @@ -0,0 +1,314 @@ +INTERFACE zif_aff_ttyp_v1 PUBLIC. + + "!

Row Type Kind

+ "! Kind of the row type definition + "! $values {@link zif_aff_ttyp_v1.data:co_row_type_kind} + "! $default {@link zif_aff_ttyp_v1.data:co_row_type_kind.dictionary_type} + TYPES ty_row_type_kind TYPE c LENGTH 30. + + CONSTANTS: + "!

Row Type Kind

+ "! Kind of the row type definition + BEGIN OF co_row_type_kind, + "!

Dictionary Type

+ "! Line type is a named dictionary type (structure, table type, data element, etc.) + dictionary_type TYPE ty_row_type_kind VALUE 'dictionaryType', + "!

Reference to Dictionary Type

+ "! Line type is a reference to a named dictionary type + ref_to_dictionary_type TYPE ty_row_type_kind VALUE 'refToDictionaryType', + "!

Reference to Class or Interface

+ "! Line type is a reference to a class or interface type + ref_to_class_or_interface_type TYPE ty_row_type_kind VALUE 'refToClassOrInterfaceType', + "!

Range Type on Data Element

+ "! Line type is a ranges table based on a data element + range_type_on_dataelement TYPE ty_row_type_kind VALUE 'rangeTypeOnDataelement', + "!

Range Type on Predefined Type

+ "! Line type is a ranges table based on a predefined ABAP type + range_type_on_predefined_type TYPE ty_row_type_kind VALUE 'rangeTypeOnPredefinedType', + "!

Predefined ABAP Type

+ "! Line type is a predefined ABAP built-in type + predefined_abap_type TYPE ty_row_type_kind VALUE 'predefinedAbapType', + "!

Reference to Predefined ABAP Type

+ "! Line type is a reference to a predefined ABAP built-in type + ref_to_predefined_abap_type TYPE ty_row_type_kind VALUE 'refToPredefinedAbapType', + END OF co_row_type_kind. + + "!

Access Type

+ "! Internal table access type + "! $values {@link zif_aff_ttyp_v1.data:co_access_type} + "! $default {@link zif_aff_ttyp_v1.data:co_access_type.standard} + TYPES ty_access_type TYPE c LENGTH 12. + + CONSTANTS: + "!

Access Type

+ "! Internal table access type + BEGIN OF co_access_type, + "!

Standard

+ "! Standard table (access by index or key) + standard TYPE ty_access_type VALUE 'standard', + "!

Sorted

+ "! Sorted table (access by key with binary search) + sorted TYPE ty_access_type VALUE 'sorted', + "!

Hashed

+ "! Hashed table (access by unique hash key only) + hashed TYPE ty_access_type VALUE 'hashed', + "!

Index

+ "! Any index table type (standard or sorted, determined at usage) + index TYPE ty_access_type VALUE 'index', + "!

Not Specified

+ "! Access type not specified (fully generic table type) + not_specified TYPE ty_access_type VALUE 'notSpecified', + END OF co_access_type. + + "!

Primary Key Definition

+ "! How the primary table key fields are determined + "! $values {@link zif_aff_ttyp_v1.data:co_prim_key_definition} + "! $default {@link zif_aff_ttyp_v1.data:co_prim_key_definition.row_type} + TYPES ty_prim_key_definition TYPE c LENGTH 14. + + CONSTANTS: + "!

Primary Key Definition

+ "! How the primary table key fields are determined + BEGIN OF co_prim_key_definition, + "!

Row Type (All Non-Reference Fields)

+ "! Key consists of all non-reference fields of the row type (classic default) + row_type TYPE ty_prim_key_definition VALUE 'rowType', + "!

Key Components

+ "! Key fields are listed explicitly in key components + key_components TYPE ty_prim_key_definition VALUE 'keyComponents', + "!

Standard (Empty Key)

+ "! Empty primary key; used for standard tables without explicit key definition + standard TYPE ty_prim_key_definition VALUE 'standard', + END OF co_prim_key_definition. + + "!

Key Uniqueness

+ "! Uniqueness of the primary table key + "! $values {@link zif_aff_ttyp_v1.data:co_key_kind} + "! $default {@link zif_aff_ttyp_v1.data:co_key_kind.not_specified} + TYPES ty_key_kind TYPE c LENGTH 12. + + CONSTANTS: + "!

Key Uniqueness

+ "! Uniqueness of the primary table key + BEGIN OF co_key_kind, + "!

Unique

+ "! Duplicate key values are not allowed + unique TYPE ty_key_kind VALUE 'unique', + "!

Non-Unique

+ "! Duplicate key values are allowed + non_unique TYPE ty_key_kind VALUE 'nonUnique', + "!

Not Specified

+ "! Uniqueness not specified + not_specified TYPE ty_key_kind VALUE 'notSpecified', + END OF co_key_kind. + + "!

Secondary Key Access

+ "! Access type of a secondary table key + "! $values {@link zif_aff_ttyp_v1.data:co_sec_key_access} + "! $default {@link zif_aff_ttyp_v1.data:co_sec_key_access.unique_hashed} + TYPES ty_sec_key_access TYPE c LENGTH 15. + + CONSTANTS: + "!

Secondary Key Access

+ "! Access type of a secondary table key + BEGIN OF co_sec_key_access, + "!

Unique Hashed

+ "! Secondary key is a unique hashed key + unique_hashed TYPE ty_sec_key_access VALUE 'uniqueHashed', + "!

Unique Sorted

+ "! Secondary key is a unique sorted key + unique_sorted TYPE ty_sec_key_access VALUE 'uniqueSorted', + "!

Non-Unique Sorted

+ "! Secondary key is a non-unique sorted key + non_unique_sorted TYPE ty_sec_key_access VALUE 'nonUniqueSorted', + END OF co_sec_key_access. + + "!

Secondary Key Definition

+ "! How secondary key fields are determined + "! $values {@link zif_aff_ttyp_v1.data:co_sec_key_definition} + "! $default {@link zif_aff_ttyp_v1.data:co_sec_key_definition.row_type} + TYPES ty_sec_key_definition TYPE c LENGTH 14. + + CONSTANTS: + "!

Secondary Key Definition

+ "! How secondary key fields are determined + BEGIN OF co_sec_key_definition, + "!

Row Type (All Fields)

+ "! All fields of the row type are secondary key fields + row_type TYPE ty_sec_key_definition VALUE 'rowType', + "!

Key Components

+ "! Key fields are listed explicitly in key components + key_components TYPE ty_sec_key_definition VALUE 'keyComponents', + END OF co_sec_key_definition. + + "!

Further Secondary Keys

+ "! Whether additional secondary keys beyond those defined are permitted + "! $values {@link zif_aff_ttyp_v1.data:co_sec_keys_allowed} + "! $default {@link zif_aff_ttyp_v1.data:co_sec_keys_allowed.not_allowed} + TYPES ty_sec_keys_allowed TYPE c LENGTH 12. + + CONSTANTS: + "!

Further Secondary Keys

+ "! Whether additional secondary keys are permitted at usage + BEGIN OF co_sec_keys_allowed, + "!

Not Allowed

+ "! No further secondary keys may be defined at usage + not_allowed TYPE ty_sec_keys_allowed VALUE 'notAllowed', + "!

Allowed

+ "! Further secondary keys may be defined at usage + allowed TYPE ty_sec_keys_allowed VALUE 'allowed', + END OF co_sec_keys_allowed. + + TYPES: + "!

Key Component

+ "! A single explicitly named key field + BEGIN OF ty_key_component, + "!

Name

+ "! Field name of the key component + "! $required + name TYPE zif_aff_types_v1=>ty_object_name_30, + END OF ty_key_component, + + "!

Key Components

+ "! Explicitly named key field components + ty_key_components TYPE STANDARD TABLE OF ty_key_component WITH DEFAULT KEY. + + TYPES: + "!

Built-In Type

+ "! Properties of a predefined ABAP built-in row type + BEGIN OF ty_built_in_type, + "!

Data Type

+ "! ABAP built-in data type name (e.g. CHAR, INT4, STRING) + "! $required + data_type TYPE c LENGTH 10, + "!

Length

+ "! Length of the built-in type (relevant for length-variable types such as CHAR, NUMC) + "! $minimum 0 + length TYPE i, + "!

Decimals

+ "! Number of decimal places (relevant for DEC, CURR, QUAN) + "! $minimum 0 + decimals TYPE i, + END OF ty_built_in_type. + + TYPES: + "!

Row Type

+ "! Definition of the table line type + BEGIN OF ty_row_type, + "!

Type Kind

+ "! How the row type is specified + "! $required + type_kind TYPE ty_row_type_kind, + "!

Type Name

+ "! Name of the referenced dictionary type, class, interface, or data element. + "! Relevant when typeKind is dictionaryType, refToDictionaryType, + "! refToClassOrInterfaceType, or rangeTypeOnDataelement. + type_name TYPE zif_aff_types_v1=>ty_object_name_30, + "!

Built-In Type

+ "! Details of the built-in ABAP type used as row type. + "! Relevant when typeKind is predefinedAbapType or refToPredefinedAbapType. + built_in_type TYPE ty_built_in_type, + "!

Range Type

+ "! Name of the predefined ABAP type for the RANGES row. + "! Relevant when typeKind is rangeTypeOnPredefinedType. + range_type TYPE c LENGTH 10, + END OF ty_row_type. + + TYPES: + "!

Initialization and Access

+ "! Initialization and access + BEGIN OF ty_init_and_access, + "!

Access Type

+ "! Internal table access type + access_type TYPE ty_access_type, + "!

Initial Row Count

+ "! Expected initial number of rows; used for memory pre-allocation + "! $minimum 0 + initial_row_count TYPE i, + END OF ty_init_and_access. + + TYPES: + "!

Secondary Key

+ "! Definition of a single secondary table key + BEGIN OF ty_secondary_key, + "!

Identifier

+ "! Name of the secondary key (up to 30 characters) + "! $required + identifier TYPE c LENGTH 30, + "!

Description

+ "! Short description of the secondary key + description TYPE zif_aff_types_v1=>ty_description_80, + "!

Access Type

+ "! Access type of the secondary key + access TYPE ty_sec_key_access, + "!

Key Definition

+ "! How the secondary key fields are determined + definition TYPE ty_sec_key_definition, + "!

Key Components

+ "! Explicitly named key fields; relevant when definition is keyComponents + components TYPE ty_key_components, + END OF ty_secondary_key, + + "!

Secondary Keys

+ "! List of secondary table keys + ty_secondary_keys TYPE STANDARD TABLE OF ty_secondary_key WITH DEFAULT KEY. + + TYPES: + "!

Primary Key

+ "! Primary key definition + BEGIN OF ty_primary_key, + "!

Key Definition

+ "! How the primary key fields are determined + definition TYPE ty_prim_key_definition, + "!

Key Uniqueness

+ "! Whether the primary key is unique or non-unique + kind TYPE ty_key_kind, + "!

Alias

+ "! Optional alias name for the primary key; + "! only relevant for sorted or hashed tables + alias TYPE c LENGTH 30, + "!

Key Components

+ "! Explicitly named key fields; relevant when definition is keyComponents + components TYPE ty_key_components, + END OF ty_primary_key. + + TYPES: + "!

Key Settings

+ "! Primary and secondary key definitions + BEGIN OF ty_key_settings, + "!

Primary Key

+ "! Primary key definition + primary_key TYPE ty_primary_key, + "!

Further Secondary Keys

+ "! Whether additional secondary keys beyond those listed may be defined at usage + sec_keys_allowed TYPE ty_sec_keys_allowed, + "!

Secondary Keys

+ "! Defined secondary keys + secondary_keys TYPE ty_secondary_keys, + END OF ty_key_settings. + + TYPES: + "!

Table Type

+ "! ABAP dictionary table type (TTYP) + BEGIN OF ty_main, + "!

Format Version

+ "! Format version + "! $required + format_version TYPE zif_aff_types_v1=>ty_format_version, + "!

Header

+ "! Header + "! $required + header TYPE zif_aff_types_v1=>ty_header_60_no_abap_lv, + "!

Row Type

+ "! Definition of the table line type + "! $required + row_type TYPE ty_row_type, + "!

Initialization and Access

+ "! Access type and initial fill size + init_and_access TYPE ty_init_and_access, + "!

Key Settings

+ "! Primary and secondary key definitions + key_settings TYPE ty_key_settings, + END OF ty_main. + +ENDINTERFACE. diff --git a/file-formats/ttyp/type/zif_aff_ttyp_v1.intf.json b/file-formats/ttyp/type/zif_aff_ttyp_v1.intf.json new file mode 100644 index 000000000..ce60e25e9 --- /dev/null +++ b/file-formats/ttyp/type/zif_aff_ttyp_v1.intf.json @@ -0,0 +1,7 @@ +{ + "formatVersion": "1", + "header": { + "description": "AFF type for table types", + "originalLanguage": "en" + } +}