Show TOC

Defining Complex TypeLocate this document in the navigation structure

Procedure

To use the Define Complex Type code pattern, proceed as follows:

  1. Start ABAP Workbench in transaction SE80.

  2. Navigate to your model provider class and open the DEFINE method

    in which you want to insert the source code generated by the code pattern.

  3. Choose the Edit button. After you have switched to editing mode, the Pattern push button in the application too lbar is active.

  4. Place your cursor at the position in the source code where you want to insert the generated code pattern for complex types.

  5. Choose the Pattern push button. The Ins. statement dialog box is displayed.

  6. Select the Other Pattern radio button and enter the technical name of the OData Channel pattern in the corresponding input field /IWBEP/FM_MGW_PAT. Input help is available for this field.

  7. Choose Continue.

  8. In the dialog box ODC Code Pattern Selection Screen, select the radio button Define Complex Type under Metadata Definition.

  9. Choose Continue.

After you have selected the Define Complex Type code pattern and specified where you want to insert the generated source code in the DEFINE method of your model provider class, you need to configure the code pattern in the Local Entity Type Pattern dialog box. To configure the code pattern, proceed as explained for the Define Entity Type code pattern.

Use

You can use the Define Complex Type code pattern similarly to the Define Entity Type code pattern, but be aware of the following differences:

  • You cannot define fields with usage type Key.

  • The generated source code defines a complex type for top-level fields in the structure.

The Define Complex Type code pattern supports ABAP Dictionary types in addition to global class and interface types adhering to the ABAP syntax.

More Information

Refer Defining Entity Type, Defining Association and Defining Composition for more options in Metadata Definition Code Patterns.