The standard trial license does not support working in web environments. To test ERPConnect with your ASP.NET project, apply for a test license number at sales@theobald-software.com.
ASP.NET
The following sample shows how to create a purchase order using the BAPI_PO_CREATE. The sample uses an ASP page to enter data for a purchase order, see screenshot below.
privatevoidButton1_Click(objectsender,System.EventArgse){// Set your ERPConnect licenseLIC.SetLic("xxxx");usingvarconnection=newR3Connection(host:"server.acme.org",systemNumber:00,userName:"user",password:"passwd",language:"EN",client:"001"){Protocol=ClientProtocol.NWRFC,};connection.Open();// Create a RFC-Function objectRFCFunctionfunc=connection.CreateFunction("BAPI_PO_CREATE");// Fill header structureRFCStructureHeader=func.Exports["PO_HEADER"].ToStructure();Header["DOC_TYPE"]="NB";Header["PURCH_ORG"]="1000";Header["PUR_GROUP"]="010";Header["DOC_DATE"]=ERPConnect.ConversionUtils.NetDate2SAPDate(DateTime.Now);Header["VENDOR"]=this.txtVendor.Text// Create an ItemRFCTableitems=func.Tables["PO_ITEMS"];RFCStructureitem=items.AddRow();item["PO_ITEM"]="1";item["PUR_MAT"]=this.txtMaterial.Text;item["PLANT"]=this.txtPlant.Text;// Create and fill shedulesRFCTableshedules=func.Tables["PO_ITEM_SCHEDULES"];RFCStructureshedule=shedules.AddRow();shedule["PO_ITEM"]="1";shedule["DELIV_DATE"]=ERPConnect.ConversionUtils.NetDate2SAPDate(DateTime.Now);shedule["QUANTITY"]=Convert.ToDecimal(this.txtQuan.Text);// Exceute BAPI and process return messagesfunc.Execute();this.txtReturn.Text="";this.txtReturn.Text+=func.Tables["RETURN"].Rows[0,"MESSAGE"]+"\r\n";}
Output:
Message: Standard PO created under the number 4500018292