Skip to content

Commit

Permalink
Merge branch 'master' of github.com:oenning/SharpSapRfc
Browse files Browse the repository at this point in the history
  • Loading branch information
goenning committed Oct 24, 2014
2 parents 8041469 + 6fb7d63 commit 9db5ff7
Showing 1 changed file with 68 additions and 11 deletions.
79 changes: 68 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,31 @@
SharpSapRfc
===========

## How to install
## Two options available

SharpSapRfc comes with two flavors: RFC and SOAP. Both options have the same interface, so you can swap between them with a single line of code. ABAP requiriments are the same for both libraries, just create an RFC-enable Function Module and you're good to go, be it with RFC or SOAP.

## Which one should I use?

To install Sharp SAP RFC, run the following command in the Package Manager Console
We generally recommend RFC protocol because it is faster than SOAP. The main advantage of SOAP is that enables you to publish you application outside your LAN and connect to SAP thought a common protocol (HTTP) combined with a DMZ and Reverse Proxy, for example.

For x86 apps
## How to swap between Plain RFC and SOAP

PM> Install-Package SharpSapRfc.x86
All examples on this document are using Plain RFC (type is **PlainSapRfcConnection**). If you want to use SOAP, just change to **SoapSapRfcConnection**. The configuration file is different for each library. Examples are on the bottom of this document.

## How to install

For Plain RFC x86 apps

PM> Install-Package SharpSapRfc.Plain.x86

For x64 apps
For Plain RFC x64 apps

PM> Install-Package SharpSapRfc.x64
PM> Install-Package SharpSapRfc.Plain.x64

For SOAP

PM> Install-Package SharpSapRfc.Soap

## Why should I use it?

Expand All @@ -33,7 +47,7 @@ int result = function.GetInt("e_result");
You can write:

```C#
using (SapRfcConnection conn = new SapRfcConnection("TST"))
using (SapRfcConnection conn = new PlainSapRfcConnection("TST"))
{
var result = conn.ExecuteFunction("Z_SSRT_SUM", new {
i_num1 = 2,
Expand All @@ -50,7 +64,7 @@ Well, yes, it is.
But what about write this:

```C#
using (SapRfcConnection conn = new SapRfcConnection("TST"))
using (SapRfcConnection conn = new PlainSapRfcConnection("TST"))
{
var customer = new ZCustomer(3, "Some Company", true);
var result = conn.ExecuteFunction("Z_SSRT_ADD_CUSTOMER", new {
Expand Down Expand Up @@ -97,7 +111,7 @@ But because of this class we can work with tables parameters!
Check this out.

```C#
using (SapRfcConnection conn = new SapRfcConnection("TST"))
using (SapRfcConnection conn = new PlainSapRfcConnection("TST"))
{
var result = conn.ExecuteFunction("Z_SSRT_GET_ALL_CUSTOMERS");
var customers = result.GetTable<ZCustomer>("t_customers");
Expand Down Expand Up @@ -129,14 +143,14 @@ public class AirlineCompany
}

//Reading all table entries
using (SapRfcConnection conn = new SapRfcConnection("TST"))
using (SapRfcConnection conn = new PlainSapRfcConnection("TST"))
{
var scarr = conn.ReadTable<AirlineCompany>("SCARR");
Assert.AreEqual(18, scarr.Count());
}

//Reading two fields with where clause
using (SapRfcConnection conn = new SapRfcConnection("TST"))
using (SapRfcConnection conn = new PlainSapRfcConnection("TST"))
{
var scarr = conn.ReadTable<AirlineCompany>("SCARR",
fields: new string[] { "CARRID", "CARRNAME" },
Expand All @@ -145,6 +159,49 @@ using (SapRfcConnection conn = new SapRfcConnection("TST"))
}
```

## Configuration Example

###### Plain RFC
<configuration>
<configSections>
<sectionGroup name="SAP.Middleware.Connector">
<section name="GeneralSettings" type="SAP.Middleware.Connector.RfcGeneralConfiguration,sapnco" />
<sectionGroup name="ClientSettings">
<section name="DestinationConfiguration" type="SAP.Middleware.Connector.RfcDestinationConfiguration, sapnco"/>
</sectionGroup>
</sectionGroup>
</configSections>

<SAP.Middleware.Connector>
<ClientSettings>
<DestinationConfiguration>
<destinations >
<add NAME="TST" USER="bcuser" PASSWD="sapadmin2" CLIENT="001"
LANG="EN" ASHOST="sap-vm" SYSNR="00" />
</destinations>
</DestinationConfiguration>
</ClientSettings>
</SAP.Middleware.Connector>
</configuration>


###### SOAP
<configuration>
<configSections>
<section name="sapSoapRfc" type="SharpSapRfc.Soap.Configuration.SapSoapRfcConfigurationSection, SharpSapRfc.Soap" />
</configSections>

<sapSoapRfc>
<destinations>
<add name="TST-SOAP"
rfcUrl="http://sap-vm:8000/sap/bc/soap/rfc"
wsdlUrl="http://sap-vm:8000/sap/bc/soap/wsdl"
client="001"
user="bcuser"
password="sapadmin2"/>
</destinations>
</sapSoapRfc>
</configuration>

## All Features

Expand Down

0 comments on commit 9db5ff7

Please sign in to comment.