3Step-By-step Guide to Build an OData Service Ba..
-
Upload
kannan-selvam -
Category
Documents
-
view
9 -
download
7
description
Transcript of 3Step-By-step Guide to Build an OData Service Ba..
-
16/04/2015 StepbystepguidetobuildanODataServiceba...|SCN
http://scn.sap.com/people/volker.drees/blog/2012/10/26/stepbystepguidetobuildanodataservicebasedonrfcspart3 1/7
GettingStarted Newsletters Store
Products Services&Support AboutSCN Downloads
Industries Training&Education Partnership DeveloperCenter
LinesofBusiness UniversityAlliances Events&Webinars Innovation
LogOn JoinUsHi,Guest SearchtheCommunity
Activity Communications Actions
Browse
volker.drees
0 Tweet 1
Thanksforstickingtothismultipartstepbystepguide.
Lookingintothispart(3)meansthatyouhavesuccessfullycompletedthe firstpart(1)andthe secondpart(2)andyouarenowcurioustoseehowourEPMODataServicewillbeextendedwithanAssociationandaNavigationProperty.Thiswillallowus tonavigate from theSalesOrder to the relatedSalesOrderLine Itemsbyusinga linkinsteadofmanuallyputtingafiltertogether.Furthermorethisalsoallowsustousethe$expandstatementtofetchtheSalesOrdertogetherwithallSalesOrderLineItemsinonehttpcall.
WearestillintheServiceBuilderandenhancingourprojectthatwecreatedinpart1andextendedinpart2.
1.DoubleclickAssociations:
2.ChoosetheCreatepushbutton:
3.EnterthefollowingvaluesfortheAssociationandchooseEnter:Name SalesOrderSalesOrderItems
PrincipalEntity* SalesOrder
PrincipalEntityCardinality* 1
DependentEntity* SalesOrderItem
DependentEntityCardinality* M
*)ThisfieldhasaninputhelpNowwewillCreateareferentialconstraintfortheassociation
1.ExpandtheAssociationsnodeandtheSalesOrderSalesOrderItemsnodeanddoubleclickReferentialConstraints:
StepbystepguidetobuildanODataServicebasedonRFCsPart3PostedbyVolkerDreesinvolker.dreeson26Oct201211:45:07
Share
-
16/04/2015 StepbystepguidetobuildanODataServiceba...|SCN
http://scn.sap.com/people/volker.drees/blog/2012/10/26/stepbystepguidetobuildanodataservicebasedonrfcspart3 2/7
2.ChoosetheCreatepushbutton:
3.EnterthefollowingvaluesandchooseEnter:PrincipalKey* SoId
DependentProperty* SoId
*)Thisfieldhasaninputhelp
Nowwecreateanassociationsetfortheassociation
1.DoubleclickAssociationSets:
2.ChoosetheCreatepushbutton:
3.EnterthevaluesandchooseEnter:
-
16/04/2015 StepbystepguidetobuildanODataServiceba...|SCN
http://scn.sap.com/people/volker.drees/blog/2012/10/26/stepbystepguidetobuildanodataservicebasedonrfcspart3 3/7
Name SalesOrderSalesOrderItems
Association* SalesOrderSalesOrderItems
*)Thisfieldhasaninputhelp
Andfinallywecreateanavigationpropertybasedonthereferentialconstraint
1.ExpandDataModel>EntityTypes>SalesOrderanddoubleclickNavigationProperties:
2.ChoosetheCreatepushbutton:
3.EnterthefollowingvaluesandchooseEnter:Name SalesOrderItems
RelationshipName* SalesOrderSalesOrderItems
*)ThisfieldhasaninputhelpNowweneedtoregeneratetheruntimeobjectsandwerethenreadytotesttheservice
1.ChoosetheGeneratepushbutton:
2.Verifythattheruntimeobjectshavebeengeneratedsuccessfully:
-
16/04/2015 StepbystepguidetobuildanODataServiceba...|SCN
http://scn.sap.com/people/volker.drees/blog/2012/10/26/stepbystepguidetobuildanodataservicebasedonrfcspart3 4/7
3.StarttheGatewayClient(Transaction/IWFND/GW_CLIENT) inaseparatewindowtoruntheservice.ProvidethefollowingURItogetthemetadatafortheservice:/sap/opu/odata/sap/ZGW100_XX_SO_SRV/$metadata
TheSalesOrdercollectionnowincludesanavigationproperty.4.Whenyounowselectasalesorderentryusing/sap/opu/odata/sap/ZGW100_XX_SO_SRV/SalesOrderCollection('0500000001'), for example, you can simply addthenavigationlink/SalesOrderItemstonavigatetothelineitemswithouthavingtosetafilteryourself:
5.Andfinallyyoucanuse$expandtoreadallsalesorderitemsforagivensalesorderinasinglehttpcall.SimplyprovidethefollowingURI:/sap/opu/odata/sap/ZGW100_XX_SO_SRV/SalesOrderCollection('0500000001')/?$expand=SalesOrderItems
-
16/04/2015 StepbystepguidetobuildanODataServiceba...|SCN
http://scn.sap.com/people/volker.drees/blog/2012/10/26/stepbystepguidetobuildanodataservicebasedonrfcspart3 5/7
AverageUserRating
(6ratings)
MyRating:
0 Tweet 1
The$expandstatementishandledbytheframework(noadditionalimplementationisrequired).SincetheframeworkdoesnotknowthatbothentitiescanbeobtainedusingasingleRFCcall,itexecutestwocallstotheunderlyingBAPI.Thiscanbeimprovedbymanuallyimplementing(redefining)theGET_EXPANDED_ENTITYmethod.Sowearedone.TheServiceisupandrunning.
IhopeyouenjoyedcreatingandconsuminganODataServicethatisbasedonRFCmodules.
11050Views Products:sap_netweaver_gatewayTopics:mobileTags:gateway,odata,netweaver_gateway,service_builder
Share
7Comments
Like(0)
WouterPeeters06Oct201313:42
HiVolker,Thx,theseareagreattutorialseriestogetstartedwithGateway.ButI'mhavingsometroublesaddinganavigationtorwardstheProductDetail,fromtheSalesOrderItementity.Doyouhaveanypointers?Maybethisisagoodideaforapart4.Regards,wouter
VolkerDrees08Oct201310:32(inresponsetoWouterPeeters)
HiWouter,thanksforthefeedback.NavigatingfromaLineItemtotherelatedProductisalittletrickier.ThisisbecausetheURIthatyouuse(e.g.".../SalesOrderItemCollection(SoItemPos=...,SoID=...)/ToProduct")onlyhasthekeyinformationoftheLineItem.InordertobeabletonavigatetotheproductentryyoufirstneedtoreadtheLineItemdetailtofetchtherelatedProductId,andfromtherefetchtheentireproduct.LuckilythisistakencareofbytheServiceBuilderaswell.YoujustneedtomakesuretomaintaintheAssociationandtheReferentialConstraintbetweentheLineItemandtheProduct.
-
16/04/2015 StepbystepguidetobuildanODataServiceba...|SCN
http://scn.sap.com/people/volker.drees/blog/2012/10/26/stepbystepguidetobuildanodataservicebasedonrfcspart3 6/7
Like(1)
hth.Regards,Volker
Like(0)
WouterPeeters08Oct201312:04(inresponsetoVolkerDrees)
HiVolker,Thanksforthereply,formoreinformationthere'satopiconthematter:
http://scn.sap.com/thread/3434085Regards,Wouter
VijayDudla13May201413:05(inresponsetoVolkerDrees)
HiVolker,Ididthesamestepsbutunabletousethenavigationorexpandoption?whatwastheissue.Belowisthemetadataformyservice.
-
16/04/2015 StepbystepguidetobuildanODataServiceba...|SCN
http://scn.sap.com/people/volker.drees/blog/2012/10/26/stepbystepguidetobuildanodataservicebasedonrfcspart3 7/7
FollowSCNSiteIndex ContactUs SAPHelpPortalPrivacy TermsofUse LegalDisclosure Copyright
Like(0)
ThanksVijay
Like(0)
ShakeeluddinKhaja24Nov201413:47
Veryusefulinfo.ThanksVolker
Like(0)
StarletAbraham08Dec201410:52
HiVolker,YourTutorialhasbeenveryhelpful.IamlearningWebservicesfromscratch.Ihaveadoubt.IcantfindtheASSOCIATIONSETSblockinmySEGWProject.Wouldtherebeareasonforthis?ThanksAbraham
Like(0)
VolkerDrees08Dec201416:25(inresponsetoStarletAbraham)
HiAbraham,IassumeyouareusinganewerversionofSAPNetWeaverGateway(theblogwaswrittenforSP5)?TheGatewayFrameworkisautomaticallygeneratingtheAssociationSetsbasedonthedefinedAssociations.That'sthereasonwhytheServiceBuilderisnotshowingtheminthenavigationtreeanymore.ButyoucanstillcreateownAssociationSetsifyouwant(RightClickonDataModelandchooseCreate>AssociationSet).BestRegards,Volker