To use the Define Complex Type code pattern, proceed as follows:
Start ABAP Workbench in transaction SE80.
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.
Choose the Edit button. After you have switched to editing mode, the Pattern push button in the application too lbar is active.
Place your cursor at the position in the source code where you want to insert the generated code pattern for complex types.
Choose the Pattern push button. The Ins. statement dialog box is displayed.
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.
In the dialog box ODC Code Pattern Selection Screen, select the radio button Define Complex Type under Metadata Definition.
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.
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.