Show TOC

/IWBEP/IF_MGW_ODATA_MODELLocate this document in the navigation structure

Use

This interface is the entry point for every OData Channel model definition to define the required OData artifacts.

Methods

Method CREATE_ACTION

This method adds an action, service operation, or function import to the OData model.

Parameter

Description

IV_ACTION_NAME

Value

RO_ACTION

Instance

Method CREATE_TAG
This method creates a service tag: an action or an OData function import. Actions are pre-packaged chunks of business logic that go beyond simple CRUD operations on data object instances.
Table 1:
Parameter Description
IV_ACTION_NAME Importing the external name of the action as it will be available in the service document
RO_ACTION Returns the created action

For more information, see Service Tagging.

Method GET_ACTION

This method retrieves an action from a OData model by name.

Parameter

Description

IV_ACTION_NAME

Value

RO_ACTION

Instance

Method GET_COMPLEX_TYPE

This method gets a complex type by name.

Parameter

Description

IV_CPLX_TYPE_NAME

Value

RO_COMPLEX_TYPE

Instance

Method CREATE_COMPLEX_TYPE

This method adds a complex type to the OData model.

Parameter

Description

IV_CPLX_TYPE_NAME

Value

RO_COMPLEX_TYPE

Instance

Method CREATE_ENTITY_TYPE

This method adds an EntityType to the OData model.

Parameter

Description

IV_ENTITY_TYPE_NAME

Value

RO_ENTITY

Instance

Method GET_ENTITY_TYPE

This method gets an EntityType by name.

Parameter

Description

IV_ENTITY_TYPE_NAME

Value

RO_ENTITY

Instance

Method CREATE_ASSOCIATION

This method adds an association to the data model which links to EntityTypes.

Parameter

Description

IV_ASSOCIATION_NAME

Value

IV_LEFT_TYPE

Name of the left EntityType.

IV_RIGHT_TYPE

Name of the right EntityType.

IV_LEFT_CARD

Association cardinality of the left EntityType.

IV_RIGHT_CARD

Association cardinality of the right EntityType.

RO_ASSOCIATION

Instance

Method GET_ASSOCIATION

This method gets an association of the data model.

Parameter

Description

IV_ASSOCIATION_NAME

Value

RO_ASSOCIATION

Instance

Method SET_NO_CONVERSION

This method controls whether any conversion should be called for runtime representations of this data model.

Parameter

Description

IV_NO_CONVERSION

Flag to decide whether any conversion should be called during runtime.

Method GET_NO_CONVERSION

This method indicates whether conversions are called or not, during runtime.

Parameter

Description

RV_NO_CONVERSION

Value

Method INCLUDE_MODEL_BY_NAME

This method includes a data model from another OData Channel service exposed on the SAP NetWeaver Gateway, that is, IW_BEP data models. The API can be used to compose data models from different services, that is, to include an external data model. The composition is defined in the system in which the software component IW_BEP is installed. The software component IW_BEP can be installed on an SAP Business Suite backend system or on an SAP NetWeaver Gateway hub system.
Note If your system is based on SAP NetWeaver 7.4 you do not need to install component IW_BEP since the SAP NetWeaver Gateway Foundation component SAP_GWFND is installed as standard.

The service of the external data model must exist on the SAP NetWeaver Gateway hub system and be up and running.

The ID of the service and the name of the data model have to be provided to the method. This information is stored on the SAP NetWeaver Gateway hub and is resolved during runtime to create, for example, the metadata document and the business data for the routing. This means that for entities of the external data model, the system alias assigned to the service of the external data model is used instead of the system alias assigned to the original service including that data model.

During activation, the service maintenance function uses the provided service IDs and data model names to find a corresponding service. Therefore the included services have to be activated first, as otherwise the activation of the composition service will lead to an incomplete composition service or even an error.

It is possible to define associations to the entities of the included data model, although they do not exist at this time. 1:1 and 1:n relations can be defined pointing from the new data model to the included external data model.

  • When defining the association, you define the left side of it (from the current data model existing in IW_BEP) with the standard method /IWBEP/IF_MGW_ODATA_MODEL~CREATE_ASSOCIATION.

  • It is necessary to define referential constraints for these associations as they are resolved generically during runtime by the framework on the SAP NetWeaver Gateway hub system.

