How do I connect and retrieve data from SAP in C#?

I need to create a web application in C#. I need to retrieve data from SAP.

I know there are several way to do this and I have heard of the SAP data connector for .Net. Is this the recommended way to access data from SAP in C# or are there a better approach?

I have no knowledge of SAP. What are the other things I need to get started retrieving the data aside from installing the .net. In sql server we need connection string like user name and password. Is this the same with connection strings for SAP?

Thanks in advance.
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Randy DownsOWNERCommented:
Maybe this will help.

example uses the function module RFC_CUSTOMER_GET, which requires that customer data exist in the target SAP System, for example, in IDES.

Connect Code
private void btnSearch_Click(object sender, System.EventArgs e)
// Declare parameters here
SAPProxy1 proxy = new SAPProxy1();
proxy.Connection = SAP.Connector.SAPLoginProvider.GetSAPConnection(this);
// Call methods here
proxy.Rfc_Customer_Get("", txtCust.Text, ref brfcknA1Table1);
// Now update Data Bindings. On WinForms this will be automatic, on  // WebForms call the following line
catch(Exception ex)
// If SAPLoginProvider.GetSAPConnection(this) cannot get a connection, // we might get an error.
// Normally this can be ignored as it will automatically will force a // relogon.

Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
käµfm³d 👽Commented:
There's a way to expose SAP functions via web services, but unfortunately I cannot remember the method (it's been too many years since I've worked with it). Last I recall, the web service bit was an additional component that you needed to have alongside your SAP instance; then it was just a few clicks through the tool to set up the function as a SOAP service. It's probably buried in their documentation somewhere.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.