Banner Image
Jürgen Bäurle
Projects  ·  Work  ·  Blog  ·  Contact

LINQ to SAP for Visual Studio

In 2008 I developed LINQ to SAP for Theobald Software, a LINQ provider for SAP data sources and a Visual Studio plugin for ERPConnect to visually design SAP interfaces. The Visual Studio plugin provides a Designer and a Code Generator to automatically generate the SAP access layer code.

The SAP objects (such as BAPIs, IDocs, etc.) are simply dragged and dropped into the Designer work area. Complex BAPIs can be simplified so that only the elements that should be filled remain to be addressed in the code generated by the Visual Studio Designer.

The Visual Studio plugin is supported starting from Visual Studio 2008.

The Code Generator always generates a context class, by default named SAPContext. The code example below shows the LINQ query and the execution of the SAP table T001W, which contains all plants for a company. The fields of the table are defined in the Designer. This way the code remains clear and concise; in a best-case scenario, the call is reduced to 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)

Article LINQ to SAP (CodeProject)

Click here to show related blog posts.