During the runtime based on these referential constraints a request like Flight(ID=100)/BookingsListedInHana is converted into a request BookingsListedInHana?$filter=ID eq '100' to the HANA data provider.

Note

It is currently not possible to define navigation properties for entities of included data models.

Enhancement Spot /IWFND/ES_MGW_MDL_COMPOSITION can be used to overwrite the link resolution behavior.

You can find an example in method DEFINE of class /IWBEP/CL_MGW_MED_EXT_COMP_MDL.

Parameter

Description

IV_TECH_MODEL_NAME

Technical name of model.

IV_MODEL_VERSION

Technical version of model.

IV_EXT_SERVICE_NAME (Optional)

The External name of the service as specified in the BEP-registration.

IV_SERVICE_VERSION (Optional)

Technical version of the service.

Details

For every association, an association set is required. The creation of the association set is done automatically when calling the method:

  • /IWBEP/IF_MGW_ODATA_MODEL->CREATE_ASSOCIATION

In case of model composition, the creation of the association set is not automatic. Instead do the following:

  • Deactivate the defaulting by setting the import parameter IV_DEF_ASSOC_SET to FALSE in method /IWBEP/IF_MGW_ODATA_MODEL->CREATE_ASSOCIATION.

  • Create the corresponding association set explicitly by calling /IWBEP/IF_MGW_ODATA_MODEL->CREATE_ASSOCIATION_SET

Caution

The model include is done dynamically. It does not need a registration of the depending service or model during the registration of the hosting service. Changes are directly reflected after the metadata cache is invalidated.

Method EXTEND_MODEL

This method extends a Gateway ODC Model using the Model Name / Model Version (Model ID). This method overwrites all existing defined metadata by the metadata of the extended model. So use this method only once and as the first statement:

This method overwrites all existing defined metadata by the metadata of the extended model. So use it as the first statement and only once in the model definition. Multiple extensions are not supported. Extend_Model only supports the metadata extension of a model, and has no impact on the run time behavior.

Note

In the model definition, multiple extensions are not supported. The Extend_Model method only supports the metadata extension of a model and has no impact on the runtime behavior.

Parameter

Description

IV_TECH_MODEL_NAME

Technical name of model

I V_MODEL_VERSION

Technical version of model

Method SET_SERVICE_SCHEMA_VERSION
This can be considered a sub-version of the service version. If not set explicitly, the default schema version is 0000. This is not supported for service composition. That is, in case of service composition the value is always 0000.
Table 2:
Parameter Description
IV_SERVICE_SCHEMA_VERSION Schema version
Method SET_SCHEMA_NAMESPACE
An application developer can use this method to set the schema namespace attribute for the metadata document.
Table 3:
Parameter Description
IV_NAMESPACE Namespace

The schema namespace appears in the metadata document as follows:

Schema Namespace="Tea_test_application_NS" xml:lang="en".. <Property Name="Location" Type="Tea_test_application_NS.CT_Location" Nullable="false" /><NavigationProperty Name="My_Team" Relationship="Tea_test_application_NS.Team_of_Employee" FromRole="FromRole_Team_of_Employee" ToRole="ToRole_Team_of_Employee" /><Association Name="Team_of_Employee" sap:content-version="1"> 
<End Type="Tea_test_application_NS.Worker" Multiplicity="*" Role="FromRole_Team_of_Employee" />
<End Type="Tea_test_application_NS.Team" Multiplicity="1" Role="ToRole_Team_of_Employee" /><EntityContainer Name="Tea_test_application_NS_Entities" m:IsDefaultEntityContainer="true"><ComplexType Name="CT_Location">
<Property Name="Country" Type="Edm.String" MaxLength="255" sap:text="Country" />
<Property Name="City" Type="Tea_test_application_NS.CT_City" Nullable="false" />
<Property Name="Complex_type_City" Type="Tea_test_application_NS.CT_City" Nullable="false" />
</ComplexType>
Method INCLUDE_MODEL_BY_SERVICE_ID
Note This method is obsolete and should not be used any more.

