0% found this document useful (0 votes)
125 views

Cache Cleanup Through Programmatically

This interface provides methods for defining an OData model. It allows creation of entities, complex types, actions and associations. It also provides methods to include external OData models and control data conversions.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
125 views

Cache Cleanup Through Programmatically

This interface provides methods for defining an OData model. It allows creation of entities, complex types, actions and associations. It also provides methods to include external OData models and control data conversions.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 16

4/23/2017 /IWBEP/IF_MGW_ODATA_MODEL

/IWBEP/IF_MGW_ODATA_MODEL
Use

ThisinterfaceistheentrypointforeveryODataChannelmodeldefinitiontodefinetherequiredODataartifacts.

AgeHTTPHeader

ThedataprovidermaysetanageinthedataprovidermethodsforGET_ENTITY_TYPE/GET_ENTITY_SETwhichistranslatedintoan
HTTPresponseheaderwithoutfurthercalculation.

Methods

MethodCREATE_ACTION

Thismethodaddsanaction,serviceoperation,orfunctionimporttotheODatamodel.

Parameter Description

IV_ACTION_NAME Value

RO_ACTION Instance

MethodCREATE_TAG

https://help.sap.com/saphelp_nw74/helpdata/en/67/fb2651c294256ee10000000a445394/content.htm 1/16
4/23/2017 /IWBEP/IF_MGW_ODATA_MODEL

Thismethodcreatesaservicetag:anactionoranODatafunctionimport.Actionsareprepackagedchunksofbusinesslogicthatgo
beyondsimpleCRUDoperationsondataobjectinstances.
Table1:
Parameter Description

IV_ACTION_NAME Importingtheexternalnameoftheactionasitwillbeavailableinthe
servicedocument
RO_ACTION Returnsthecreatedaction

Formoreinformation,seeServiceTagging.

MethodGET_ACTION

ThismethodretrievesanactionfromaODatamodelbyname.

Parameter Description

IV_ACTION_NAME Value

RO_ACTION Instance

MethodGET_COMPLEX_TYPE

Thismethodgetsacomplextypebyname.

Parameter Description

IV_CPLX_TYPE_NAME Value

https://help.sap.com/saphelp_nw74/helpdata/en/67/fb2651c294256ee10000000a445394/content.htm 2/16
4/23/2017 /IWBEP/IF_MGW_ODATA_MODEL

Parameter Description

RO_COMPLEX_TYPE Instance

MethodCREATE_COMPLEX_TYPE

ThismethodaddsacomplextypetotheODatamodel.

Parameter Description

IV_CPLX_TYPE_NAME Value

RO_COMPLEX_TYPE Instance

MethodCREATE_ENTITY_TYPE

ThismethodaddsanEntityTypetotheODatamodel.

Parameter Description

IV_ENTITY_TYPE_NAME Value

RO_ENTITY Instance

MethodGET_ENTITY_TYPE

https://help.sap.com/saphelp_nw74/helpdata/en/67/fb2651c294256ee10000000a445394/content.htm 3/16
4/23/2017 /IWBEP/IF_MGW_ODATA_MODEL

ThismethodgetsanEntityTypebyname.

Parameter Description

IV_ENTITY_TYPE_NAME Value

RO_ENTITY Instance

MethodCREATE_ASSOCIATION

ThismethodaddsanassociationtothedatamodelwhichlinkstoEntityTypes.

Parameter Description

IV_ASSOCIATION_NAME Value

IV_LEFT_TYPE NameoftheleftEntityType.

IV_RIGHT_TYPE NameoftherightEntityType.

IV_LEFT_CARD AssociationcardinalityoftheleftEntityType.

IV_RIGHT_CARD AssociationcardinalityoftherightEntityType.

RO_ASSOCIATION Instance

https://help.sap.com/saphelp_nw74/helpdata/en/67/fb2651c294256ee10000000a445394/content.htm 4/16
4/23/2017 /IWBEP/IF_MGW_ODATA_MODEL

MethodGET_ASSOCIATION

Thismethodgetsanassociationofthedatamodel.

Parameter Description

IV_ASSOCIATION_NAME Value

RO_ASSOCIATION Instance

MethodSET_NO_CONVERSION

Thismethodcontrolswhetheranyconversionshouldbecalledforruntimerepresentationsofthisdatamodel.

Parameter Description

IV_NO_CONVERSION Flagtodecidewhetheranyconversionshouldbecalledduringruntime.

MethodGET_NO_CONVERSION

Thismethodindicateswhetherconversionsarecalledornot,duringruntime.

Parameter Description

RV_NO_CONVERSION Value

