2008

LINQ to SAP for Visual Studio

Theobald Software · .NET · C# · Visual Studio Extension · ERPConnect · DSL Tools

In 2008 I developed LINQ to SAP, a LINQ provider for SAP data sources and a Visual Studio plugin for ERPConnect. SAP objects such as BAPIs, tables and queries are dragged into the designer, which generates the SAP access layer code for C# and VB.NET.

The plugin ships a designer and a code generator. Complex BAPIs can be simplified in the designer, so the generated code only exposes the elements that need filling. Visual Studio 2008 and later were supported.

The generated context class

The code generator always produces a context class, by default named SAPContext. The sample queries the SAP table T001W, which holds all plants of a company. The fields of the table are defined in the designer, so the code stays short. In the best case the call is a single line.

SAPContext dc = new SAPContext("TESTUSER", "XYZ");

var res = from p in dc.T001WList where p.WERKS == "3000" select p;

foreach (var item in res)
  Console.WriteLine(item.NAME1);

Screenshots

The LINQ to SAP designer in Visual Studio
The designer inside Visual Studio.
A BAPI in the LINQ to SAP designer
A BAPI with its import, export and table parameters.
BW cubes in the LINQ to SAP designer
BW cubes in the designer.

Posts about LINQ to SAP