Experiences with SAP Gateway

"My foots always in my mouth i just can't stomach defeet" – Hilltop Hoods

Posts Tagged ‘SAP

Gateway Batch Calls from SAPUI5

leave a comment »

One of the features available with the latest release of the UI Development Toolkit for HTML5 (1.8.4) is the ability to batch multiple OData operations into a single call.

I thought I would share a quick example of how its done.

Below is a code snippet showing how to batch the creation of multiple Contact entities and POST them to SAP Netweaver Gateway. The code is part of a simple applications which displays Contacts retrieved from a Gateway OData call in a Table Control. The application has a button ‘Batch Save’, when the button is pressed the function below is called, on completion of the $Batch operation the Table Control shows the new Contact Entities.  The code also shows how easy it is to deep insert a second entity (CREATE_DEEP_ENTITY), Contact_Status represents a separate Entity which has a many to one relationship with the Contact entity.


Here is the HTTP Request, multiple operations wrapped up in a single Multipart MIME message.


And the results of the Gateway callback.

contact_list (1)


Written by rsol1

November 18, 2012 at 6:37 am

Posted in Uncategorized

Tagged with , , , , ,

SAP Netweaver Gateway Client

leave a comment »

I have been using the SAP NetWeaver Gateway 2.0 SP4 Pre-Packaged Trial Version for Linux for a couple of weeks now and one of the things I really like is the SAP Netweaver Gateway Client (trx /IWFND/GW_CLIENT). Very similar in features to the Firefox RESTClient, it allows you to create custom HTTP requests and directly test requests against a Gateway server and this is done within the SAPGui.

The thing that i like the most is the ability to create and re-use Test Cases.

As the SAP Help suggests, it enhances the Error Log

While the Error Log provides you with an overview of detailed context information about errors that have occurred at runtime and enables you to navigate easily to the affected source code, the Gateway Client allows you to reproduce the exact runtime situation that led to a particular error.

In the Error Log (trx /IWFND/ERROR_LOG) you can replay requests in either the Gateway Client or Web Browser.

Written by rsol1

September 19, 2012 at 6:40 am

Posted in Uncategorized

Tagged with , , , ,

How to: Windows 8 and OData Services in a Metro Style Application

leave a comment »

A couple of people have requested that I share how I created my Metro App.

The services I used were created on my SAP Netweaver Gateway system, I have recreated the application to use the ODATA.org Northwind service and use images from the Telerik demo site.

As I said in the original post I used the following  blog as a guideline, recreating the application I found there were a couple of notable differences so I will start from the beginning.

I downloaded Windows 8 Consumer Preview ISO image and then installed it as a WMWare Workstation, then I Installed Visual Studio 11 Premium edition.

Once installed and activated inside VS11  Click File –> Add New Project. Select the Split Application template under JavaScript -> Windows Metro style.

Then install the datajs package, Tools -> Library Package Manager -> Package Manager Console. Type ‘install-package datajs’.

I didn’t install the jquery package

Inside of default.html add a reference to datajs, I found I needed to add it before other references, there are dependencies in data.js to the sequence.

Next create the data.js code. I kept it simple and retained a lot of the code from the template.

In splitPage.html added some of the additional fields

 <h2 class="article-title win-type-ellipsis" data-win-bind="textContent: title"></h2>
 <h3 class="article-subtitle" data-win-bind="textContent: qty">
 <h3 class="article-subtitle" data-win-bind="textContent: price">

And that’s about it.

To get datajs working in Windows 8 with Netweaver Gateway XML OData services I had to make the following change to return window.DOMParser() instead of the ActiveXObject

The end result should look something like this


Written by rsol1

May 20, 2012 at 12:08 pm

Windows 8 Metro Style Apps and Gateway

leave a comment »

Unfortunately I will have to keep this post brief.  Below are some screen shots from my first Windows 8 Metro Style Application consuming SAP Netweaver Gateway data.

At present there are not many examples of how to consume OData in a Metro Style application, even harder to find an example using javascript.

I used the following blog as a guideline


Once I got started it was actually very easy.

I did however have a slight problem getting Datajs to parse Xml, for which I luckily found a simple work around.

My mind isn’t completely made up about Windows 8 development, I think I will have to code a couple more applications first, I will say it is a completely different experience to the other tools and platforms I have been developing on lately, it is very familiar and very simple, which kind of scares me.

Useful Resources:

Writing code for Metro style apps (JavaScript): http://msdn.microsoft.com/en-US/library/windows/apps/hh770842

Data Model: http://msdn.microsoft.com/en-us/library/windows/apps/hh758329.aspx

Asynchronous programming in JavaScript: http://msdn.microsoft.com/en-US/library/windows/apps/hh700330

