Professional Documents
Culture Documents
StepbystepguidetobuildanODataServiceba...|SCN
GettingStarted Newsletters
Hi,Guest
LogOn
JoinUs
Store
SearchtheCommunity
Products
Services&Support
AboutSCN
Downloads
Industries
Training&Education
Partnership
DeveloperCenter
Activity
LinesofBusiness
UniversityAlliances
Events&Webinars
Innovation
Browse
Communications
Actions
volker.drees
StepbystepguidetobuildanODataServicebased
onRFCsPart2
PostedbyVolkerDreesinvolker.dreeson26Oct201211:44:38
Share
Tweet
Helloagain.
Inthe firstpart(1)wehavecreatedaservicethatconsistsoftwoentities(SalesOrderandSalesOrderLineItem)
andtworelatedentitysets.TheruntimeartifactshavebeengeneratedandtheODataservicehasbeenregisteredand
activated.
Inthispart(2)wewillmapbothentitysetstotherelateddataprovidersinourcasethe2EPMBAPIs.
Whenitcomestodataprovidermapping/implementationofODataservicesyouusuallystartwiththeQuerymethod
asthisisatypicalentrypointwhenconsumingaservice.Inourcasewewillfirstenablethequery:providemeall
SalesOrdersthatexist.Inarealbusinesscaseyouwouldprobablymakesomefilteringmandatorytonotoverload
thebackendsystem.Butletskeepitsimpleforthetimebeing
1.AsmentionedwewillstartwiththeQuerymethodfortheSalesOrderCollectionentityset.ExpandthenodeService
Implementation>SalesOrderCollectionandrightclickGetEntitySet(Query)andselectMaptoDataSource:
2.Inthemaptodatasourcewindow,enterthefollowingvaluesandchooseEnter:
TargetSystem
Local
DataSourceType
RemoteFunctionCall
DataSourceName
BAPI_EPM_SO_GET_LIST
http://scn.sap.com/people/volker.drees/blog/2012/10/26/stepbystepguidetobuildanodataservicebasedonrfcspart2
1/11
16/04/2015
StepbystepguidetobuildanODataServiceba...|SCN
3.ThemappinghasalreadydonebecausethedatamodelhasbeenbuiltbasedonthesameRFCinterface.Foreach
property,settheMappingDirectiontoOutput.ChooseEnter:
NowwecanmoveonanddothemappingfortheReadoperation(GetEntity)oftheSalesOrderCollection.
1.RightclickGetEntity(Read)andselectMaptoDataSource:
2.IntheMaptoDataSourcedialogbox,enterthefollowingvaluesandchooseEnter:
TargetSystem
Local
DataSourceType
RemoteFunctionCall
DataSourceName
BAPI_EPM_SO_GET_DETAIL
http://scn.sap.com/people/volker.drees/blog/2012/10/26/stepbystepguidetobuildanodataservicebasedonrfcspart2
2/11
16/04/2015
StepbystepguidetobuildanODataServiceba...|SCN
3.ThistimetherearenodefaultmappingsettingsbecausethedatamodelhasbeendefinedbasedonadifferentRFC
module.
ExpandtheHEADERDATAnodefromthetreeontherighthandside:
4. Drag&drop the following fields from the righthand tree to the Data Source Parameter column of the grid in the
middleofthescreen:
RFCField(righthandside)
EntityProperty
SO_ID
SoId
NOTE
Note
BUYER_ID
BuyerId
BUYER_NAME
BuyerName
CURRENCY_CODE
CurrencyCode
GROSS_AMOUNT
GrossAmount
NET_AMOUNT
NetAmount
TAX_AMOUNT
TaxAmount
InanyReadOperationwealsoneedtoprovidetheprimarykeyoftheunderlyingentityasaninputparameter.Forthis
wehavetomanuallyaddanewlinetothemappingscreen.
1.ChoosetheAppendRowpushbutton:
http://scn.sap.com/people/volker.drees/blog/2012/10/26/stepbystepguidetobuildanodataservicebasedonrfcspart2
3/11
16/04/2015
StepbystepguidetobuildanODataServiceba...|SCN
2.OnthenewlinepressF4toselecttheentitysetproperty.DoubleclickSoIdtoselecttheentry:
3.ExpandtheSO_IDnodefromthetreeontherighthandside:
4.Drag&DroptheRFCfieldSO_ID(fromnodeSO_ID)tothenewlycreatedline:
5.Thisperformsthemappingontheinputparameter(SalesOrderIDtofetchtheSalesOrderdetails):
NowwecanmoveonwithmappingtheQueryoperationfortheSalesOrderItementityset
1. Expand the node Service Implementation > SalesOrderItemCollection and rightclick GetEntitySet (Query) and
selectMaptoDataSource:
http://scn.sap.com/people/volker.drees/blog/2012/10/26/stepbystepguidetobuildanodataservicebasedonrfcspart2
4/11
16/04/2015
StepbystepguidetobuildanODataServiceba...|SCN
2.IntheMaptoDataSourcedialogbox,enterthefollowingvaluesandchooseEnter:
TargetSystem
Local
DataSourceType
RemoteFunctionCall
DataSourceName
BAPI_EPM_SO_GET_DETAIL
3. There is again no default mapping because the data model has been built based on a different RFC module.
ExpandtheITEMDATAnodefromthetreeontherighthandside:
http://scn.sap.com/people/volker.drees/blog/2012/10/26/stepbystepguidetobuildanodataservicebasedonrfcspart2
5/11
16/04/2015
StepbystepguidetobuildanODataServiceba...|SCN
4. Drag&drop the following fields from the righthand tree to the Data Source Parameter column of the grid in the
middleofthescreen:
RFCField(righthandside)
EntityProperty
SO_ID
SoId
SO_ITEM_POS
SoItemPos
PRODUCT_ID
ProductId
NOTE
Note
CURRENCY_CODE
CurrencyCode
GROSS_AMOUNT
GrossAmount
NET_AMOUNT
NetAmount
TAX_AMOUNT
TaxAmount
QUANTITY
Quantity
QUANTITY_UNIT
QuantityUnit
5.IntheDirectionColumnsetallfieldstoOutput.ChooseEnter:
6.ChooseAppendRowbutton:
http://scn.sap.com/people/volker.drees/blog/2012/10/26/stepbystepguidetobuildanodataservicebasedonrfcspart2
6/11
16/04/2015
StepbystepguidetobuildanODataServiceba...|SCN
7.Fromtheinputhelp,selectSoIdforthenewline:
8.ExpandtheSO_IDnodefromtherighthandtree:
9.Drag&droptheRFCfieldSO_ID(fromnodeSO_ID)tothenewlycreatedline:
Nowwearedonewiththedataprovidermapping(atleastfortheQueryandReadoperationsweneed).Nowwecan
regeneratetheruntimeartifactsandrunourODataservice.
1.ChoosetheGeneratepushbutton:
2.Verifythattheruntimeobjectshavebeengeneratedsuccessfully:
http://scn.sap.com/people/volker.drees/blog/2012/10/26/stepbystepguidetobuildanodataservicebasedonrfcspart2
7/11
16/04/2015
StepbystepguidetobuildanODataServiceba...|SCN
3.StarttheGatewayClient(Transaction/IWFND/GW_CLIENT)inaseparatewindowtoruntheservice.Providethe
followingURItogettheSalesOrderCollection.ThisexecutesthequerymethodoftheSalesOrderentityset:
/sap/opu/odata/sap/ZGW100_XX_SO_SRV/SalesOrderCollection
4.ChooseanysalesorderentryandusetheURItonavigatetothesalesorderdetail,forexample:
/sap/opu/odata/sap/ZGW100_XX_SO_SRV/SalesOrderCollection('0500000001')
5.GettherelatedsalesorderlineitemsviathefollowingURL:
/sap/opu/odata/sap/ZGW100_XX_SO_SRV/SalesOrderItemCollection/?$filter=SoIdeq'0500000001'
http://scn.sap.com/people/volker.drees/blog/2012/10/26/stepbystepguidetobuildanodataservicebasedonrfcspart2
8/11
16/04/2015
StepbystepguidetobuildanODataServiceba...|SCN
TonavigatefromtheSalesOrderentitytotherelatedlineitems(EntitySet),youneedtoconstructtheURIyourself.In
the nextpart(3)youwillseehowtodefineanassociationandanavigationpropertybetweenthetwoEntities.
19161Views
Products:sap_netweaver_gatewayTopics:mobileTags:gateway,odata,netweaver_gateway,service_builder
AverageUserRating
MyRating:
(4ratings)
Share
Tweet
11Comments
MatteoSomensi09May201417:09
hi,
Ifollowedstepbystepyourguide,butitdoesnotwork,theservicewhenIcallSalesOrderCollection
orSalesOrderItemCollectiongivesmeanerrorlikethis:
Like(0)
http://scn.sap.com/people/volker.drees/blog/2012/10/26/stepbystepguidetobuildanodataservicebasedonrfcspart2
9/11
16/04/2015
StepbystepguidetobuildanODataServiceba...|SCN
akshathlt14May201412:59(inresponsetoMatteoSomensi)
HiMatteo,
CheckwithconnectionofNW&ECC(Backend)systemconnectedproperlyornot.
OnceyoucrosscheckwithBASISteamifpossible.
Like(0)
ARSHADSHAIKH03Nov201412:45
HiVolker,
Ifollowedyourblog.iamnotgettingerrorbut,
/sap/ZSALES_ORDER_SRV/SalesOrderSet
InVBAKihavemanySalesOrdersbutitshowonlyfirst2andwithoutanyotherdeailslike
Note,BuyerId,BuyerNameall.
Tableentries.
IfIpasscorrectSalesorderid
/sap/ZSALES_ORDER_SRV/SalesOrderSet('0000004975')
Iamgettingthiserror
Canyouhelpmeoutinresolvingtheproblem.
Like(0)
VolkerDrees03Nov201416:51
HelloArshad,
asmentionedinthefirstparttheBAPIsusedareaccessingtheEPMdemocontent.Theyarenot
accessingtheSDtables(likeVBAK).
InsteadyoufindthesamplesalesordersofEPMintableSNWD_SO.
Hopethishelps.
BestRegards,
http://scn.sap.com/people/volker.drees/blog/2012/10/26/stepbystepguidetobuildanodataservicebasedonrfcspart2
10/11
16/04/2015
StepbystepguidetobuildanODataServiceba...|SCN
Volker
Like(0)
ARSHADSHAIKH04Nov201406:38(inresponsetoVolkerDrees)
ThanksVolker,
canyousuggestmehowtoaccessthedatafromstandardtables(likeVBAK),
IhavetocreatecompleteserviceforSalesOrderandPurchaseorder,
BestRegards,
ArshadShaikh
Like(0)
VolkerDrees04Nov201409:33(inresponsetoARSHADSHAIKH)
HelloArshad,
I'dproposetoaccessstandardtablesviatherelatedBAPIs.E.g.forSalesOrders
thereistheBAPI_SALESORDER_GETLISTfunctionmodule.
BestRegards,
Volker
Like(2)
ShakeeluddinKhaja24Nov201413:46
Veryusefulinfo.ThanksVolker
Like(0)
PatrickDean27Nov201412:00
Superuseful!Thanksforthedetails!
Like(0)
saurabhvakil26Feb201513:31
Hi,
Wehavefollowedyourfirstblog StepbystepguidetobuildanODataServicebasedonRFCs
Part1andaretryingtoimplementthestepsmentionedinthisblog.Whileperformingthestep
1.ExpandthenodeServiceImplementation>SalesOrderItemCollectionandrightclickGetEntitySet
(Query)andselectMaptoDataSource:
wefindthatwhenwerightclickonGetEntitySet(Query)weseetheoptionMaptoDataSourcein
disabledformat.
Canyoupleaseletmeknowwhatmaybethereasonforthis?
Regards,
Saurabh
Like(0)
VolkerDrees27Feb201511:06(inresponsetosaurabhvakil)
HiSaurabh,
areyoustillinEditmode?"MaptoDataSource"shouldbedisabledonlyinDisplaymode.
BestRegards,
Volker
Like(0)
VolkerDrees27Feb201511:37(inresponsetosaurabhvakil)
Orhaveyoualreadymappedadatasource?Inthiscasethemenuoptionisalso
greyedout.
Regards,Volker
Like(0)
SiteIndex
Privacy
ContactUs
TermsofUse
SAPHelpPortal
LegalDisclosure
Copyright
http://scn.sap.com/people/volker.drees/blog/2012/10/26/stepbystepguidetobuildanodataservicebasedonrfcspart2
FollowSCN
11/11