Type attributes
Types can be defined with meta-data information.
Syntax
In type specifications, the attributes-list clause is:
{ ATTRIBUTE | ATTRIBUTES } ( attribute [ = "value" ] [,...] )- attribute is the name of a definition attribute.
- value is the value for the definition attribute, it is optional for boolean attributes.
Basics
Types can be defined with the ATTRIBUTES() clause, to specify meta-data
information for the elements used in the type.
To specify metadata information when defining a type, use the
ATTRIBUTES in the
type specification used to defined the
TYPE:TYPE t_item_id INTEGER ATTRIBUTES(json_name="Item Id")Type attributes can be specified on primitive types like INTEGER, and on complex
structures like records, records, arrays, dictionaries.
When defining attributes for complex types, the
ATTRIBUTES clause must be
specified right after the complex type
keywords:TYPE t_uuids DYNAMIC ARRAY ATTRIBUTES(json_name="uuid-list") OF STRING
TYPE t_customer RECORD ATTRIBUTES(json_name = "customer-record")
...
END RECORDJSON serialization attributes
To define JSON serialization options, use variable definition attributes such as
json_null and json_name:TYPE t_rec RECORD
cust_id INTEGER ATTRIBUTES(json_null="null"),
cust_name INTEGER ATTRIBUTES(json_name="Customer Name"),
...
orderlist DYNAMIC ARRAY ATTRIBUTES(json_null="undefined") OF RECORD
...
END RECORD,
...
END RECORDList of supported JSON attributes for variable definitions:
json_null(values can be"null"or"undefined")json_name
For more details about JSON serialization attributes see BDL names and JSON element names.
XML serialization attributes
Type attributes are also used when defining variables for XML-based Web Services:
TYPE t_data RECORD
val1 INTEGER ATTRIBUTES(XMLName="Value1"),
val2 STRING ATTRIBUTES(XMLName="Value2"),
attr INTEGER ATTRIBUTES(XMLAttribute,XMLName="MyAttr")
END RECORDFor more details about XML attributes, see Attributes to customize XML serialization.