Debugging apps: http://msdn.microsoft.com/en-US/library/windows/apps/hh441474

Written by rsol1

May 7, 2012 at 12:43 pm

Using Gateway data in Excel 2010 PowerPivot

with one comment

I thought I would quickly show how to use PowerPivot in Excel with data from SAP Netweaver Gateway.

PowerPivot is a free add-in to the 2010 version of the spreadsheet application Microsoft Excel. It extends the capabilities of the PivotTable data summarisation and cross-tabulation feature by introducing the ability to import data from multiple sources. As such, PowerPivot falls under Microsoft’s Business Intelligence offering, complementing it with its self-service, in-memory capabilities [http://en.wikipedia.org/wiki/PowerPivot]

To start with you need to download and install the PowerPivot add-in, you can find it at http://www.microsoft.com/en-us/bi/powerpivot.aspx

Once installed, open up Excel and click PowerPivot tab then PowerPivot Window.

Choose Get External Data -> From Data Feeds

Enter the connection details

Press Advanced button to enter authentication details

Select and import the tables you want to use

Then Create Relationships between the tables

Select PivotTable -> Chart and Table (Horizontal)

From there you can drag the fields you want for the axis and values, in this example Products by count of Orders

This shows how simple it is to start, now you can go further and add slicers and filters etc. or add data from other sources.

Written by rsol1

April 13, 2012 at 1:27 pm

Posted in Uncategorized

Tagged with , , , , ,

Posting to Gateway with SAPUI5

leave a comment »

It has been a while since my last post, been busy building apps on Android.

Anyway thought I would quickly share how easy it is to post to SAP Netweaver Gateway using the SAPUI5 library.


To start with you need to reference the datajs library.


Once you have referenced it, you can use the library to post as follows.

For this example I extended the existing “New Contact” popup form on the Shell layout to capture the needed input, to get the values from the popup I did the following

var firstName = sap.ui.getCore().byId("firstNameTextField").getValue(),
lastName = sap.ui.getCore().byId("lastNameTextField").getValue(),
handle = sap.ui.getCore().byId("handleTextField").getValue(),
email = sap.ui.getCore().byId("emailTextField").getValue(),
status = sap.ui.getCore().byId("statusTextField").getValue();

I then used the values to create the data entry object

var contactEntry = {Handle: handle,
FirstName: firstName,
LastName: lastName,
Email: email,
Status: status};

Declare a variable the service uri

var serviceURI = "http://<host>:<port>/sap/opu/sdata/sap/<service>/Contacts";

Then build a request based on the form data and service uri, making sure you add the applicable XML headers

var request =
{ headers: {"X-Requested-With": "XMLHttpRequest",
"Accept": "application/atom+xml,application/atomsvc+xml,application/xml",
"Content-Type": "application/atom+xml",
"DataServiceVersion": "2.0" },
requestUri: serviceURI,
method: "POST",
user: "developer",
password: "ch4ngeme",
data: contactEntry };

Finally post the request, passing the callback functions
OData.request( request,
function (data) {
//Success Callback
sap.ui.commons.MessageBox.show("New contact saved successfully.", sap.ui.commons.MessageBox.Icon.SUCCESS, "Contact Saved", sap.ui.commons.MessageBox.Action.OK);
function (err) {
//Error Callback:

I am hoping with future releases this can be incorporated into the sap.ui.model.odata.ODataModel

Written by rsol1

April 5, 2012 at 3:34 pm

Posted in Uncategorized

Tagged with , , , ,

SAPUI5 data binding master slave with Gateway services

with 6 comments

Spent the day trying out the SAPUI5 framework, of all the new products and initiatives I saw at SAP TechEd last year, this library (collection) sparked my interest the most, mainly because over the years I have used reluctantly JQuery, DOJO, Prototype, YUI, ExtJS etc. on SAP projects, now there is something supported by SAP I can imagine a lot of that reluctance will disappear .

There is a lot in SAPUI5,  it will take me some time to get familiar and comfortable enough to start using on customer sites, I hope they don’t stop here and there is a lot more features and functionality to come. My first impressions are very positive, for some reason the data binding takes me back to a time before WD4A and after HTMLB, reminding me of the flexibility and freedom of BSP or an early WD4J.

It seems appropriate the first thing I developed with SAPUI5 was a data binding master slave solution, it was the first thing I learnt with WD4J and WD4A , it gives a good perspective of what is possible, next up will be MVC.

I have shared on google code a simple example of master slave data binding, it uses the ODATA.org Northwind service (see pic below) , I got it working with an association, but I also show in the code how it is possible using filters.

Written by rsol1

February 16, 2012 at 3:32 pm

Posted in Uncategorized

Tagged with , , , ,


Get every new post delivered to your Inbox.