Category Archives: SAP/.NET

Quick fix of .NET compiler error regarding an SAP web reference proxy class

I was trying to compile a .NET project that had a web reference to an SAP web service. The Reference.cs file complained about the following line:
[System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]

The compiler didn’t know what Xml was. It kept giving this error: "An object reference is required for the non-static field". On a whim, I refactored XmlSchemaForm and included using System.Xml.Schema; at the top of the Reference.cs file, and then removed that namespace from all XmlSchemaForm declarations. It worked!

Getting data from SAP into InfoPath/.NET

Many companies use SAP as a data repository as well as SharePoint, and they would like their forms, such as InfoPath forms, to be able to read from SAP, and eventually write back to SAP. The first step is getting the data out of SAP, and to do that, you need to obtain a web service from SAP. In SAP, one can create a BAPI query to get exactly what you want, e.g., columns from the Vendor table, or Vendor details for a specific vendor number. At my client, they created this web service within SAP. We took the WSDL of that webservice and within .NET, created an ASPX page for searching for vendors, and an XML web service to be consumed within InfoPath, once the user has selected a vendor to modify and passed the vendor ID number through a browser parameter, which can be parsed from the InfoPath code-behind. The Vendor table was cached using standard the standar HttpContext.Current.Cache object and the vendor table was stored in a DataTable, which allows partial string queries using the LIKE operator, sorting, etc.

That is the first design strategy and I’ll have more to say on this topic as I learn more. I’m interested in seeing how the BDC could help with this.

Follow

Get every new post delivered to your Inbox.