We are all used to use our mobile devices for daily activities like checking the weather forecast, navigation through cities, booking train tickets and a lot of other stuff. Mobile devices became today’s Swiss knifes.
Therefore employees and managers expect that they can also use their mobile devices in an enterprise environment. But how can you connect your mobile device to data in your SAP ERP system? There is a need for a lightweight interface which is easy to understand for an app developer who doesn’t know anything about SAP and ABAP technology.
SAP’s answer for this is NetWeaver Gateway. With NetWeaver Gateway you can build RESTful web services which expose business data through an OData channel to the outside. Because the OData protocol is an open standard, no special SAP knowledge is needed to consume such a NetWeaver Gateway service.
We at bridgingIT thought about how mobile devices can make field technicians’ daily work easier and developed the solution “PM Radar” which consists of an iPad App, a Windows 8 App and a NetWeaver Gateway service. It combines data from SAP PM with location based information. “PM Radar” is just a template how you can combine easily the context of a mobile device with business data. “PM Radar” shows functional locations on a map depending on the current location of the mobile device. This makes it easy for field technicians to navigate from one technical object to the other. Because we assume that not every company maintains geo information data in its master data “PM Radar” allows it to select a functional location and add its geo information data to the master data in SAP PM.
Developing an SAP NetWeaver Gateway service – our experience
SAP NetWeaver Gateway provides the OData interface to the non ABAP world. There are several possibilities how you can implement the service. We used the OData Channel API to implement our service. NetWeaver Gateway others also the options to generate services based on BOR objects, RFCs, or Screen Scraping, but the OData Channel API is the most flexible. At first we determined which SAP function modules can provide us the data we need from our ERP and which function module we can use to update the data in the ERP. We choose the way using RFC function modules because we didn’t want to code in the ERP system itself. Our NetWeaver Gateway runs on a separate ABAP system. You can also install NetWeaver Gateway on top of your ERP system. But you should think about if you want to connect your ERP system directly to the internet.
As a second step we defined the entity structure and fields we want to expose. Till now, non-SAP developers always struggled with the data structures and field names SAP interfaces offered. In SAP NetWeaver Gateway you can define a mapping of the field names. Internally you use the SAP field names in the ABAP code as usual. But the consumer of the service doesn’t see these names. To the outside you see only the names defined in the mapping. This makes it much easier for non-SAP developers because you can use longer field names as e.g. “CompanyCode” instead of “BUKRS”.
developers because you can use longer field names as e.g. “CompanyCode” instead of “BUKRS”.
Next, we created our ABAP class implementation. Our class inherits from super class /IWBEP/CL_MGW_PUSH_ABS_DATA. In transaction SEGW we assigned our ABAP methods to the corresponding HTTP operation. Finally we redefined the methods we need in our ABAP class and implemented them. In our case we call the RFC function modules in our ERP system in these methods.
Of course, this is a very high level description of how you implement a NetWeaver Gateway service, but it’s no rocket science! If you are familiar with the concept and the tooling, it’s quite easy and fast to develop a service.
For all non-SAP developers it’s really easy to use the generated OData service. There are APIs for several programming languages available and because OData is an open standard there is in general no difference between a NetWeaver Gateway service and any other OData service.
As you can see, SAP NetWeaver Gateway is a lightweight interface. It’s easy to consume these services for any developer who is familiar with RESTful web services. It can not only be used for mobile apps, it can also be used for integration scenarios with desktop clients. It makes life much easier for developers: the ABAP developer doesn’t need to explain the data structure in detail anymore and the non-SAP developer doesn’t need to deal with the ABAP field names. As SAP NetWeaver Gateway is also part of Enterprise DUET and SAP will add an OData channel to many products in future, it’s really worth to get familiar with this tool.