SAP Gateway
Browsing All 253 Articles Latest Live
Mark channel Not-Safe-For-Work? cancel confirm NSFW Votes: (0 votes)
Are you the publisher? Claim or contact us about this channel.

Day 1 highlights for SAP Gateway at SAPPHIRE 2014


What a powerful keynote speech from SAP CEO Bill McDermott this morning to open the SAPPHIRE 2014! Speed, Simplicity and Personalization are the key success factors for SAP software as Bill outlined.

Over Crowded Google Glass Demo Theater Session

We had the first Google Glass demo theater session today. Over 100 people attended with standing room only at the end. This Google Glass demo enables a hands-free laptop repair scenario with connectivity through Cloud to SAP systems to retrieve laptop details, repair steps, parts inventory and order missing parts real-time via Gateway services. The app also provides video guide with repair procedure and the video conferencing ability to consult with 2nd level support. In this demo SAP Gateway plays a key role in the integration to SAP system.

If you missed today’s session, check out the other Google Glass demo sessions listed below. If you are at SAPPHIRE, you can even play with it yourself on Industry Campus at the Retail expert table (IN123) .


                              Glass view was projected on screen



                    Google Glass demo with standing room only



                 Google Glass demo architecture diagram (follow the yellow path for components in this demo)


This demo was developed together with SAP partner Quantilus. Here is a blog with more details written by Quantilus -Intelligent Automation for the Enterprise through SAP Gateway

Busy Middleware Expert Table on Technology Campus

Many customers came by the Middleware Expert table to discuss about SAP Gateway solution today. If you are onsite, definately check it out and get the latest news about SAP Middlware solutions. You can play with a cutting edge augmented reality app there as well.




Upcoming Education and Demo Sessions

There are more SAP Gateway sessions coming up the next 2 days at ASUG and SAPPHIRE. Here is a snapshot of them.




Session ID








eBay: Ramesh Murugan 





Simplified user experience for
managers leveraging SAP Gateway

– eBay case study

Wed, June 4th 1:45-2:45 PM


S. Concourse, L3


Demo Theater

SAP: Joav Bally


Deliver a World-Class User
Experience (Google Glass demo) 

Wed, June 4th 

5:00–5:20 PM

Technology Demo Theater TE301
SAPPHIREDemo TheaterSAP: Jeff Gebo


Speed up App Integration with
  Mobile-First Middleware
Wed, June 4th9:30 – 9:50 AM

2:30 – 2:50 PM

Technology Demo Theater TE303

Demo Theater

SAP: Himanshu Pande


Use Machine Vision in your Enterprise (Google Glass demo)

Wed, June 4;

Thu, June 5

9:00 -9:20 AM; 



11:30 – 11:50 AM

Demo Theater LB207



To know more about the overall SAP Gateway SAPPHIRE program offering see this blog - What is Exciting about SAP Gateway at SAPPHIRE

Follow us online:

SAP GatewayTwitter| LinkedIn |Youtube | SCN

SAP Gateway Product Management Team

Day 2 Highlights for SAP Gateway at SAPPHIRE 2014


Yet another exciting day at SAPPHIRE 2014! The day started with an inspiring message from Dr. Hasso Plattner, SAP Founder and Chairman of the SAP Supervisory board - “If we simplify everything, we can do anything”. Later, Harvard School Prof. Clayton M. Christensen shared stage with Dr. Hasso Plattner during the SAP Keynote Presentation : The Future of Enterprise Applications | SAPPHIRE NOW, where they discussed how SAP HANA is leading the renewal  of enterprise  applications.


In the SAP Gateway news, the first session of the Google Glass demo was held yesterday, and we had an amazing turn out. More than 100 people attended the session! This session was followed by a session in the evening with CalPortland, where they shared 2 of their powerful live applications using SAP Gateway. To catch the complete story about SAP Gateway at SAPPHIRE on Day1, read the blog.


Day 2 Sessions Overview

Today was a busy day for the SAP Gateway team at SAPPHIRE. The Google Glass demo sessions started out  at 9 am in the Line of Business Campus.


Himanshu Pande Presenting the Google Glass Demo

This was followed by our customer's session - Simplified User experience for managers Leveraging SAP Gateway : eBay Case Study, in the afternoon.


Ramesh Murugan, Senior Manager HR Technologies eBay

Lastly, Jeff Gebo had a session "Speed up App Integration with Mobile-first Middleware, were he discussed about Integration Gateway.


Saw our Google Glass App demos? Go play with the application and be prepared to be amazed!

SAP Gateway technology enables development of “Anywhere in the world class UX” on cutting edge devices. We have two new applications, Go To Work and Visual Showroom developed with our partners Quantilus. They are available to fiddle with at the Middleware Expert Table, Technology Campus and Retail Expert Table, Industry Campus.


A busy day at the Middleware Expert Table

  • Go to Work is a Google Glass application for hands free laptop repair, with features such as Machine Vision, Voice Recognition, 3-D visualization, Step by Step help, video guidance and many more. It even allows you to check inventory and order parts online.
  • Visual Showroom is a tablet based application, using which a user can see the augmented reality of an interior design item such as furniture etc. User can pick the right size and design pattern from available catalog entries and trigger the orders in SAP easily from anywhere.


Visual Showroom Application View

Upcoming Demo Session

ASUG/SAPPHIRECategorySession IDTitleDayTimeRoom
SAPPHIREDemo TheaterLB16285Use Machine Vision in your Enterprise (Google Glass demo)Thursday, June 511:30-11:50AMDemo Theater LB207


To know more about the overall SAP Gateway SAPPHIRE program offering see this blog - What is Exciting about SAP Gateway at SAPPHIRE

Follow us online:

SAP GatewayTwitter| LinkedIn |Youtube | SCN

SAP Gateway Product Management Team

Day 3 Highlights for SAP Gateway at SAPPHIRENOW 2014


After 2 days of jam packed sessions and exciting keynotes by SAP executives, I believe we can put away any doubts on SAP's transformation to a Cloud company after this year's SAPPHIRE NOW.


Why? "Becuase We Can"




Although it is the last day for SAPPHIRE NOW, conference attendees still made their way to the final stretch of the conference after a super-charged concert last night performed by Jon Bon Jovi and The Kings of Suburbia.


We kicked off the day with a special keynote by Rodolpho Cardenuto of SAP Global Partner Operation together with partners OpenText and Adobe. They talked about how SAP valued our partners to accelerate our customer engagement. Partners are certainly a key piece in the puzzle for SAP to become a Cloud company.  If you are a long-time SNL (Saturday Night Live) fan like me, you must love the presence of Dana Carvey, Dennis Miller and Kevin Nealon on stage. That really brought back a lot of good old memories from the ‘90s.


As mentioned by Ning-Jing and Supriya in their blogs in the past 2 days, our Google Glass demo was crowded with technology enthusiasts and Gateway developers. On its last showing today, it still drew a big crowd to check out what Gateway can do with Google Glass. Today, SAP’s Himanshu Pande and the staff from Quantilus presented in the session – “Use Machine Vision in your Enterprise” – and showcased the fascinating application (Go to Work) built by SAP Gateway and Google Glass.




The team from SAP Gateway for Microsoft also presented a session on how our customer, Hess, uses SAP Gateway for Microsoft to build an Invoice Approvals Solutions to improve the user experience for their field users. The session was jointly presented by SAP’s Jenny Lundberg, Capgemini (partner) and Hess (customer).





We would like to take this opportunity to thank all of you who stopped by our demo theater and talked to us. Let us know how you want SAP Gateway makes an impact in your workplace. Drop us a line in the following social media channels below. Yes, it is that SIMPLE! (As we learned how simplicity is so important to us)


If you are interested in any missing sessions, you can always check our website for the replays (click below).



Follow us online:

SAP GatewayTwitter| LinkedIn |Youtube | SCN

More pictures on Facebook here.


See you all next year!


SAP Gateway Product Management Team

SAP Gateway & Device Agnostic Reporting


In this blog I am going to share my experience in implementing multiple device agnostic reports and dashbords at one of our clients in partnership with SAP.


Every company wants to remain ahead of the competition in business practices and the internal processes. As part of this effort my client started looking for a solution to meet the requested reporting requirement for 5000 managers. Among the few criteria for the solution selection was scalability, security, reusability, low cost and high ROI.  When we proposed the solution using SAP Gateway, it found a natural ally and as the concept developed the greater traction it took with the client. Successes of the first solution lead to the development of multiple solutions across various platforms and greater adaptability across the complete enterprise landscape.