MethodINCLUDE_MODEL_BY_NAME
https://help.sap.com/saphelp_nw74/helpdata/en/67/fb2651c294256ee10000000a445394/content.htm 5/16
4/23/2017 /IWBEP/IF_MGW_ODATA_MODEL

ThismethodincludesadifferentdatamodelbynamefromanotherODataChannelserviceexposedonSAPGateway,thatis,IW_BEP
datamodels.TheAPIcanbeusedtocomposedatamodelsfromdifferentservices,thatis,toincludeanexternaldatamodel.The
compositionisdefinedinthesysteminwhichthesoftwarecomponentIW_BEPisinstalled.ThesoftwarecomponentIW_BEPcanbe
installedonanSAPBusinessSuitebackendsystemoronanSAPGatewayhubsystem.

Note
IfyoursystemisbasedonSAPNetWeaver7.4youdonotneedtoinstallcomponentIW_BEPsincetheSAPGatewayFoundation
componentSAP_GWFNDisinstalledasstandard.

TheserviceoftheexternaldatamodelmustberegisteredontheSAPGatewayhubsystemandbeupandrunning.

TheIDoftheserviceandthenameofthedatamodelhavetobeprovidedtothemethod.ThisinformationisstoredontheSAPGateway
hubandisresolvedduringruntimetocreate,forexample,themetadatadocumentandthebusinessdatafortherouting.Thismeansthat
forentitiesoftheexternaldatamodel,thesystemaliasassignedtotheserviceoftheexternaldatamodelisusedinsteadofthesystem
aliasassignedtotheoriginalserviceincludingthatdatamodel.

Duringactivation,theservicemaintenancefunctionusestheprovidedserviceIDsanddatamodelnamestofindacorrespondingservice.
Thereforetheincludedserviceshavetobeactivatedfirst,asotherwisetheactivationofthecompositionservicewillleadtoanincomplete
compositionserviceorevenanerror.

Itispossibletodefineassociationstotheentitiesoftheincludeddatamodel,althoughtheydonotexistatthistime.1:1and1:n
relationscanbedefinedpointingfromthenewdatamodeltotheincludedexternaldatamodel.

Whendefiningtheassociation,youdefinetheleftsideofit(fromthecurrentdatamodelexistinginIW_BEP)withthestandard
method/IWBEP/IF_MGW_ODATA_MODEL~CREATE_ASSOCIATION.
Itisnecessarytodefinereferentialconstraintsfortheseassociationsastheyareresolvedgenericallyduringruntimebythe
frameworkontheSAPGatewayhubsystem.

https://help.sap.com/saphelp_nw74/helpdata/en/67/fb2651c294256ee10000000a445394/content.htm 6/16
4/23/2017 /IWBEP/IF_MGW_ODATA_MODEL

DuringtheruntimebasedonthesereferentialconstraintsarequestlikeFlight(ID=100)/BookingsListedInHanamightbe
convertedeitherintoarequestBookingsListedInHana(ID=100)orBookingsListedInHana?$filter=IDeq100depending
onthereferentialconstraints.Ifthekeysofthetargetentityfiteithertothekeyofthesourceentityoraremappedappropriatelyinthe
referentialconstraintsthenthekeynotationisused,otherwisethefilterisfilled.Theresolutionbehaviourcanbeoverruledbyyourown
BAdIimplementation(seebelow).

Note
Itiscurrentlynotpossibletodefinenavigationpropertiesforentitiesofincludeddatamodels.

EnhancementSpot/IWFND/ES_MGW_MDL_COMPOSITIONcanbeusedtooverwritethelinkresolutionbehavior.

YoucanfindanexampleinmethodDEFINEofclass/IWBEP/CL_MGW_MED_EXT_COMP_MDL.

Parameter Description

IV_TECH_MODEL_NAME Technicalnameofmodel.

IV_MODEL_VERSION Technicalversionofmodel.

IV_EXT_SERVICE_NAME(Optional) ExternalnameoftheserviceasspecifiedintheBEPregistration(optional).

IV_SERVICE_VERSION(Optional) Technicalversionoftheservice(optional).

Details

https://help.sap.com/saphelp_nw74/helpdata/en/67/fb2651c294256ee10000000a445394/content.htm 7/16
4/23/2017 /IWBEP/IF_MGW_ODATA_MODEL

Foreveryassociation,anassociationsetisrequired.Thecreationoftheassociationsetisdoneautomaticallywhencallingmethod
/IWBEP/IF_MGW_ODATA_MODEL>CREATE_ASSOCIATION.

Incaseofmodelcomposition,thecreationoftheassociationsetisnotautomatically.Instead,dothefollowing:

DeactivatethedefaultingbysettingtheimportparameterIV_DEF_ASSOC_SETtoFALSEinmethod
/IWBEP/IF_MGW_ODATA_MODEL>CREATE_ASSOCIATION.
Createthecorrespondingassociationsetexplicitlybycalling/IWBEP/IF_MGW_ODATA_MODEL>CREATE_ASSOCIATION_SET

Caution
Themodelincludeisdonedynamically.Itdoesnotneedaregistrationofthedependingserviceormodelduringtheregistrationofthe
hostingservice.Changesaredirectlyreflectedafterthemetadatacacheisinvalidated.

MethodEXTEND_MODEL

ThismethodextendsanODCmodelusingthemodelname/modelversion(modelID).Thismethodoverwritesallexistingdefined
metadatabythemetadataoftheextendedmodel.Sousethismethodonlyonceandasthefirststatement:

Thismethodoverwritesallexistingdefinedmetadatabythemetadataoftheextendedmodel.Souseitasthefirststatementandonly
onceinthemodeldefinition.Multipleextensionsarenotsupported.Extend_Modelonlysupportsthemetadataextensionofamodel,
andhasnoimpactontheruntimebehavior.

Note
Inthemodeldefinition,multipleextensionsarenotsupported.TheExtend_Modelmethodonlysupportsthemetadataextensionofa
modelandhasnoimpactontheruntimebehavior.

https://help.sap.com/saphelp_nw74/helpdata/en/67/fb2651c294256ee10000000a445394/content.htm 8/16
4/23/2017 /IWBEP/IF_MGW_ODATA_MODEL

Parameter Description

IV_TECH_MODEL_NAME Technicalnameofmodel

IV_MODEL_VERSION Technicalversionofmodel

SET_MODEL_FEATURES
ThismethodsetsdifferentmodelfeaturesviaparameterIS_MODEL_FEATURES.Thefollowingmodelfeaturescanbesetatpresent:

use_cache_handshake_busi_req(activatesthecachehandshakeforbusinessrequests)
use_edm_mapping_sp10(usetheEDMmappingasdevelopedinsupportpackage10)
NotethatthedefaultisthepreviousEDMmapping.
use_long_label_for_property

Caution
ThismethodshouldbeplacedinthecodingatthebeginningoftheDEFINEmethodofyourmodelproviderclass(MPC)tomakesure
thatthemodelfeatureswillbevalidforallmodelartifacts.

CacheHandshakeforBusinessRequests

BysettingthismodelfeaturethecachehandshakeforODatabusinessrequestswillbeactivatedfortheservice.WithODatabusiness
requestsallread/create/update/deleterequestsaremeant,butnot$metadataorservicedocumentrequests.Thecachehandshakefor
businessrequestsmakessurethatanexceptionwillberaisedandtheresponsewillhavetheHTTPstatuscode503(serviceunavailable)
incaseanODatabusinessrequestwasexecutedandthemetadatacacheonyourhubsystemwasoutdated.Afterthiserrorhad

https://help.sap.com/saphelp_nw74/helpdata/en/67/fb2651c294256ee10000000a445394/content.htm 9/16
4/23/2017 /IWBEP/IF_MGW_ODATA_MODEL

occurred,themetadatacacheonyourhubsystemshouldbecleanedupautomaticallybythesystem.ThenextODatabusinessrequest
ofthisserviceshouldwork.Therefore,simplyexecutetheODatabusinessrequestagainthathasledtothiserror(orinfactanyother
ODatabusinessrequestofthisservice).Iftheautomaticcachecleanupdidnotwork,youneedtocleanupthemetadatacachemanually
onyourhubsystemforthecurrentmodel.

EDMMappinginSupportPackage10

UseEDMmappingfromsupportpackage10andnotethatthedefaultmodeisthepreviousEDMmapping.

UseLongLabelforProperty

LabelsforpropertiesbasedonABAPDictionaryelementswillbetakenasdefaultfromthelongdescriptionifthelongtextdoesnot
exceed20characters.

https://help.sap.com/saphelp_nw74/helpdata/en/67/fb2651c294256ee10000000a445394/content.htm 10/16
4/23/2017 /IWBEP/IF_MGW_ODATA_MODEL

CodeSyntax
Exampleforenablingthecachehandshakeforbusinessrequests

METHODdefine.

DATAls_model_featuresTYPE/iwbep/if_mgw_appl_types=>ty_s_model_features.

super>define().

ls_model_featuresuse_cache_handshake_busi_req=abap_true.

model>set_model_features(ls_model_features).