This method Includes a model from another OData Channel Service exposed on the SAP NetWeaver Gateway system, that is backend models. The API can be used to compose Object Models from different services, that is to include an external model. For example, the composition is defined in the backend system system, but resolved on the SAP NetWeaver Gateway system.

To attain this, the following conditions should be met:

  • The service of the external model must exist on the SAP NetWeaver Gateway system and be up and running.

  • The ID of the service and the name of the model have to be provided to the method. This information is stored on the Gateway and resolved during runtime to create the metadata document and for the business data for the routing. This means that for entities of the external model the system alias assigned to the service of the external model is used instead of the system alias assigned to the original service including that model.

  • During activation the Registration Report uses the provided service IDs and model names to find a corresponding service. Therefore the included services should be activated first, otherwise the activation of the composition service will lead to an incomplete composition service or might even throw errors.

It is possible to define associations to the entities of the included model, even if they do not exist at that time. 1:1 and 1:n relations can be defined pointing from the new model to the included external model.

  • When defining the association you define the left side of it (from the current model existing in BEP) with the standard method /IWBEP/IF_MGW_ODATA_MODEL~create_association

  • It is necessary to define referential constraints for these associations as they are resolved generically during runtime by the framework on the Gateway.

During runtime based on these referential constraints a request like Flight(ID=100)/BookingsListedInHana is converted into a request BookingsListedInHana?$filter=ID eq '100 to the HANA data provider.

Note

Currently, it is not possible to define navigation properties for entities of included models. In future, an exit user (BADI) is planned to overwrite the link resolution (and possibly also the dispatching) behavior.

Example

Method DEFINE of class /IWBEP/CL_MGW_MED_EXT_COMP_MDL

Details

For every association an association set is required. The creation of the association set is done automatically when calling the method:

  • /IWBEP/IF_MGW_ODATA_MODEL->CREATE_ASSOCIATION

In case of model composition, the creation of the association set is not automatic. Instead, do the following:

  • Deactivate the defaulting by setting the import parameter IV_DEF_ASSOC_SET to FALSE in method /IWBEP/IF_MGW_ODATA_MODEL->CREATE_ASSOCIATION.

  • Create the corresponding association set explicitly by calling /IWBEP/IF_MGW_ODATA_MODEL->CREATE_ASSOCIATION_SET

Note

The composition must have been done BEFORE the service is created on the SAP NetWeaver Gateway system via transaction /IWFND/MAINT_SERVICE.

Method INCLUDE_MODEL_BY_MAPPING_ID
Note This method is obsolete and should not be used any more.

This method includes a model from generic Gateway Integration Service exposed on the Gateway, for example, . HANA or BW services. The API can be used to compose Object Models from different services, that is to include an external model. For example, the composition is defined in the backend system, but resolved on the Gateway system.

To attain this, the following conditions should be met:

  • The service of the external model must exist on the SAP NetWeaver Gateway system and be up and running.

  • The External Mapping ID of the service as displayed on the Gateway has to be provided to the method interface. This information is stored on the Gateway and resolved during runtime to create for example, the metadata document and for the business data for the routing. This means that for entities of the external model, the system alias assigned to the service of the external model is used instead of the system alias assigned to the original service including that model.

  • During activation the Registration Report uses the External Mapping ID to find a corresponding service. Therefore the included services should be activated first, otherwise the activation of the composition service will lead to an incomplete composition service or might even throw errors.

It is possible to define associations to the entities of the included model, although they do not exist at this time. 1:1 and 1:n relations can be defined pointing from the new model to the included external model.

  • When defining the association you define the left side of it (from the current model existing in BEP) with the standard method /IWBEP/IF_MGW_ODATA_MODEL~create_association

  • It is necessary to define referential constraints for these associations as they are resolved generically during runtime by the framework on the Gateway.

During runtime based on these referential constraints, a request like Flight(ID=100)/BookingsListedInHana is converted into a request BookingsListedInHana?$filter=ID eq '100 to the HANA data provider.

In the future, an exit user (BADI) is planned to overwrite the link resolution (and possibly also the dispatching) behavior.

Example

Method DEFINE of class / IWBEP/CL_MGW_MED_BW_COMP_MDL