Since we are talking about the landscape here, let me talk about a little bit about the landscape which we developed to support this solution.  After the initial proof of concept, the initiative was taken to set up a dedicated landscape for SAP Gateway. The first step in this effort was the system sizing. Since the client is a SAP shop, so it was natural to accept the concept of three system landscape for SAP Gateway i.e. Development, Quality Assurance and Production systems; although sandbox system was also part of the landscape. The landscape systems were installed and configured as the solution went from one stage to another i.e. from development to quality assurance to production.


The solutions were built for BI running on an SAP HANA environment.  One of the client requirements was that the solution must use the existing BEx
queries. So the idea that the solution must be able to reuse the SAP delivered and custom objects was tested from very beginning. This adaptability is SAP Gateway very important features, so you are looking at a product which can use the standard and custom objects with the same ease. This is a big cost savings; look at it from the client side, how much they have invested in all these years to develop the SAP objects to meet their specific business needs. And here is a solution which is using those same objects to deliver a new age device agnostic solution. So you are moving from a blue screen to the new User Interface at fraction of the cost.


I will not say that the first implementation cycle was without any challenges, we had our share. A few stakeholders had their concerns; setting up the security roles was a major milestone. But once we had the SAP Gateway configured and setup the process was pretty clean with a few bumps on the way for which we had SAP team to support us (Thanks Tobias Griebe and Peter Ng for their help and support).


Once the services were setup for the backend components, we exposed them to the frontend as JSON instead of standard XML, they are more light weight and frontend team was able to absorb them to provide the required user interface.


We did move the SAP objects through the CTS layer using SAP transports so the client standard change management was applicable on all our changes. We also took every effort to create as much documentation as possible as this was a new technology introduction. Once we had our software components
in Quality System we did integration and regression testing. And after reaching production, since it was a new system, we did both regression and stress testing to make sure that the system can support the load of close to 5000 business users.

SAP River Rapid Development Experience, the Next IDE


Gateway Productivity Accelerator (GWPA) is a huge success among mobile developers who want to create fast, great looking, robust mobile apps that consume business data from SAP systems. GWPA consumption tools provide toolkits for creating native mobile apps for iOS and Android as well as HTML and PHP web applications.


However, in recent years more and more mobile developers are shifting from native apps to hybrid and web apps. The appeal of “develop once, deploy everywhere” has led to a fast pace adoption of technologies such as PhoneGap Cordova and Titanium Appcelerator.


Another trend that is sweeping the web development world in recent years is the move to cloud based IDEs such as Orion, Cloud9, ShiftEdit, CodeEnvy, and many more. The ease of use, zero installation, small footprint, and built-in integration, are huge benefits that draw developers into abandoning Eclipse-based tools and moving to the cloud.


The combination of these two mind shifts in the development world has led us to the conclusion that a rich, fully integrated web IDE is the way to go.


Introducing SAP River RDE– the new web-based development tool from SAP. With SAP River RDE you can easily create modern, responsive, elegant SAP UI5 applications that will look great on any screen. With support for OData service exploration and consumption, code generation, built-in application templates, SAP River RDE is the perfect tool for application developers. It offers a productive and simple approach to web development with code editors that offer code completion, syntax highlighting, wizards for creating starter apps, instant preview, mock-data, application extensibility, GIT client and much more.


SAP RDE is seamlessly integrated with SAP Hana Cloud Platform, and in the future will be integrated with the SAP Mobile Platform, so you can truly write your app once, and deploy it anywhere. This makes SAP River RDE is the natural successor of GWPA Consumption Tools.


SAP River RDE – the development tool of the future.

Recognize File name - Special characters and LOTE's(Foreign texts)


Hi All,

This blog is about identifying special characters and LOTE's (Langages Other Than English) in a file name when we upload a file from user's machine.



Upload a file name containing special chars. Ex:A Germanic file name.


Encode the file name using the below method:



Pass this value to the slug paramter as shown below.


File upload code:


<!DOCTYPE html>



  <meta  charset="UTF-8">

  <script src="https://code.jquery.com/jquery-1.11.0.min.js" type="text/javascript" > </script>

    <script type="text/javascript">

    var token1 = '';

    var xhr = new window.XMLHttpRequest();

    var file = " ";

    function rundCode() {

         file = document.getElementById('attafh').files[0];


        if (file) {





    function UploadMe(readFile) {

        var reader = new FileReader();

        reader.readAsArrayBuffer(readFile); //array buffer      

        reader.onload = loaded;

//         reader.onerror = errorHandler;



    function loaded(evt) {


        var fileString = evt.target.result;                         


         // Begin of Get Token  


                 url: 'https://aa/sap/inv/opu/odata/sap/Y_GET_ATTACHMENT/$metadata',

                 type: "GET",

                 contentType: "application/atom+xml;type\x3dentry;",

                 dataType: "",

                 headers: {

                     "x-csrf-token": "fetch",

                     Authorization: "Basic ZGd1cnU6WWFsdGVjaDM="


             success: function (data, textStatus, request) {

             token1 = request.getResponseHeader('x-csrf-token');



                  type: 'POST',

                  url: "https://aaa/sap/inv/opu/odata/sap/Y_GET_ATTACHMENT/Document/",                  

                   xhr: function()


                    //Upload progress

                     xhr.upload.addEventListener("progress", function(evt){

                      if (evt.lengthComputable) {

                        var percentComplete = Math.round(evt.loaded * 100 / evt.total);


                       //Do something with upload progress



                    }, false);       


                  xhr.addEventListener("error", function(evt){

                alert("There was an error attempting to upload the file.");


                    }, false);


                    return xhr;



                contentType: "application/json",

                processData: false,                          

                data: fileString,

                dataType: "text",

                headers: {

                          "x-csrf-token" : token1,

                          "Authorization" : "Basic ZGaaaaaa",

                          "slug":  encodeURIComponent(file.name)


                success: function(data){

                   alert("File uploaded successfully");








    function abortRead() {










    <input type="file" id="attafh"  class="AlltextAccount"  />

      <input type="button" value="upload" onclick="rundCode()" />

      <button onclick="abortRead();">Cancel</button>

      <progress class="progress" value="0" max="100"> </progress>








The encodeURIComponent() method encodes a Uniform Resource Identifier (URI) component by replacing each instance of certain characters by one, two, three, or four escape sequences representing the UTF-8 encoding of the character (will only be four escape sequences for characters composed of two "surrogate" characters).


Now submit the file the SAP Gateway server.



You can see the UTF-8(Unicodes) characters received and it is decoded using method as shown below.



data:v_unescaped type string,

  v_escaped   type string,

  v_return_code type i.

v_escaped = lv_file_info = iv_slug.


//Decode the Unicode texts to original string.

  CALL METHOD cl_http_utility=>unescape_url


      escaped   = v_escaped


      unescaped = v_unescaped.








Thats all. We are done !!!


Please share your feedback.




Recorded Webinar Session: Integration Gateway in SAP Mobile Platform 3.0


In case you missed our webinar session about Integration Gateway in SAP Mobile Platform 3.0,you can watch the recording here: http://youtu.be/3Vh_wufh0vk. Integration Gateway is a reusable technology component that brings SAP one step closer to realizing its vision of delivering a REST based, harmonized integration layer amongst all the solutions in SAP portfolio and beyond. To achieve that, Integration Gateway implements a runtime that supports various protocols and standards such as HTTP, ODC, SOAP, JPA and JDBC to access data. Furthermore, it comes with design-time tools that allow modelling and provisioning of new RESTful (OData) web services based on the data sources supported by the runtime. As a result, Integration Gateway complements SAP Gateway by provisioning (RESTful) OData services that expose data not only from any SAP system, but also non-SAP. Best of all, as a reusable component, Integration Gateway capabilities will be available across many SAP solutions consistently.

SAP CodeJam in Bielefeld about SAP Gateway and SAPUI5




On June the 25th my colleague Jens Himmelrath and I conducted a SAP CodeJam event about SAP Gateway and SAPUI5. The event was organized and hosted by our partner Lynx at their subsidary in Bielefeld.


The idea of this event was to show what's needed in order to develop Fiori like applications by explaining both SAPUI5 development as well as OData service development using SAP Gateway end to end.


First I was a little bit unsure about the location because of the Bielefeld Conspiracy that claims that Bielefeld does not actually exist.


So we were curious of what to find ...

After having conducted the event I can now confirm that Bielefeld does really exist since I have been there ...


However some of you will now think that I belong to THEM that have conspired to create the illusion of the city’s existence ...


As a proof you can see the room that was packed with 37 participants from 18 different customers and partners.



We started at 10 AM after a warm welcome of the managing director of Lynx with short presentations where we gave an introduction to SAPUI5 and SAP Gateway. We had lots of interesting discussions and got also interesting questions that we took back to our development teams.



At noon there was time to get some food so that everybody could continue until the end of the event at 4 PM.


We are looking forward to run similar events elsewhere.


So if you are interested please let my colleagues from the SAP CodeJam team and me know.


How to run such an event has been described in this document How to host an SAP CodeJam.


Best Regards,

SAP Gateway Developer Tools – Bridging the Past, Present and Future


Most of you would already know that SAP has officially ended the support of Eclipse Juno in the end of June 2014. As SAP generally tries to support the current and the previous versions of Eclipse, we will soon remove references to https://tools.hana.ondemand.com/juno from the index pages. Only the tools which support Eclipse Kepler and Luna will be listed on “SAP Development Tools for Eclipse” update site.


Since SAP NetWeaver Gateway Productivity Accelerator(GWPA) toolkit is only available on Juno, as a developer working with Gateway platform should you be worried? Do Gateway tools support Kepler yet? When can you expect the new tools? Via this blog we would like to answer some of these questions which concern your day to day work.


First and foremost, until Kepler based tools are available you can continue to use the link https://tools.hana.ondemand.com/juno in the Eclipse environment via “Help à Install New Software”. This link will be active at least for the whole of 2014 even after end of support for Juno. Once Kepler based tools are available we recommend that you switch to Kepler version.


Secondly, with regards to Kepler we need to first explain a bit about “GWPA” package itself. GWPA is a bundle of multiple toolkits which cover both “provisioning” and “consumption” aspects, in addition to an “OData Modeler” which acts as a bridge between the two. Provisioning tools such as “Toolkit for Integration Gateway” help in creating and deploying services on a given target platform, and Consumption tools are platform specific SDKs to consume these services in different clients such as iOS, Android and Java.


Let’s talk about these three individual components of GWPA:


  • OData Modeler– We will have a new and improved tool in Kepler
  • Provisioning tools– Currently we have “Toolkit for Integration Gateway” which supports SAP Mobile Platform (SMP) 3.0. In Kepler we will have an improved toolkit called “API Toolkit for SAP Mobile Platform” offering similar functionality and more
  • Consumption tools– Please refer this link for more details


Thirdly, it is important to note that in Kepler the provisioning tools will be found under “SAP Mobile Platform tools” category. This is done keeping in view our long term vision of Gateway design tooling and its positioning across SAP ecosystem.


We expect to release Kepler based tools very soon. Stay tuned for additional communication on this, but until then we recommend that you continue to access Juno based tooling from https://tools.hana.ondemand.com/juno update site.


CC: SAP Mobile Platform Developer Center

Consuming OData in Python



Python is my favorite programming language, the reason for this blog post is just my curiosity.


There are few ways how to make python work with SAP.


But what about a connection to gateway using OData?

There are documents about connecting to gateway forPHP, Java Script, Flex, .NET, Objective C in SAP NetWeaver Gateway Developer Center. But where is Python?


OData library for python

I started to look for an odata library and found two reasonable options:

  1. OData-py is "OData provider for Google App Engine Datastore". Unfortunately, it can be probably used only in google app engine, has several limitations, and is not maintained since 2011.
  2. Pyslet is "Python for Standards in Learning Education & Training". It includes module which implements OData client and also server. Let's see what it can offer.

Running Pyslet on web.py

Web.py is a small python framework for creating web applications. Integration was simple - install pyslet, import a module and you are can start consuming an OData service. I created small hello world application that fetches product list and displays product names.



from pyslet.odata2.client import Client


Handling class:

class index:    def GET(self):    c=Client("http://services.odata.org/V2/Northwind/Northwind.svc/")    products=c.feeds['Products'].OpenCollection()    productNames = []    for k,p in products.iteritems():    productNames.append(p['ProductName'].value)        web.header('Content-Type', 'text/html')        return render_template('index.html', products = productNames)



<!DOCTYPE html><html lang="en">  <head>    <meta charset="utf-8">    <title>Python + ODATA</title>  </head>  <body>    <table border="1">    <tr><td><strong>Name</strong></td></tr>     {% for name in products %}     <tr><td>{{name}}</td></tr>     {% endfor %}  </table>  </body></html>


And the result:




I used information from author's blog - http://swl10.blogspot.com/. More useful and detail information can be found there.


This was just a simple experiment. Author claims that the module does not work with HTTPS OData service, so basically it cannot be used in real environment.

Next challenge? HTTPS source and more sophisticated application!


Looking for you feedback.

FaceSearch – Let's Build a HANA/Gateway/UI5 App


Back in February, I finished up the Matt Harding’s Fiori Like Challenge with a laundry list of items I wanted to get to in the future. Well I had a few days a couple of months or so ago and while I wait for my next break in deliverables, I better publish where I’m up to, hence the future is now (or last month…).


Scope of Work and Blog


I could spend days producing a final product and then blogging about the experience; but that has a few issues in my mind:


  • I could get too busy to finish (has already happened);
  • I may forget key aspects of the solution if wait to the end to document the solution (would have happened but luckily have my mind backed up in this blog);
  • The blog will become such a long blog with so many different facets that it misses the various audiences entirely (partly very likely, but let’s move on regardless).


So with that in mind, the blogs will be split up as follows:


Part 1 (This Blog) – FaceSearch Filter Screen

Build the initial FaceSearch page, hooking into a HANA query to provide near real-time feedback on number of faces found. This will involve:

      • Creation of the UI5 project based on the high resolution prototype but made production quality
      • Outside-In Service Design for just the search interface query (Using Gateway Productivity Accelerator oData modelling tools) – If I was splitting development between UI and back-end – this would be a good initial approach to agree on all the services – but a little superficial in this example
      • Getting the HANA NetWeaver instance up and running, including setting up my client.
      • Implementing the Service within Gateway using hard coded return values.
      • Building a mock HR name database for use in FaceSearch

Edit: The following was also scheduled for this blog, but my AWS instance got corrupted (no idea how), so I will move the following sections to my next blog, and wrap up with a teaser on how easy HANA can make Google-like queries.

      • Building a HANA Core Data Services (CDS) view to get my SQL logic just right.
      • Building an ABAP Managed Database Procedure (AMDP) for use with Gateway
      • Hooking up the Gateway implementation to the AMDP


Part 2 (Next Blog) – FaceSearch Results Screen

Build the results “Faces” page. This will involve:

      • Enhancing the Gateway service to handle photos
      • Mocking up a 100x100(?) faces into a single image using a command line interface (may or may not hook this up for real to the ABAP system, but this would be fairly straightforward). The objective is to take a large number of people’s photos at a high resolution, shrink them and then combine them into a single image with offsets to each person’s photo to minimise network overhead and make the FaceSearch results screen appear instantly (once cached)
        • Post SapphireNow – Am I meant to make all faces appear in circles (horrible idea in my opinion)???
      • Build a UI5 control to handle images with offsets and width/height for the above image
      • Build the results page


Part 3 (Last Blog) – Face Detail Screen and Optimisation

Build final page and optimise:

      • Build the Person details page including quick actions such as call number, email, etc;
      • Deploy UI5 content to HCP and connect via the backend connector and leverage HCP authentication options (try to get SSO?)
      • Play around with HTML5 offline options and optimisation of UI5 (I still don’t like how heavy it is to start)
      • Look at pre-cache of image files through async loading of manifest file containing images (hidden images)
      • Add Bookmark functionality


Okay – Let’s begin by going back to my notes from just over a month ago…

And because the SCN blog editor is really bad with copying and pasting images, I've decided to share the rest of this blog as a link to a pdf since there are way too many pictures to upload. Note - Anyone from SAP - Would really appreciate if someone would upload this pdf to SCN even though it's not allowed :-(

I hope you enjoy and/or get something out of it and even if you don't, I hope this inspires you to give yourself your own challenge to get to know SAP even better...

Implementing Expand Entity/Entity Set


Hi Folks,


Finally got some time to write a Blog on something which was a common question from a lot of audience here, so doing my bit of help here .. hope this helps a lot of beginners and not for experts


SAP Documentation for Expand Understanding




Some of the Blogs already posted in SCN relevant to Expand and Deep Entity .


Improved Inside-Out Modelling



Step by Step development for CREATE_DEEP_ENTITY operation





Considering a basic scenario where i am using  BAPI_PO_GETDETAIL which has multiple output tables and input is PO number




Now we shall start with SAP Gateway



Create Project in SEGW


Create three entity types and Entity Sets

Entity Type-1- Header   

Entity Type-2- Item

Entity Type-3- Schedule


Entity Set-1- HeaderSet

Entity Set-2- ItemSet

Entity Set-3- ScheduleSet


Create Association

Association-1 -  AssItem (Without key fields mapping)

Association-2 -  AssSchedule (Without key fields mapping)


Create Navigation

Navigation-1 -  NavItem

Navigation-2 -  NavSchedule


Let’s generate runtime artifacts. Click on generate runtime objects button. It will display

popup . Keep the default class names as-is and click on enter button.

Once generation is successful, you will get 4 classes. 2 for Data provider and 2 for Model provider.




Code Snippet

METHOD /iwbep/if_mgw_appl_srv_runtime~get_expanded_entityset.



*             Deep Structure


   DATABEGIN OF ls_order_items.

   INCLUDE       TYPE zcl_zproj_982_mpc=>ts_header.

   DATA: navitem       TYPE STANDARD TABLE OF zcl_zproj_982_mpc=>ts_item WITH DEFAULT KEY.

   DATA: navschedule   TYPE STANDARD TABLE OF zcl_zproj_982_mpc=>ts_schedule WITH DEFAULT KEY,

        END OF ls_order_items,

        ls_item1       TYPE zcl_zproj_982_mpc=>ts_item,

        ls_schedle1    TYPE zcl_zproj_982_mpc=>ts_schedule.



*             Data Declarations


   DATA :   ls_item                    TYPE zcl_zproj_982_mpc_ext=>ts_item,

            lt_item                    TYPE TABLE OF zcl_zproj_982_mpc_ext=>ts_item,

            ls_sch                     TYPE zcl_zproj_982_mpc_ext=>ts_schedule,

            lt_sch                     TYPE TABLE OF zcl_zproj_982_mpc_ext=>ts_schedule,

            ls_header                  TYPE zcl_zproj_982_mpc_ext=>ty_header,

            lthead                     TYPE STANDARD TABLE OF bapiekkol,

            lshead                     TYPE bapiekkol,

            lsitem                     TYPE bapiekpo,

            ltitem                     TYPE STANDARD TABLE OF bapiekpo,

            lv_filter_str              TYPE string,

            lt_filter_select_options   TYPE /iwbep/t_mgw_select_option,

            ls_filter                  TYPE /iwbep/s_mgw_select_option,

            ls_filter_range            TYPE /iwbep/s_cod_select_option,

            ls_expanded_clause1        LIKE LINE OF           et_expanded_tech_clauses,

            ls_expanded_clause2        LIKE LINE OF           et_expanded_tech_clauses,

            lv_ebeln                   TYPE ebeln,

            lt_order_items             LIKE TABLE OF ls_order_items,

            ltsch                      TYPE STANDARD TABLE OF bapieket,

            lssch                      TYPE bapieket.



*             Entity Set - HeaderSet


   CASE iv_entity_set_name.

     WHEN 'HeaderSet'.

       LOOP AT it_filter_select_options INTO ls_filter.


         LOOP AT ls_filter-select_options INTO ls_filter_range.

           TRANSLATE ls_filter-property TO UPPER CASE.

           CASE ls_filter-property.

             WHEN 'PONUMBER'.

               lv_ebeln = ls_filter_range-low.

             WHEN OTHERS.

               " Log message in the application log



                   iv_msg_type   = 'E'

                   iv_msg_id     = '/IWBEP/MC_SB_DPC_ADM'

                   iv_msg_number = 020

                   iv_msg_v1     = ls_filter-property ).

               " Raise Exception

               RAISE EXCEPTION TYPE /iwbep/cx_mgw_tech_exception


                   textid = /iwbep/cx_mgw_tech_exception=>internal_error.






*             Call Method-BAPI_PO_GETDETAIL





           purchaseorder     = lv_ebeln

           items             = 'X'

           schedules         = 'X'


           po_header         = lshead

*         PO_ADDRESS        =


*         PO_HEADER_TEXTS   =

           po_items          = ltitem

           po_item_schedules = ltsch.


*             Fill Header Values to Deep Structure


       ls_order_items-ponumber = lshead-po_number.

       ls_order_items-ccode = lshead-co_code.

       ls_order_items-doctype = lshead-doc_type.


*             Fill Item values to Deep Structure


       LOOP AT ltitem INTO lsitem.

         CLEAR ls_item1.

         ls_item1-ponumber = lsitem-po_number.



             input  = ls_item1-ponumber


             output = ls_item1-ponumber.


         ls_item1-poitem = lsitem-po_item.

         ls_item1-material = lsitem-material.

         APPEND ls_item1 TO ls_order_items-navitem.



*             Fill Schedule values to Deep Strcture


       LOOP AT ltsch INTO lssch.

         CLEAR ls_item1.

*        ls_item1-ponumber = lsitem-po_number.

         ls_schedle1-poitem = lssch-po_item.

         ls_schedle1-serial = lssch-serial_no.

         APPEND ls_schedle1 TO ls_order_items-navschedule.



*             Assign the Navigation Proprties name to Expanded Tech clauses


       ls_expanded_clause1  = 'NAVITEM'.

       ls_expanded_clause2  = 'NAVSCHEDULE'.

       APPEND ls_expanded_clause1 TO et_expanded_tech_clauses.

       APPEND ls_expanded_clause2 TO et_expanded_tech_clauses.


*             Append Deep Strcture Values to Final Internal Table


       APPEND ls_order_items TO lt_order_items.



*             Send back Response to Consumer





           is_data = lt_order_items


           cr_data = er_entityset ).






Coding Part Done....Lets move to Testing


Test Case 1:


URI : /sap/opu/odata/sap/ZPROJ_982_SRV/HeaderSet?$filter=PoNumber eq '4500000163'&$expand=NavItem


Test Case 2:


URI : /sap/opu/odata/sap/ZPROJ_982_SRV/HeaderSet?$filter=PoNumber eq '4500000163'&$expand=NavItem,NavSchedule




For Expand Entity :-


From the modelling point of view there wont be any changes

but in DPC we need to Redefine the method /iwbep/if_mgw_appl_srv_runtime~get_expanded_entity.

Also there would be a small change in Code , Like Below



*             Deep Structure


   DATABEGIN OF ls_order_items.

   INCLUDE       TYPE zcl_zproj_982_mpc=>ts_header.

   DATA: navitem       TYPE STANDARD TABLE OF zcl_zproj_982_mpc=>ts_item WITH DEFAULT KEY.

   DATA: navschedule   TYPE STANDARD TABLE OF zcl_zproj_982_mpc=>ts_schedule WITH DEFAULT KEY,

        END OF ls_order_items,

        ls_item1       TYPE zcl_zproj_982_mpc=>ts_item,

        ls_schedle1    TYPE zcl_zproj_982_mpc=>ts_schedule.




           is_data = ls_order_items


           cr_data = er_entity).

Hope this Blog now helps you to implement Expand Entity/Entityset

Waiting for your feed back and suggestions and more questions



Uploading Files to SAP GW, Downloading Files from SAP GW - New Techniques



Recently, I had time to revise my solution for uploading and downloading files using SAP gateway. I discovered some new techniques and improvements mainly here in SCN, I would like to share with you solution based on these findings. So thanks for all contributions and I hope I mentioned them all here in this blog post.

Most credits go to Jan Thomas Nygaard for his blog post How To Upload and Download Files Using SAP NW Gateway SP06 which became my most used bookmark in browser.


New techniques

These are the techniques I would like to share:

  • code based implementation
  • using two entities, separation of media and non-media data
  • sending key parameters to media entity through navigation property
  • storing XSTRING in SAP
  • supplying file name in response for browser



Steps to get it done

1. Code based implementation

Based on How to Develop a Gateway Service using Code based Implementation, I wrote blog post how to create project called ZSA_USERS and how to prepare entity User which can be accessed via oData service and can handle operations CREATE, GET, PUT, DELETE also with code snippets. So this is a prerequisite before we continue with creating media entity.


2. Two entity - creating media entity

In order to avoid sending too many parameters (via header parameters or slug header) into Media entity during file upload, let's divide entities. As in the example non-media entity stores all data about user, while media entity stores all relevant file data. This approach is based on suggestion by Ron in following discussion How to pass arguements to CREATE_STREAM?


Entity User is backed by db table zsa_users.



Now same way as we created entity user, we are going to create entity UserPhoto. UserPhoto is backed by db table zsa_photos. Do not forget to set UserPhoto as media collection.





Also do not forget to (re)generate runtime objects, rather more time than never.


3. Creating association between entities

The reason behind this approach is that it is not possible to access to the key parameters when uploading file in CREATE_STREAM method. Thus, there are a workaround using slug HTTP header or custom HTTP headers to supply the key parameters. My former solution was implemented this way, but I reworked it as following. Again, this suggestion came from discussion Re: How to send additional parameters with file upload by Matt. Now you can see why it is good to follow discussion


Now let's create Associations between User and UserPhoto, cardinatily needs to be 1...N. (1...1 did not work for me, thanks to Krishna for helping me figure that out). I used email as a key in both cases so lets connect them by this key.



Now, there should be a navigation property in User entity called Photo:


This enables us to post file to UserPhoto entity via User entity where we can supply key parameters! It means that after call like this /sap/opu/odata/SAP/ZSA_USERS_SRV/UserSet('john(at)doe.com')/Photo, it_key_tabs will be filled with key email and its value john(at)doe.com.


Again regenerate runtime objects.


4. Redefine USERS_MPC_EXT->define method

This is important step unless you want to get error message "Invalid or no mapping to system data types found" from Gateway. You need to specify mimetype property of your media set. See document with code snippets with implementation. Code snippets for Uploading Files to SAP GW, Downloading Files from SAP GW - New Techniques


5. Redefine CREATE_STREAM and GET_STREAM methods in USERS_DPC_EXT class

You can find those under inherited methods from interface /IWBEP/IF_MGW_APPL_SRV_RUNTIME. Again, check document with code snippets for  implementation. Code snippets for Uploading Files to SAP GW, Downloading Files from SAP GW - New Techniques


I just want to explain some pieces:

  • In order to store XSTRING in SAP, I used DB. According to SAP help, it is possible to store it as rawstring. It is not physically stored in DB, only the reference is. There are several limitations for rawstring and I am not sure how much is the performance affected. Other solution is written in my personal blog post using FM 'SO_DOCUMENT_INSERT_API1', there should be also maybe nicer way how to do it with GOS.
  • supplying file name in response for browser in described in my other blog post Recognizing file name and type in browser after downloading file from Netweaver Gateway. If we don't supply Content-Disposition HTTP response header, browser may see our file with name '$value' which is definitely not wanted.


6. Post you file to GW and download it back

Now we should be able to test the solution in SAP Gateway client using these URI:

POST method: your_service/UserSet('usermail')/Photo

GET method: your_service/UserPhotoSet('usermail')/$value



Once again, thanks go to all contributors mentioned in this blog and also those whom I forgot. Please feel free to comment anything that you find wrong, missing or can be improved. I am looking forward to your feedback, as usual


There is no error handling in the code snippets, take this as a starting point for your implementation.


And keep tuned, I am going to show you how to use this service in UI5


Tips for Creating a Google Apps Script/SAP Gateway Mashup


Having spent the last few month with my head way inside the process to integrate Google docs with an SAP backend through NetWeaver Gateway, I humbly offer a few tips to the blogosphere for anyone wanting to do the same thing. 

SAP Gateway: Use JSON Whenever Possible

This little phrase is your best friend for almost any interaction with SAP Gateway: $format=json.  This will instruct Gateway to send the result of the URI to your application in json format, making it lighter-weight and easily supported by Apps Script. 

But!  You have to know which services will support a json format.  If you decide that your app needs to understand the $metadata endpoint of a particular service, you can't perform a $format=json: there are SAP annotations that require XML to see.  So your Apps Script code may have to deal with parsing both json and XML.  

Luckily, Apps Script has utilities that can handle either case.  To work with json, become familiar with JSON.parse() and JSON.stringify(), highlighted in the Apps Script documentation.  The same with XML - go through the tutorial on using the XML parsing utilities.  If you're smart with how you handle XML, it doesn't have to be too much more complicated than json. 

Google Apps Script: User Interface

If you decide to present a user interface on top of a Google document in your application, you have a couple options.  If the interaction paradigm calls for a user to make a set of decisions before they can interact with the actual editor, it is probably wise to use the UI Service.  If the interaction calls for the user to have some control over continuing use of the editor, think of using the sidebar HTML paradigm

The way I think about it is this: if your user interface has an interaction that is essentially saying "do something about this before you can do anything else", then choose the UI Service.  If your interaction is saying "here are some things you can do with what you're already doing", consider the HTML service.

Whichever paradigm you use, you should consider what you'll need to know.  Both the UI Service and the HTML Service depend on some knowledge of web applications; the UI service is structured and formalized with a well-documented API, while the HTML service is very flexible in what you can present and can include outside scripting libraries.  Both provide ways of handling client as well as server-side actions. 


And if you're using the HTML service, get to know jQuery.  I mean it.  Just go learn it already.


Google Apps Script: Be Thoughtful Using Services

There are a host of options for using Google APIs for common tasks: parsing XML, storing key-value pairs in your documents, calling external web APIs, and manyothers.  They make your life easier.  Know them.

But you should also know that in some cases, using them too frequently can cause issues in your add-on.  I stumbled across that myself when I started receiving an error: "Uncaught ScriptError: Service invoked too many times in a short time: properties rateMax. Try Utilities.sleep(1000) between calls." It took me longer than I'd like to admit to figure out that I was calling the PropertiesService too frequently. 

I wasn't able to find an official document telling me a rate limit for calling Google APIs from within an Apps Script project, so I just went through and really optimized how I was using the PropertiesService. The biggest thing I did was to put my settings into an ordered JSON object, stringify it, and store the entire object as one property. That way, when I would need several things from the properties service I would only have to read it once and then parse out the JSON into the pieces I needed. 

Here's an example of what I mean. I put a number of properties on a single javascript object, and store that single object as a property of the document in my application.


function exampleStoreSettings(){   //Store user settings at some point in your application   //First, a generic object   var userSettings = {};      //A couple of settings. Can really be anything you want, JSON is flexible   userSettings.userName = 'Bob';   userSettings.emailAddress = 'Bob@notreal.com';    userSettings.currentAction = 'READ';   userSettings.allowedActions = 'READ,UPDATE';      //Store the object to the properties service   PropertiesService    .getDocumentProperties()    .setProperty('USER_SETTINGS', JSON.stringify(userSettings)); 
function exampleReadSettings(){   //Read those user settings at a different point in your application      //Pull the JSON from the properties service   var userSettings = JSON.parse(PropertiesService                   .getDocumentProperties()                   .getProperty('USER_SETTINGS')                  );      //Do whatever you want with the individual settings   var userName = userSettings.userName;   var emailAddress = userSettings.emailAddress;   var currentAction = userSettings.currentAction;   var allowedActions = userSettings.allowedActions; 


That's all for now.  Hit me up in the comments or private messages for any questions!

Extending a service using the Gateway Service Builder


In this blog, I will introduce the service extensibility concept that was developed as part of the SP09 development for the SAP NetWeaver Gateway Service Builder.

Motivation: The motivation behind the service extensibility concept was to have a single service URL for both the original service and the new service (which is generated by redefining the original service). This will enable users to redefine a particular service as per the requirements but still access the new redefined service using the URL of the original service.



IW_BEP 200 SP09

Step-by-Step Procedure

Following are the step by step procedures to extend a particular service. I will redefine an original service into a new redefined one and then showcase the service extensibility functionality.


Creation of a “Service with SAP Annotations” or “Service with Vocabulary-Based Annotations” service

Create a new service by redefining the original service

Extend the service while generating the runtime artifacts

Check the service URLs

Creation of a “Service with SAP Annotations” or “Service with Vocabulary-Based Annotations” service

  1. Go to the transaction SEGW and create a new project by clicking on 1.png
  2. Enter the details for the Project, Description, and Generation Strategy. Select project type as “Service with SAP Annotations” or “Service with Vocabulary-Based Annotations” from the drop-down. I have mentioned the project name as “z_srvext_parent” for better comprehension.



     3. Create few entities for this project by right clicking on “Data Model” and selecting “Create Entity”. Or you could also right-click on the “Data Model” and                select the “Import” mechanism to import a data source. I will import a RFC in this example.


     4. I now have the service as follows. Let’s call this the “parent” service.


     5. Generate the Runtime artifacts by clicking on 5.png. In the following dialog Click Continue.


     The runtime artifacts for this “parent” service will be generated.


Create a new service by redefining the original service

  1. Let’s now create a new “Service with SAP Annotations project” and redefine it from the “parent” service. Navigate to the SEGW transaction and create a new service as follows.


     Let’s call this the “child” service.

2. Right Click on the Data Model and select Redefine -> OData Service (GW).


3. In the following wizard, enter the values for the “parent” service and click “Next”.


4. Select the entity of the “parent” service in the next wizard as follows and click on “Finish”.


5. Add another entity to this service by right-clicking on Data Model and selecting Create -> Entity Type.


Add a property for this entity. (I have tried to keep the entities and properties to be as simple as possibleJ). The “child” project now has two entities as shown below.



6. The “child” project now looks like as follows:


The “parent” service appears under the Model References folder.


Extend the service while generating the runtime artifacts

1. Generate the runtime artifacts for this “child” service by clicking on 5.png. The following dialog opens up.


The Overwrite Base/Extended Service under “Service Extension” is by-default unchecked. Once checked, we get the warning “Base service will be inaccessible” and the Technical Service Name and the Service Version fields get filled with the values of the “parent” service that was entered in step 3.


(If the checkbox Overwrite Base/Extended Service is checked, the service extensibility concept comes into play. The service URL of the “parent” service (Z_SERVICEEXT_PARENT) will now be re-directed (i.e. fetch the service details) to the “child” service (Z_SERVICEEXT_CHILD).


2. We will now register this service in the SAP NetWeaver Gateway Hub system. Click on Service Maintenance and select the Hub system and click on Register.


   Click Ok and enter the system alias in the next dialog. Enter the package in the subsequent dialog and click Ok.


3. Register the “parent” service as well by following the same steps as above. Now since we have both the “parent” as well as the “child” services registered, we       can check the service URLs.



Check the service URLs

  1. Navigate to the “parent” service -> Service Maintenance, select the Hub system and click on Gateway Client to check the service details.


   2. In the Gateway Client window, enter the details as mentioned in the picture below and execute to see the service details.



Now, in the metadata of the “parent” service, we can see the two entities associated with the “child” service. This happens because the service URL of the “parent” service gets redirected to the “child” service as the “child” service has extended the “parent” service.


Both the “parent” and the “child” service can be accessed using the URL of the “parent” service.


Hope this post helped you get a perspective on the service extensibility concept in service builder

SAP NetWeaver Application Server ABAP 7.02 SP11 with Gateway SP04 Trial - Ready for SAP Gateway


Last week I blogged about installation of SAP NetWeaver App Server 7.03 SP03 - which can be used (among other things) to develop ABAP objects in Eclipse. Today I took a look at another distribution of SAP NetWeaver which can be used to evaluate another SAP technology – SAP Gateway. By using the Gateway we can expose SAP’s system functionality as REST-based OData (Open Data Protocol) services. So we can share data residing in SAP to external world like other platforms, devices etc to consume it. The Gateway is delivered as add-on to ABAP based NetWeaver system which is available right in this specific distribution. Note that this is on-premise installation which you can put on your machine. Of course there are also cloud based deployments of the Gateway but this is blog is not related to them. Refer to this link to see all the options.



1. Download of NetWeaver ABAP 7.02 SP11 with Gateway 2.0 SP04

2. Installation of the same

3. OData demo application development


Regarding HW and SW I used – please refer to my installation of SAP NetWeaver App Server 7.03 SP03.


1. Download of NetWeaver ABAP 7.02 SP11 with Gateway 2.0 SP04

To get installation files I had to download it from store.sap.com. I searched for: SAP Gateway. Actually I downloaded the installation files some weeks earlier. Today I could not find it at the store. However I believe files are still somewhere out there. Alternatively you can use SCN space SAP NetWeaver Gateway Developer Center which has a links to the installation media: SAP NetWeaver ABAP Trial with SAP NetWeaver Gateway 2.0 (installer). I’m not going to provide the link in here as it doesn’t work at the moment.

As usual once I found my media on SAP store I clicked on Trial version button. This offered me a registration form that I filled up. After this I received email with link to the installation file. See all the registration process in details at my previous blog. That was the file I downloaded:



2. Installation of NetWeaver ABAP 7.02 SP11 with Gateway 2.0 SP04

After unpacking the file to installation folder it had size of 3.9GB. Right after this I downloaded and installed JAVA (jre-7u67-windows-x64.exe, download it from java.com) as it is prerequisite to run SAP installation. I started the installation as itself by executing sapinst.exe file:


I got first screen of installation wizard where I choose that I wish to install: Central System.


Of course obligatory log-off and relog-on of my user:


I accepted license – notice I needed to scroll to very down to get the radio button:


I set master password for all the SAP users that are created during the installation:


Then I got obligatory warning about some of installation criteria that were not met on my system. However it is usually the case while installing demo/trial SAP NetWeaver systems that those warnings can be just ignored. Anyway you have a possibility to revise your parameters in order to remove the warnings and re-execute the checks.


As next I reviewed all the settings (I just changed SID of the system being installed from default ID NSP to NWG, to reflect that it is SAP gateway system and also to distinguish from earlier installed NSP) and kicked off installation phases:


Oooopps while processing phase no 16 I got stuck with following error. I looked that one of DLLs belonging to MaxDB was missing:


I located the reported DLL libSQLDBC77.dll and I put it folder where it was into PATH variable: C:\sapdb\NWG\db\pgm


I got through this issue and the installation continued for while with next phases.

Next issue happened in phase no 21. It appeared to be quite strange one. I reviewed log (there is a View Log button) and seems it had something to do with not maintained DB type in system default profile. So I entered into file c:\usr\sap\NWG\SYS\profile\DEFAULT.PFL and added following line in here:

dbms_type = ada


After that the installation continued and successfully finished:


Meanwhile I installed SAP GUI – version witch wasn’t contained in the installation files but I had it from my previous installation. There it was located under folder:  Frontend&tools\SAP_GUI_for_Windows_7.20_Patchlevel_7_SDN_version_20110701_1428.exe

Once I had my GUII entered the system for first time with DDIC user and password as specified in file: README/welcome.html.



Being logged in the system I set password for user BCUSER in transaction SU01. From now on I used that user to login to the system.


3. OData demo application development

Below I created very simple Read (part of CRUD) operation as service in Gateway. As it is really very simple it does nothing else just lists out users that are created in my newly installed Gateway system. Really notice that mu aim was just to try out it is working instead really focus on what The Gateway system can do. Therefore example is very simple.

First I created Gateway Data Model. I did it in TA SE80 -> GW Data Model.



Here I entered my new Data Model and filled up following pop-up:


Followed by next pop-up:


Now I entered into part where I introduced my Query operation. In my case query performs call of BAPI called BAPI_USER_GETLIST. I hit Search icon and entered the BAPI:


For the BAPI I needed to create mappings. I just highlighted the BAPI on left side and selected “Create Mapping” button:


Here I just selected one field that I was interested in: USERNAME.


I changed mapping for selected field into key field of structure: S_COR_ID-VALUE.


Then I just generated the data model:


Next was to create Consumption Model. This is done again in SE80:


I entered description as well:


Now I added GW Data Model into Consumption one:


I searched for my previously created GW Data Model:


Once I had it I tried to see metadata of my service:


Here it is, URL$metadata is opened in the web browser:


In order to really run the service and get the data I changed URL to following one:$format=xml

So I got six entries:


In order to validate it I ran separately same BAPI (BAPI_USER_GETLIST) in SAP GUI. I got also six entries:


This concludes development of small SAP Gateway service.

In next part of my blog I name few issues I faced while development.

1. First I needed to customize System Alias. This can be done in transaction SPRO -> SAP NetWeaver -> Gateway -> OData Channel -> Configuration -> Connection Settings -> Manage SAP System Alias):



2. I had also an issue with user BCUSER. The thing was that I could not get activated my Data Model. It was caused by wrong developer key of my user. Correct developer key is 14421119653247674476. I found it by a lot of goggling at forum post. I even created forum post for this issue




3. Also if service name, URl etc is for some reason not generated you got to do it manually. Transaction /IWFND/MAINT_SERVICE must be used in here.

4. It may happen that Gateway in your system is not activated. You have to activate it in customizing under following path: transaction SPRO -> SAP NetWeaver -> Gateway -> OData Channel -> Configuration -> Connection Settings -> Activate of Deactivate SAP Gateway.


Where to go next:

SAP Gateway -- knowing all essentials and how to build apps in 5 min

Getting Started with SAP NetWeaver Gateway

Gateway Documentation

Learn Gateway at your own pace

Installing and Configuring SAP NetWeaver Gateway 2.0

PS: This blog is cross published on my personal blog site.

Create Standalone Annotation using SAP Gateway Service Builder


In my previous blog on Annotation, I explained the process to create Annotation from service builder using Vocabulary. But this annotation is very specific to the service and you can not reuse this annotation for other services.


Standalone annotation feature of SAP Gateway enables you to create an annotation model that will be independent in nature and can be assigned to any number of relevant OData services. The advantage you are getting out of this feature is following

  • You will be able to create reusable annotation.
  • You can annotate an existing service externally.


Service Builder tool will help you create an annotation model and assign a service to it. In principle, it is possible to assign mutiple services to an annotation model but service builder supports only one service assignment to an Annotation Model.


This blog will explain how you can create annotation model by referring an existing service and assign this Annotation model to the same referenced service using SAP NetWeaver Gateway Service Builder tool.


This feature is available from SAP Gateway IWBEP SP09.



Step-by-Step Procedure

Following are steps which you need to follow

  • Upload Vocabularies into the Vocabulary Repository
  • Create a Project
  • Import a service for reference
  • Import a vocabulary file
  • Create Annotation
  • Generate Runtime Artifact
  • Access Annotation File

Upload Vocabularies into the Vocabulary Repository

Start the Service Builder by using the transaction SEGW.



To upload a vocabulary file into the Vocabulary Repository in the Service Builder, proceed as follows:

  1. From menu bar choose Extras ->Vocabulary Repository. The central Vocabulary Repository opens and shows a table for displaying the vocabulary ID, version, namespace, and description. Any previously uploaded vocabulary files are displayed here, otherwise the table is empty.UploadVocabulary.png
  2. Change to edit mode and choose Append Row to add a new row to the table.
  3. Enter a unique vocabulary ID for the vocabulary file you want to upload. Version 1 is assigned automatically to the first version of
    the vocabulary file you upload.
  4. Click the Upload icon in the Upload Vocabulary Content column to navigate to the vocabulary file you want to upload. The namespace of the vocabulary file is entered automatically.
  5. Enter a description for the newly uploaded vocabulary file.
  6. Save the changes and choose Enter.


Create a Project

  1. Create a New Project by clicking on 4.jpg


  2. Select Service with Annotation Model for Referenced Servicein order to create standalone annotation model.



Import a service for reference


The Service Reference option provided in the project type "Annotation Model for Referenced Service" helps you to reference a service registered in local BEP registry, so that the data model can be annotated.


  1. Right click of Data Model
  2. Select Import->Service Reference


  3.  In first screen of wizard,  enter technical name and version of  the service.



  4.  On click of 'Next' button, it will show th preview of OData elements this service is having

  5.  Click 'Finish' to import OData elements in Data Model.


Note: The OData artifacts imported in the project are non-editable because the project is only intended to create annotations.


Import a vocabulary file

  • In the edit mode, right click on the Data Model, choose Import->Vocabularyin the resulting menu.
  • The Vocabulary Repository window appears.
  • Select the required vocabulary(s) and click continue.


  • In the Tree view a new folder with the name Vocabularies will be created under the Data Model
    and the vocabularies imported into this folder.

Create Annotation

  1. Select OData element which you want to annotate
  2. Enter term value.



     3.   Click on 'Save' button

Generate Runtime Artifact

  • Click Generate Generate.PNGbutton.

          It will open a dialog box with prefilled values for Annotation provider class(APC) and Annotation Model. These are editable fields and you can change the name.


  • On click of Ok button, APC classes and Annotation Model will get created that you can see in Runtime Artifacts Folder and finally the referenced service will be assigned to the created Annotation Model .
  • APC Code: You can check annotation related code in method DEFINE_VOCAB_ANNOTATIONS( ) of generated APC.APC_class.PNG
  • Maintain Annotation Model: You can see Assignment of the Referenced Service to Annotation Model using transaction /iwbep/reg_vocan.


NOTE: You can reference only one service via Service Builder. However, using the transaction /IWBEP/REG_VOCAN multiple services can be assigned to the annotation model, but this causes an inconsistency as the services referenced via the transaction does not reflect in Service Builder.


Access Annotation File

  • Register the referenced service with Gateway Hub(If not registered). You can use Service maintenance feature of service builder for registration.
  • Load Metadata of the service. For this, click Maintainmaintain.PNGthat will take you to 'Active and Maintain Services' view of Gateway Hub where you can load metadata by clicking LoadMetadata.PNG.
  • Finally you can access annotation file through catalog service using below URL. Gateway  ClientGatewayclient.PNGbutton of service builder will take you to Gateway Client tool having request URI populated. Execute this URL to get annotation.



Note: Annotation file contains reference Uri of all the assigned services.



1.      Similarly if you want to get the reference Uri of annotation file in metadata of the service, it will only be available if you create the reference in the MPC of the service, e.g.

  lo_reference = vocab_anno_model->create_annotation_reference(
= '0001').

c  Hope this helps you understand and create standalone annotation using service builder. I look forward to your feedback.

Unified Inbox in Gateway SP09


The Unified Inbox is a UI5 based inbox that enables the users to get the business tasks from different task providers (for example, Business Workflow, BPM, etc.) in a single inbox. The tasks in Unified Inbox can be viewed in two differently styled views, List and Stream.

List of features in Unified Inbox Gateway SP09


View standard and additional attributes of the business tasks

By default, Unified Inbox displays standard task attributes, such as, title, status, priority, creator of the task, creation date and due date.
The user can view custom attributes in both list and stream view. The custom attributes provide relevant business context information that helps the users to take appropriate steps and decisions on tasks. In stream view, user can also view the custom attributes for all the tasks at once. It also shows task description in normal as well as HTML text format.


List view



Custom attributes in Stream view




Filter and sort the business tasks

The filters in Unified Inbox are used to display a subset of business tasks. A user can filter the task list based on various filter criteria. 
Unified Inbox also provides free text search facility to find a particular task.
The tasks in Unified Inbox can be sorted based on status, task title, priority, creator of the task, start date and due date.




Execute standard and custom actions

User can perform standard as well as custom actions for a business task in Unified Inbox. The standard actions include Claim, Release and Forward.
If the user wants to work on a task, the user can reserve it by choosing the Claim action. By claiming the task, the user becomes the actual owner of the task and the task will disappear from other potential owners' Unified Inbox.
A reserved task can be released by the actual owners of a task if the they do not want to work on it. In this case, the task will become visible again in all potential owners' Unified Inbox.
The Unified Inbox allows the users to forward their tasks to other users to work on.

The custom actions (additional actions specific to particular tasks) help the users to perform additional actions on the tasks without opening the task application. Custom actions can be executed in both list and stream views of Unified Inbox.

Mass execution of standard and custom actions is possible in the list view of Unified Inbox.




Navigation to task application

The task application provides information and functions about the task and the process. It provides a user interface to work on the task. User can navigate to task application from both list and stream views. Navigating to task application for multiple tasks in a single click is possible in list view.



Comments and Attachments

User can view and post comments for a task in stream view of Unified Inbox.
They can see all previously added attachments along with details and add attachments to a task. The user has options to delete or download the attachments.
Note :  Adding an attachment is not possible for Internet Explorer version 9 or below.









A user can create substitution rules to manage their tasks in their absence. Substitution rules can be created for planned or unplanned absences. User can nominate substitutes to work on their tasks on their behalf. They can also accept to take over tasks from other users in case of unplanned absence or during an emergency.

A substitution rule can be created with or without a substitution profile. A substitution profile comprises of specific task classes (group of individual tasks or standard tasks).
If a rule is created with a substitution profile, The specified substitute can then log on and work items of the substituted users are displayed to the substitute in their Unified Inbox with the restrictions resulting from the specified substitution profile. e.g. they will only see work items associated with the particular substitution profile.
If a rule is created without a substitution profile, all the work items of the substituted user will be displayed in the substitute's Unified Inbox.The substituted user has options to enable or disable their substitute from receiving their tasks. A substitution rule can also be deleted.


Manage substitution screen


Create substitution rule window



Portal Integration

Unified Inbox Portal Integration

Portal integration is a solution that offers tight integration of Unified Inbox with SAP NetWeaver enterprise portal technologies to help business users to view and interact with Unified Inbox, tasks directly from the portal.




Unified Inbox configuration procedure

There is a set of SAP defined configuration entries that can be added or modified by the administrator.

The administrator can configure the Unified Inbox user interface to show with or without the application header. By default, the application header is visible. Application header can be set to hidden by configuration if the user wants to use more screen space to view the task list or if they are using lower resolution screens.

The administrator can specify whether the Task Execution Application should be opened in a new window or in the same window as a popup. By default, Unified Inbox opens task execution application in a new window.

SAPUI5 theme for Unified Inbox is also configurable. By default, the theme applied to the Unified Inbox application is sap_goldreflection.

Gateway protection against Cross-Site Request Forgery attacks


Gateway REST services open up the SAP landscape for consumption and operation from clients outside that trusted SAP landscape, including those evil browsers. Evil as we all know, the web cannot be trusted. A critical aspect in the Gateway architecture is therefore to mitigate the impact of web-based security attacks.


Cross-Site Request Forgery (CSRF)

One of the most exploited security vulnerabilities on the web is cross-site request forgery. The essence of a CSRF attack is that a malicious site misleads a trusting site in believing that a transactional request comes with approval of the user. The working of a CSRF attack is as follows: 1) after the user has set up an authenticated session with an application site, 2) the user while still within this authenticated browser session visits a malicious site, and 3) the malicious site tricks the user in sending requests to the application site that are actually constructed by the malicious site. Misleading the trusting site that the request comes with approval from the authenticated and authorized user, while in fact it originates from a malicious site. Hence the name cross-site request forgery.


The success of CSRF attacks depends on 3 factors:

  1. The ability to load malicious javascript code within the authenticated browser session.
  2. The ability to misuse the user authentication to the application site. In most browser/webapplications scenarios the user’s authentication state is maintained in cookies after successful authentication – required to preserve the authenticated state. If the malicious site can lure the user into sending a malicious request from the authenticated browser session, that request will automatically include all cookies including the authentication state. And thus be authorized to the trusting site without the user being aware nor approved the request.
  3. The predictability of the transaction request, so that the malicious site is able to automatically construct a request that will be serviced by the trusting site.

The first factor is common exploited by social engineering. The user is somehow seduced to load javascript code from the malicious site into the current browser session, without the user even be aware. Typical example is to send an email to user with hidden javascript code, and when the user opens it a request is send to malicious site. The protection against this risk are a combination of tooling – mail filters; and educating the users – do not just open any received mail. Although the quality of both security measures increases (yes, users are also more and more aware of the risks on the web), this protection is certainly yet not 100% foolproof.Note that this factor is only present if the consumption of the webservices is via a browser. In case of a native application, and also in case of an embedded browser in native App (e.g. Fiori Client, Kapsel, Cordova), the user cannot visit others sites and have its client context become infected / compromised.The second factor is inherent present in all browsers. Without it, each request send from browser would first need to go through the authentication protocol with the remote webapplication, involving browser redirects, identity stores. And in case of username/password browser logon, the user would have to reenter his/her credentials over and over again. Thus: preserving the authentication state after initial authentication is needed to avoid the processing and elapse time for the authentication protocol handling, and to prevent unhappy users. User-friendliness and security are often in contradiction.


Protection against CSRF attacks: CSRF Token

CSRF protection focusses on the 3rd factor: make sure the request cannot be (automically) predicted and thus constructed. Introduce CSRF Token protection.The essence of CSRF Token protection is that the token is a secret key that is only known to the authenticated browser session and the trusting site, and that the authenticated browser session must include in each modifying request to the trusting site in order to convince the trusting site that the request is coming with consent from the user.CSRF token protection is utilized on modern webapplication platforms, including SAP ICF, Microsoft IIS, …


CSRF protection applied in Gateway

SAP Gateway applies the following protocol to protect against CSRF:

  1. The user opens in browser a session with the Gateway based webapplication, and must first authenticate. This can be via any of the authentication methods: username/password, integrated Windows Authentication, X.509, SAML2, OAuth. After successful authentication, the browser has established an authenticated user-session with this trusting web application.
  2. The webapplication code loaded in the browser (HTML5, JavaScript) invokes HTTP GET requests to the Gateway REST services to retrieve data. The GET request can only be used to retrieve data, not to request a modifying transaction on a Gateway service.
  3. In case the client application wants to execute a transaction via Gateway REST service, it must invoke this via a POST, PUT or DELETE request. To ensure to the trusting Gateway REST service that the transaction request indeed originates from the user through the client application, the request must be signed with a CSRF-Token as secret key only known by the client application context and the Gateway webapplication.
  4. The CSRF-Token must be requested by the client application from the Gateway webservice. This can only be done via a non-modifying HTTP GET request. If the client application needs the CSRF Token for subsequent transactional request(s), it must include header variable X-CSRF-Token with value ‘FETCH’ in a non-modifying HTTP Get request send to the Gateway service. As all browsers enforce same-origin policy, the browser will only send HTTP GET requests issued from resource/code loaded in the browser that has the same origin/domain as the Gateway REST service. When code loaded via another (cross) site tries to send the HTTP GET request, the browser will refuse to send it.
  5. Gateway webservice only serves request to return X-CSRF-Token for non-modifying HTTP GET Request. It is not possible to retrieve the X-CSRF-Token via a modifying HTTP PUT/POST/DELETE action. Reason is that these requests are not subject to same-origin policy, and thus can be issued from code loaded from another domain (note: the essence of JSONP crossdomain handling).
  6. When Gateway receives a non-modifing GET Request with header variable ‘X-CSRF-Token’ equal to ‘FETCH’, it random generates a new token and returns the generated value to the requesting client in the response: via header variable and cookie. As result of same-origin browser policy, cookies can only be read by javascript code originating from the same domain. Malicious code loaded from another domain cannot read the cookie nor header variable. Also the random generated value cannot reasonable be guessed by the malicious code.
  7. The client application reads the CSRF Token from the HTTP GET Response, and includes the value as header parameter X-CSRF-Token in modifying HTTP requests to Gateway webservice. As the token value is also returned in GET ‘FETCH’ response via cookie, the value will also be included as cookie variable in each subsequent request from the client application in the current browser session.
  8. When Gateway receives a modifying request, SAP ICF runtime inspects the request on presence of X-CSRF-Token in both request header as in cookie. If present in both, it next compares the 2 values. Only if present and equal, the modifying request is guaranteed to come from the client application context, and is granted for execution by the Gateway REST service.


Proofing of Gateway CSRF protection

As stated above, a CSRF attack depends on the ability for malicious site to automatically construct a malicious request, that next the user is somehow lured into sending to the trusting site, and that is well-crafted to mislead the trusting site that the request is with the approval of the authenticated user.

The URL, including REST action is typically static; and could reasonable be ‘guessed’. And as same-origin only applies to HTTP GET request, it is also possible to send PUT/POST/DELETE requests that originate from the malicious site. But in order to have SAP ICF and thus Gateway trust and next execute such a transactional request, the request must be signed with the CSRF-Token as secret key in request header + cookie. The browser automatically includes all the cookies in the request. But the request header is not automatically reused/added by the browser, and the malicious code must therefore explicly set it in the XmlHttpRequest. However the CSRF Token value can only be retrieved and read by JavaScript code that originates from the same domain as the Gateway webservice. Not from JavaScript code that originates from another, external domain. Therefore the malicious code cannot reasonable construct a complete transaction request that includes the proper value of CSRF Token in both request header and client cookie. And Gateway is enabled to detect the malicious request as not being legitimate.




Note: this posting is earlier published on my personal but professional blog on Gateway Development subjects / http://wvstrien.blogspot.nl/2014/08/gateway-protection-against-cross-site.html

Gateway Unplugged for Quality Control


Maintaining the Quality Control (QC) Inspection lots is one of the most common tasks for SAP QC business Users. In fact, Transaction QA32 is the most actively used transaction. Many Business APIs for the released QC Inspection details are available on any SAP Netweaver ABAP AS system which includes all SAP business suite application.


Typically QC department has specific tools or applications to capture their analysis data which are updated from multiple labs on the inspection result entry. This is normally done by either one person for all the analysts which causes problems on compliance and limitation on extending usage of SAP/SAP user base.

The Gateway unplugged QC solution helps to overcome the issue on compliance and extending usage of SAP in addition to providing a simple user interface. All this is accomplished with a very simple development platform like SAP Gateway.


SAP Gateway provides the capability to generate content automatically without the need to write any code. A Gateway specific design time tool is offered in the ABAP Development Workbench (transaction SE80) to create Gateway Data Models to design and maintain the content of the service based on existing data sources, such as Remote Function Calls (RFCs), Screen Scraping, and Business Object Repository (BOR) objects. A Consumption Model is then created to expose the content to be consumed as an OData service adhering to REST (Representational State Transfer) based principles.

Information in this document is based on the Generic Channel approach. The OData Channel approach is another means of building and exposing SAP content offered by SAP Gateway that provides developers more control and flexibility.


SAP Gateway allows casual/non-tech users to utilize SAP’s built in algorithms by allowing to access information outside SAP boundaries. It allows business continuity and reduces the burden of business users to understand different technical aspects. It has helped various customers to leverage SAP and other IT investments and brings value on both ROI and productivity.

Browsing All 253 Articles Latest Live