ENDMETHOD.

MethodSET_SERVICE_SCHEMA_VERSION

TheapplicationcanusethismethodtosettheSAPschemaversion,forexample<Schema
Namespace="com.sap.TEA.TestApplication"xml:lang="en"sap:schemaversion="0001"
xmlns="http://schemas.microsoft.com/ado/2008/09/edm">.

https://help.sap.com/saphelp_nw74/helpdata/en/67/fb2651c294256ee10000000a445394/content.htm 11/16
4/23/2017 /IWBEP/IF_MGW_ODATA_MODEL

Thiscanbeconsideredasubversionoftheserviceversion.Ifnotsetexplicitly,thedefaultschemaversionis0000.Thisisnotsupported
forservicecomposition.Thatis,incaseofservicecompositionthevalueisalways0000.
Table2:
Parameter Description

IV_SERVICE_SCHEMA_VERSION Schemaversion

MethodSET_SCHEMA_NAMESPACE
Anapplicationdevelopercanusethismethodtosettheschemanamespaceattributeforthemetadatadocument.

Table3:
Parameter Description

IV_NAMESPACE Namespace

Theschemanamespaceappearsinthemetadatadocumentasfollows:

https://help.sap.com/saphelp_nw74/helpdata/en/67/fb2651c294256ee10000000a445394/content.htm 12/16
4/23/2017 /IWBEP/IF_MGW_ODATA_MODEL

CodeSyntax
<SchemaNamespace="Tea_test_application_NS"xml:lang="en"..

<PropertyName="Location"Type="Tea_test_application_NS.CT_Location"Nullable="false"/>

<NavigationPropertyName="My_Team"Relationship="Tea_test_application_NS.Team_of_Employee"FromRole="FromRo

<AssociationName="Team_of_Employee"sap:contentversion="1>
<EndType="Tea_test_application_NS.Worker"Multiplicity="*"Role="FromRole_Team_of_Employee"/>
<EndType="Tea_test_application_NS.Team"Multiplicity="1"Role="ToRole_Team_of_Employee"/>

<EntityContainerName="Tea_test_application_NS_Entities"m:IsDefaultEntityContainer="true">

<ComplexTypeName="CT_Location">
<PropertyName="Country"Type="Edm.String"MaxLength="255"sap:text="Country"/>
<PropertyName="City"Type="Tea_test_application_NS.CT_City"Nullable="false"/>
<PropertyName="Complex_type_City"Type="Tea_test_application_NS.CT_City"Nullable="false"/>
</ComplexType>

MethodINCLUDE_MODEL_BY_SERVICE_ID

Note
Thismethodisobsoleteandshouldnotbeusedanymore.

ThismethodIncludesamodelfromanotherODataChannelServiceexposedontheSAPGatewaysystem,thatisbackendmodels.The
APIcanbeusedtocomposeObjectModelsfromdifferentservices,thatistoincludeanexternalmodel.Forexample,thecompositionis
definedinthebackendsystemsystem,butresolvedontheSAPGatewaysystem.

https://help.sap.com/saphelp_nw74/helpdata/en/67/fb2651c294256ee10000000a445394/content.htm 13/16
4/23/2017 /IWBEP/IF_MGW_ODATA_MODEL

Toattainthis,thefollowingconditionsshouldbemet:

TheserviceoftheexternalmodelmustexistontheSAPGatewaysystemandbeupandrunning.
TheIDoftheserviceandthenameofthemodelhavetobeprovidedtothemethod.ThisinformationisstoredontheSAPGateway
andresolvedduringruntimetocreatethemetadatadocumentandforthebusinessdatafortherouting.Thismeansthatforentities
oftheexternalmodelthesystemaliasassignedtotheserviceoftheexternalmodelisusedinsteadofthesystemaliasassignedto
theoriginalserviceincludingthatmodel.
DuringactivationtheRegistrationReportusestheprovidedserviceIDsandmodelnamestofindacorrespondingservice.
Thereforetheincludedservicesshouldbeactivatedfirst,otherwisetheactivationofthecompositionservicewillleadtoan
incompletecompositionserviceormighteventhrowerrors.

Itispossibletodefineassociationstotheentitiesoftheincludedmodel,eveniftheydonotexistatthattime.1:1and1:nrelationscan
bedefinedpointingfromthenewmodeltotheincludedexternalmodel.

Whendefiningtheassociationyoudefinetheleftsideofit(fromthecurrentmodelexistinginBEP)withthestandardmethod
/IWBEP/IF_MGW_ODATA_MODEL~create_association
Itisnecessarytodefinereferentialconstraintsfortheseassociationsastheyareresolvedgenericallyduringruntimebythe
frameworkontheSAPGateway.

