Professional Documents
Culture Documents
(/)
SEARCH
()
Bluefin (/) Lindsay Stanger (/blogs/lindsay-stanger) Building your first simple Gateway service
Related
Getting started with SAP Fiori, NetWeaver Gateway & SAPUI5 (/Blogs/John-Murray/April-2014/Getting-started-with-SAPFiori,-NetWeaver-Gateway)
Introducing SAP Fiori as part of an SAP S/4HANA project (/Blogs/Lindsay-Stanger/March-2016/Introducing-SAP-Fiori-aspart-of-a-SAP-S-4HANA-pro)
I imagine youre reading this because youve either just installedSAP NetWeaver Gateway, or are considering
installingit. Well Im here to tell you that, from where Im standing, it looks like the future of SAP will rely
heavily upon it, so youre making the right steps!
1. Purpose
SAP NetWeaver Gateway is an enabling component of SAP which allows you to expose data from one or many systems to the outside world.
The underlying systems are usually SAP ones (SAP ECC, SAP CRM, SAP ERP and so on. ) but it is important to note that you can use Gateway
with non-SAP systems too.
Now you all have a basic understanding of what Gateway is, youre ready to get on with the fun bit!
We use cookies on bluefinsolutions.com to ensure that we can give you the very best experience. To find out more about how we use cookies, please visit the cookie
policy (/privacy/privacy-policy) page.
Close (building-your-first-simple-gateway-service?cookiesViewed=true)
27/10/2016
Pgina 2 de 12
Chose a project name, give your project a description and select Standard generation strategy.
In my example I will be creating the service as a local object.
Enter the name of the ABAP Dictionary Structure you want to use, and hit enter. In our example we are using SCARR.
We use cookies on bluefinsolutions.com to ensure that we can give you the very best experience. To find out more about how we use cookies, please visit the cookie
policy (/privacy/privacy-policy) page.
Close (building-your-first-simple-gateway-service?cookiesViewed=true)
27/10/2016
Pgina 3 de 12
Enter an Object Name, this will be the name of your entity. Select any fields to not include (ignore) and ensure the correct key is selected.
27/10/2016
Pgina 4 de 12
It is best practice for the model provider class name to end in _MPC and the data provider class to end in _DPC. The extension classes of these
should be named the same as their corresponding base class, with the additional suffix of _EXT.
Generating can take a few moments, so dont worry if it isnt instant. Once it is complete you will see a detailed log of successes, warnings and
errors. If you have done everything right this should be all green.
We use cookies on bluefinsolutions.com to ensure that we can give you the very best experience. To find out more about how we use cookies, please visit the cookie
policy (/privacy/privacy-policy) page.
Close (building-your-first-simple-gateway-service?cookiesViewed=true)
27/10/2016
Pgina 5 de 12
Because my Gateway instance is on the same box as my ERP, I enter LOCAL as the system alias. To learn more about setting up system
aliases you can read this document.
Enter the name of your service and hit enter.
Hit save and navigate back to the Activate and Maintain Services screen. Scroll down the list of services to find your one.
We use cookies on bluefinsolutions.com to ensure that we can give you the very best experience. To find out more about how we use cookies, please visit the cookie
policy (/privacy/privacy-policy) page.
Close (building-your-first-simple-gateway-service?cookiesViewed=true)
27/10/2016
Pgina 6 de 12
Here we can see our Carrier entity, with its properties, and the fact that there is an entity set associated with this entity.
If we change the URL again to end in /Carriers?sap-ds-debug=true we will see this error message:
This is because we havent yet told our service how to read Carrier information from the SCARR database table.
We use cookies on bluefinsolutions.com to ensure that we can give you the very best experience. To find out more about how we use cookies, please visit the cookie
policy (/privacy/privacy-policy) page.
Close (building-your-first-simple-gateway-service?cookiesViewed=true)
27/10/2016
Pgina 7 de 12
This then takes you into the ABAP Class where you will need to build your implementation.
Click on display object list
Find the CARRIERS_GET)ENTITYSET method of the left hand side, right click on it, and chose Redefine.
We use cookies on bluefinsolutions.com to ensure that we can give you the very best experience. To find out more about how we use cookies, please visit the cookie
policy (/privacy/privacy-policy) page.
Close (building-your-first-simple-gateway-service?cookiesViewed=true)
27/10/2016
Pgina 8 de 12
We use cookies on bluefinsolutions.com to ensure that we can give you the very best experience. To find out more about how we use cookies, please visit the cookie
policy (/privacy/privacy-policy) page.
Close (building-your-first-simple-gateway-service?cookiesViewed=true)
As you can see we now get a stream of information back, detailing all the Carriers stored in the SCARR table in ERP.
27/10/2016
Pgina 9 de 12
One airline carrier has many flights, but each flight has only one airline carrier.
7.1 Create an entity Flight with corresponding entity set from table SFLIGHT
Repeat the steps above to create a new entity Flight, and corresponding entity set Flights. This time, instead of basing it on the structure
SCARR we will use the structure SFLIGHT.
27/10/2016
Pgina 10 de 12
Generate.
Now we need to modify the ABAP so that when we ask for a list of flights for a specific carrier we dont get back all the flights, we just get back
those relevant to us.
Navigate to the ABAP method FLIGHTS_GET_ENTITYSET.
Change the code to read:
data: ls_key like line of it_key_tab.
read table it_key_tab into ls_key with key name = 'Carrid'.
* If there is a carrier ID specified, use it to select only those for the specific carrier
if sy-subrc eq 0.
select * from sflight into corresponding fields of table et_entityset
where carrid = ls_key-value.
* If there is no carrier specified, read all the flights
else.
select * from sflight into corresponding fields of table et_entityset.
endif.
We use cookies on bluefinsolutions.com to ensure that we can give you the very best experience. To find out more about how we use cookies, please visit the cookie
policy (/privacy/privacy-policy) page.
Close (building-your-first-simple-gateway-service?cookiesViewed=true)
27/10/2016
Pgina 11 de 12
IT_KEY_TAB is importing parameter of the method which will hold all keys which have been passed in. In our example it will contain a carrier ID f
the navigation is from Carrier, because Carrid if the key of the Carrier entity.
10. Wrap up
Congratulations, youve just built your first, easy Gateway service. Obviously this post does not go into the complexities of building a Gateway
service, but I hope it has given you an idea about where to begin.
For some interesting insights around, and beyond this topic its worth checking out the following:
Project Gateway - A call to arms, or at least to data (/Blogs/DJ-Adams/February-2011/Project-Gateway-A-call-to-arms-Or-at-leastto-da/) by DJ Adams
SAP Kapsel - what it is...and should we be excited? (/Blogs/DJ-Adams/February-2011/)by Brenton O'Callaghan
6 weeks, 3 apps and a sprinkle of SAPUI5 and Fiori customisation thrown into the mix. Challenge accepted! (/Blogs/LindsayStanger/February-2014/6-weeks,-3-apps-and-a-sprinkle-of-SAPUI5-and-Fiori/) by me!
SAP NetWeaver Gateway (/Technologies/SAP-Enterprise-Mobility/SAP-NetWeaver-Gateway/)
SAP NetWeaver Gateway (http://scn.sap.com/community/netweaver-gateway#) (on the SCN)
Published in:
Insight (/Insights/cat_Insight)
Development (/Insights/cat_Development)
Gateway (/Insights/cat_Gateway)
How to (/Insights/cat_HowTo)
Mobile (/Insights/cat_Mobile)
We use cookies on bluefinsolutions.com
to ensure that weSAP
can (/Insights/cat_SAP)
give you the very best experience. To find out more about how we use cookies, please visit the cookie
policy (/privacy/privacy-policy) page.
Close (building-your-first-simple-gateway-service?cookiesViewed=true)
27/10/2016
Pgina 12 de 12
Subscribe today
Sign up to our newsletters and receive leading industry insights from Bluefin.
Twitter (https://twitter.com/BluefinSolution)
LinkedIn
(http://www.linkedin.com/company/24887)
RSS (/rss)
Accessibility (/privacy/accessibility)
Site map (/privacy/site-map)
We use cookies on bluefinsolutions.com to ensure that we can give you the very best experience. To find out more about how we use cookies, please visit the cookie
policy (/privacy/privacy-policy) page.
Close (building-your-first-simple-gateway-service?cookiesViewed=true)
27/10/2016