Show TOC

Creating Complex TypesLocate this document in the navigation structure

Use

Complex types consist of a list of properties with no key, and can therefore only exist as properties of a containing entity or as a temporary value. You can use complex types to group fields together without exposing them as an independent OData entity. Complex types can contain complex types, that is, they can be deep. Within a complex type the cardinality is always 1:1.

You create a complex type structure and properties within it as described below. For example, you could create a complex type structure called Fullname comprising two properties, firstname and lastname. Since a complex type is a specific type of data object that needs to be created as such, the Create Data Object dialog box is displayed.

Procedure
  1. Right-click the Complex types folder and select Create Complex Type.

  2. In the dialog box, enter the name of the complex type structure. Alternatively, you can copy an existing DDIC structure in the ABAP Dictionary by selecting the Create From DDIC checkbox and entering the required DDIC Structure Name and SAP System Alias:

    Create complex type

    A message displays at the bottom of the screen, confirming that the new complex type has been created. It displays in the tree view under the Complex types folder.

  3. The Properties Editor opens for you to define the new complex type (see Creating Data Objects for details). There are no mandatory fields. If you created the model from a DDIC structure, values from the DDIC structure display in the appropriate Properties Editor fields.

  4. When you have finished entering values in the Properties Editor fields, save your entries.

  5. Create the complex type properties within the structure by right-clicking the complex type (Data Object) you have just created and selecting Start of the navigation path Create Next navigation step Property End of the navigation path. Ensure you select the Complex Type button when defining the Properties Editor fields. See Creating Properties for details.

When you have created and saved a complex type property, it displays under the complex type structure that you created in the tree view, with a different icon in front of its name to identify it as a complex type property:

For more information about how to set a filter for a field, see http://www.odata.org/developers/protocols/uri-conventions#FilterSystemQueryOptionInformation published on non-SAP site.