Use complex type to define structured properties for the entity types or other complex types without exposing the complex type themselves as an independent OData entity. As complex type consist of a collection of properties without a unique key, they can only exist as properties of an containing entity or outside an entity as a temporary value.
Unlike entity type, complex type cannot form either end of an association between data objects, and therefore you cannot define navigation properties for complex types. However, complex types can contain other complex types, i.e. that they can have a deep structure. Within a complex type the cardinality is always 1:1.
Complex types comprise:
A unique name
A complex type structure called Fullname could comprise two properties, firstname and lastname.
To create a complex type in your Service Builder project, proceed as follows:
Right click the Data Model folder, and select Create, .
Create Complex Type dialog box opens.
Specify the Complex Type Name. The complex type displays in the mass maintenance view. Do the following in the mass maintenance view:
In the ABAP Structure Type Name column, you can enter the appropriate ABAP structure directly, or use the input help to search for an existing structure in the repository.
In the Base Type Name column, you can enter the relevant base type name directly or use the input help to display a list of node names and their descriptions. Base types (parents) inherit their properties to derived types (children). Inheritance between base types and derived types enables you to reuse existing complex types.
In Is Abstract column, select the check-box if the new complex type is of type abstract as opposed to concrete. If you set the type as abstract, your service implementation has to use a concrete derived type at runtime.
In the Label column, you can enter a label for the new complex type. You can enter a free-text label directly or use the Label Text Reference Editor to enter the reference type (program, data element, or class). The reference type you select influences the other input fields (that is, Object Name, Key, and Label) you can, and need to, edit.
You can create subsequent Complex Type when you right click the Complex Type folder, and select Create and follow the above procedure.
Alternatively, in the mass maintenance view of Complex Types, click Display/Edit then Insert Row.
To delete an existing complex type, select the complex type in the mass maintenance view and click Delete Row.
After you have created and saved your complex types in the Complex Types sub-folder, you can define the properties for each of these complex types.
For more information about editing properties in the Service Builder, see Defining Properties.