DuringruntimebasedonthesereferentialconstraintsarequestlikeFlight(ID=100)/BookingsListedInHanaisconvertedintoa
requestBookingsListedInHana?$filter=IDeq'100totheHANAdataprovider.

Note
Currently,itisnotpossibletodefinenavigationpropertiesforentitiesofincludedmodels.Infuture,anexituser(BADI)isplannedto
overwritethelinkresolution(andpossiblyalsothedispatching)behavior.

https://help.sap.com/saphelp_nw74/helpdata/en/67/fb2651c294256ee10000000a445394/content.htm 14/16
4/23/2017 /IWBEP/IF_MGW_ODATA_MODEL

Example
MethodDEFINEofclass/IWBEP/CL_MGW_MED_EXT_COMP_MDL

Details

Foreveryassociationanassociationsetisrequired.Thecreationoftheassociationsetisdoneautomaticallywhencallingthemethod:

/IWBEP/IF_MGW_ODATA_MODEL>CREATE_ASSOCIATION

Incaseofmodelcomposition,thecreationoftheassociationsetisnotautomatic.Instead,dothefollowing:

DeactivatethedefaultingbysettingtheimportparameterIV_DEF_ASSOC_SETtoFALSEinmethod
/IWBEP/IF_MGW_ODATA_MODEL>CREATE_ASSOCIATION.
Createthecorrespondingassociationsetexplicitlybycalling/IWBEP/IF_MGW_ODATA_MODEL>CREATE_ASSOCIATION_SET

Note
ThecompositionmusthavebeendoneBEFOREtheserviceiscreatedontheSAPGatewaysystemviatransaction
/IWFND/MAINT_SERVICE.

MethodINCLUDE_MODEL_BY_MAPPING_ID

Note
Thismethodisobsoleteandshouldnotbeusedanymore.

ThismethodincludesamodelfromgenericSAPGatewayIntegrationServiceexposedontheSAPGateway,forexample,.HANAorBW
services.TheAPIcanbeusedtocomposeObjectModelsfromdifferentservices,thatistoincludeanexternalmodel.Forexample,the
compositionisdefinedinthebackendsystem,butresolvedontheSAPGatewaysystem.
https://help.sap.com/saphelp_nw74/helpdata/en/67/fb2651c294256ee10000000a445394/content.htm 15/16
4/23/2017 /IWBEP/IF_MGW_ODATA_MODEL

Toattainthis,thefollowingconditionsshouldbemet:

TheserviceoftheexternalmodelmustexistontheSAPGatewaysystemandbeupandrunning.
TheExternalMappingIDoftheserviceasdisplayedontheSAPGatewayhastobeprovidedtothemethodinterface.This
informationisstoredontheSAPGatewayandresolvedduringruntimetocreateforexample,themetadatadocumentandforthe
businessdatafortherouting.Thismeansthatforentitiesoftheexternalmodel,thesystemaliasassignedtotheserviceofthe
externalmodelisusedinsteadofthesystemaliasassignedtotheoriginalserviceincludingthatmodel.
DuringactivationtheRegistrationReportusestheExternalMappingIDtofindacorrespondingservice.Thereforetheincluded
servicesshouldbeactivatedfirst,otherwisetheactivationofthecompositionservicewillleadtoanincompletecompositionservice
ormighteventhrowerrors.

Itispossibletodefineassociationstotheentitiesoftheincludedmodel,althoughtheydonotexistatthistime.1:1and1:nrelationscan
bedefinedpointingfromthenewmodeltotheincludedexternalmodel.

Whendefiningtheassociationyoudefinetheleftsideofit(fromthecurrentmodelexistinginBEP)withthestandardmethod
/IWBEP/IF_MGW_ODATA_MODEL~create_association
Itisnecessarytodefinereferentialconstraintsfortheseassociationsastheyareresolvedgenericallyduringruntimebythe
frameworkontheSAPGateway.

Duringruntimebasedonthesereferentialconstraints,arequestlikeFlight(ID=100)/BookingsListedInHanaisconvertedintoa
requestBookingsListedInHana?$filter=IDeq'100totheHANAdataprovider.

Inthefuture,anexituser(BADI)isplannedtooverwritethelinkresolution(andpossiblyalsothedispatching)behavior.

Example
MethodDEFINEofclass/IWBEP/CL_MGW_MED_BW_COMP_MDL

https://help.sap.com/saphelp_nw74/helpdata/en/67/fb2651c294256ee10000000a445394/content.htm 16/16

You might also like