Please also have a look in our OnlineHelp for further information.
Of course, ERPConnect is ready for ASP.NET so you will be able to write really cool web applications with a direct link to SAP R/3.
The following example shows the development process for the ASP.NET/ERPConnect project.
The ERPConnect.dll class library must be added as a reference to the project. The dll will be copied to the bin directory when compiling the project. But you need to add one more dll to your bin directory: librfc32.dll. This one is contained in the rfcsdk provided by the SAP GUI installation (System32 directory).
Attention! The trial version of ERPConnect does not work in a web environment. Please apply for a limited test licence number if you want to use ERPConnect with your ASP.NET project (firstname.lastname@example.org).
ASP.NET Example: Creating a Purchase Order via BAPI
The example below is based on an ASP page that contains several textboxes for the vendor number (txtVendor), the material number (txtMaterial), the quantity (txtQuan), and the plant the vendor should deliver the material to (txtPlant).
Place the following code into the button click event. First of all, we need to establish a connection to the SAP system and create a RFC-Function object (we want to create a purchase order, so we use the BAPI_PO_CREATE BAPI).
The structure PO_HEADER has to be filled in with the following values:
DOC_TYPE -> Order type (NB normal order)
PURCH_ORG -> Purchasing organization
PUR_GROUP -> Purchasing group
DOC_DATE -> Date
VENDOR -> Vendor number
Now the items have to be defined (table PO_ITEMS). All we need is the plant (PLANT) and the material number (PUR_MAT). The values for the quantity (QUANTITY) and the delivery date (DELIV_DATE) must be placed in the table PO_ITEM_SHEDULES.
Now we can execute the BAPI and process the return messages.
The screenshots below show the ASP page and the created purchase order.