Skip to content

ABAP Keyword Documentation →  ABAP - Reference →  Data Interfaces and Communication Interfaces →  ABAP and XML →  Simple Transformations →  ST - Structure of ST Programs 

ST - tt:type, tt:front, tt:node, type definitions

Other versions: 7.31 | 7.40 | 7.54

Syntax


<tt:type name="..." [[line-]type="..." [length="..."] [decimals="..."]] 
  [extensible=extensible_flag]>
  [<tt:front>
     <tt:node name="..." [[line-]type="..." [...]]
       [extensible=extensible_flag]>
       [...]
     </tt:node>
     ...
   </tt:front>]
  [<tt:node name="..." [[line-]type="..." [...]]
     [extensible=extensible_flag]>
     [...]
   </tt:node>
  ...]
</tt:type>

Effect

The data roots used in an ST program can be assigned type specifications (optional). As a rule, types from the Repository (ABAP Dictionary, types of global classes) are used, although you can make your own type definitions in the ST program. An ST program outside of a template can contain one or more definitions of types with statement tt:type. The attribute name declares a symbolic name with which the defined type for typing data roots can be used. This symbolic name can also be used in other type definitions.

You can define elementary, structured, and tabular types, which can be partially or completely generic. Moreover, references to globally defined data types of the Repository and to types of the same ST program (defined using tt:type) are possible. You cannot define your own reference types, but you can create them by using references to reference types from the ABAP Repository.

Namespaces

The following XML namespaces in asXML format have to be used to specify types from the Repository and the same ST program:

  • http://www.sap.com/abapxml/types/dictionary describes the ABAP Dictionary.
  • http://www.sap.com/abapxml/types/type-pool/name describes the type group name.
  • http://www.sap.com/abapxml/types/class-pool/class describes the global class class.
  • http://www.sap.com/abapxml/types/defined/name describes the type that is defined in the current ST program using tt:type.

The type name that is specified in [line-]type then has to have the form p:NAME, where the namespace prefix p has to be bound to one of these URIs and NAME is the name of the actual type in uppercase letters. p therefore specifies where the type is defined.

Definition of Elementary Types

Definition of elementary types: The elementary ABAP types C, D, F, I, N, P, STRING, T, X or XSTRING (uppercase) are specified for the attribute value type after tt:type or tt:node.

For types C, N, P, and X, the length can also be specified in attribute length, and for type P the number of decimal places can be specified in attribute decimals. If decimals is specified without length, then decimals has no effect. If length or decimals are not specified, then length and decimal places are generic.

C without a length specification corresponds to the generic ABAP type csequence, that is, it includes c with any length and string. Similarly, xsequence applies to X.

The name of an elementary type from the Repository or the ST program can also be specified for the value of attribute type.

Definition of Structured Types

The statement tt:node, as an element of tt:type, is used to define structured types. Here the name of a component is determined by the value of attribute name and its type is determined using the value of attribute [line-]type. Statement tt:node, which is an element of a different statement tt:node, defines a substructure. Element tt:type or tt:node, which contains subelements tt:node, must not contain any type specifications except [line-]type="?". In this case, line-type="?" is used to define a tabular type with a structured line type.

You can use the type specification [line-]type after tt:node to structure the types of a component as elementary (see above), as tabular (see below), or as using a reference to a structured type of the Repository or the ST program itself.

The type of a component can be partly or completely generic. In addition, a structured type is generic by default in terms of the number and order of its components. This means that a data root that is typed with a structured type can be bound to an ABAP structure that contains the specified components in a different sequence and/or additional components.

To write the number and sequence of the components of the initial part of a structured type or the whole structured type permanently and without gaps, the corresponding component definitions tt:node can be listed as subelements of statement tt:front. Statement tt:type or tt:node may have exactly one tt:front statement as the first subelement.

To restrict the number of components in a structure to the components that are defined in the ST program, you can use the extensible attribute of statements tt:type or tt:node. The following values can be specified for the attribute:

... "on"|"deep"|"off"|"deep-off" ...

The value "on" states that the current element may have direct subelements that are not explicitly specified. The value "deep" states that the current element and its subelements are extensible. This is the standard setting. The value "off" deactivates extensibility for the current element but not its subelements. In other words, direct subelements cannot be added to the element but (specified) subelements can be. The value "deep-off" deactivates extensibility for the current element and its subelements. These settings can be overwritten locally in individual subelements.

Definition of Tabular Types

The attribute line-type (after tt:type or tt:node) is used for the definition of tabular types. This attribute defines the type or the component as a table with the line type that is specified as the attribute#s value.

Elementary types (see above) or any Repository or ST program types can be specified as the line type. A structured line type can also be declared by specifying "?" as the value of line-type. If the current element then contains tt:node statements as subelements, these define the components of the line type.

The line type of a tabular type can be partly or completely generic. The latter is defined by making the type specification line-type="?" without defining components using tt:node.

Definition of Reference Types

There is currently no ref-type addition available in tt:types for the definition of reference types. You can create an independent reference type only by using a reference to a reference type in the ABAP Repository. tt:parameter and tt:variable, however, do have a ref-type addition.

Definition of Generic Types

All types whose properties have not been fully defined are generic in terms of the missing properties.

  • A type is completely generic if the attribute type is either not specified at all, or is specified with the value "?". type="?" is the same as not specifying anything. However, it should always be specified to make the program easier to understand. line-type="?" is also required to define a tabular type directly with a structured line type.
  • An elementary type N or P is partly generic if the length is not specified, or if decimal places are not specified for P.
  • Individual components can be generic in structured types; the number of components is also generic.
  • Tabular types can be partly or completely generic in terms of the line type.


Example

The type T1 that is defined below is a structure containing at least component C, which is an internal table whose line type contains at least components C1 (with Dictionary type DDT1) and C2 (with defined type T2). Structure type T2 contains component D whose subcomponent D1 is an internal table with any line type.

<tt:transform
  xmlns:tt="http://www.sap.com/transformation-templates"
  xmlns:ddic="http://www.sap.com/abapxml/types/dictionary"
  xmlns:def="http://www.sap.com/abapxml/types/defined" >
  <tt:type name="T1">
    <tt:node name="C" line-type="?">
      <tt:node name="C1" type="ddic:DDT1"/>
       <tt:node name="C2" line-type="def:T2"/>
    </tt:node>
  </tt:type>
  <tt:type name="T2">
    <tt:node name="D">
      <tt:node name="D1" line-type="?"/>
    </tt:node>
  </tt:type>