By Philippe Leefsma
I’ve been in the past few months playing around with a recent technology from SAP, the market and technology leader in business management software, that they called SAP NetWeaver Gateway.
The main idea is to provide a framework and a set of tools that will allow programmers to develop applications on various platforms, including of course mobile and web, able to connect to an SAP backend system without the need to be an SAP expert.
Here is how SAP themselves define that technology:
SAP NetWeaver Gateway technology provides a simple way to interact with SAP applications through variety of devices, environments and platforms based on market standards. The framework enables development of innovative, people-centric solutions that bring the power of SAP business software into new experiences, such as: social networking and collaboration environments; mobile and tablet devices; and rich internet applications. The framework supports rapid innovation while ensuring security, integrity, management and optimized maintenance of the core SAP systems. Completely flexible, the software offers connectivity to SAP applications using any programming language or model without the need for SAP knowledge by taking advantage of REST services and OData/ATOM protocols.
Below is a very simplified diagram of the concept:

My goal here is not to teach you SAP technologies in general, there are more specialized places for that, but to it’s to illustrate how easy it can be for a programmer with no or little knowledge about SAP to integrate data from an SAP system inside a desktop application such as Autodesk Inventor or AutoCAD. The hard part of the process is to expose your backend system to the NetWeaver Gateway and that requires some SAP skills and knowledge, but once this is achieved, consuming your services from a variety of platforms will be a piece of cake!
In order to let developers investigate the technology, SAP provides a number of sandboxed services that are Gateway ready. I was picking up one among many, the MATERIAL service and created two add-in projects that allow accessing this SAP data from inside Inventor and AutoCAD.
Here is what you need to do in order to start playing with that technology
1 - Sign up for the Gateway services at the SAP NetWeaver Gateway Developer Center
2 - Download and install the SAP NetWeaver Gateway developer tools. As you will see by following that previous link, there are plug-ins for Eclipse, X-Code and Visual Studio. Because I’m developing .Net add-ins for Autodesk desktop products, I only gave a try at the Visual Studio plug-in.
3 - Create a new add-in project, in that example I’m using a C# plug-in for AutoCAD. Select the project item in the solution explorer and right-click on it to let the context menu appear. The SAP plug-in provides a new option “Add SAP Service Reference…”

4 - After clicking on it, a custom dialog will appear allowing you to pick up one or several services available based on the host name you provided. In that case I only select MATERIAL

5 - The NetWeaver plug-in will then generate a few files that are web services wrappers you can start using in your code. You don’t need to worry about the content of those files

6 - The code is pretty straightforward and you will find several examples provided by SAP from the links I point out below. In my case, I was writing two methods GetMaterials that will return a list of n first materials from the database and FilterMaterials that returns materials according to a selection criteria. Both methods are using LINQ in order to perform queries.
//////////////////////////////////////////////////////
// SAP Connector Utility
//
//////////////////////////////////////////////////////
class SapConnector
{
MATERIAL.MATERIAL _service;
KeyValueConfigurationCollection _settings;
//////////////////////////////////////////////////
// Constructor
//
//////////////////////////////////////////////////
public SapConnector()
{
FileInfo fi = new FileInfo(
System.Reflection.Assembly.
GetExecutingAssembly().Location);
string configPath =
fi.DirectoryName + "\\" + "addin.config";
Configuration config =
ConfigurationManager.OpenMappedExeConfiguration(
new ExeConfigurationFileMap {
ExeConfigFilename = configPath },
ConfigurationUserLevel.None);
_settings = config.AppSettings.Settings;
}
//////////////////////////////////////////////////
// Initialize SAP web service
//
//////////////////////////////////////////////////
public void InitializeSAP()
{
string url = "http://gw.esworkplace.sap.com"
+ "/sap/opu/sdata/IWCNT/MATERIAL/";
_service = new MATERIAL.MATERIAL(
new Uri(url));
_service.Credentials = new NetworkCredential(
_settings["SAPLogin"].Value,
_settings["SAPPassword"].Value);
}
//////////////////////////////////////////////////
// Returns list of count materials
//
//////////////////////////////////////////////////
public List<MATERIAL.Material> GetMaterials(
int count)
{
try
{
List<MATERIAL.Material> result =
new List<MATERIAL.Material>();
if (_service == null)
return result;
var query =
(from MATERIAL.Material material in
_service.MaterialCollection
select material).Take(count);
foreach (MATERIAL.Material material in
query)
{
result.Add(material);
}
return result;
}
catch (Exception ex)
{
return null;
}
}
//////////////////////////////////////////////////
// Returns list of filtered materials
//
//////////////////////////////////////////////////
public List<MATERIAL.Material> FilterMaterials(
int count,
string expression,
bool contain)
{
try
{
List<MATERIAL.Material> result =
new List<MATERIAL.Material>();
var query =
(from MATERIAL.Material material in
_service.MaterialCollection
where (contain ?
material.MaterialDescription ==
expression :
material.MaterialDescription !=
expression)
select material).Take(count);
foreach (MATERIAL.Material material in
query)
{
result.Add(material);
}
return result;
}
catch (Exception ex)
{
return null;
}
}
}
Finally, I was adding a bit of UI around those methods, in order to integrate my plug-ins inside Inventor and AutoCAD. Below is a screenshot of the Inventor version:

Here are some links concerning SAP and the NetWeaver Gateway technology:
SAP NetWeaver Gateway
SAP Developer Center
NetWeaver demo on YouTube
NetWeaver Developer Tools
You can download my Inventor and AutoCAD projects with full source code below:
Download AcadSAPConnector