0 Bewertungen0% fanden dieses Dokument nützlich (0 Abstimmungen)
90 Ansichten18 Seiten
Start visual studio 10 C# Windows application. Add following app.config code and c# code. Create sap function module using system.IO; using system.collections.generic.
Start visual studio 10 C# Windows application. Add following app.config code and c# code. Create sap function module using system.IO; using system.collections.generic.
Start visual studio 10 C# Windows application. Add following app.config code and c# code. Create sap function module using system.IO; using system.collections.generic.
Goto vs project reference Add 3 .net dll files Copy all 4 .net dll files paste in exe file location Right click on all reference file, goto properties and set copy property to true Goto project properties change .netframework client to .netframework 4.0 Add following app.config code and c# code Create sap function module
using System; using System.IO; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Configuration; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using SAP.Middleware.Connector; using System.Data.SqlClient;
namespace SAP_Customers1 { public partial class Transfer : Form { public Transfer() { InitializeComponent(); } SqlConnection con; SqlCommand cmd; SqlDataAdapter da; DataSet ds; double hold;
con = new SqlConnection(ConfigurationSettings.AppSettings["mcon"].ToString()); this.Lbl_Clr(); btnlog.Focus(); grvtab.DataSource = this.SqlAccess("SELECT TOP 200 * FROM DO_Table ORDER BY DO_ID DESC"); grvtab.Visible = true; txtreader.Visible = false; }
} } else { lblfechdata2.Text = DateTime.Now + " : No Records Found From sap Sap_table"; }
cmd = new SqlCommand("select SAP_Batch_No,SAP_Location from SAP_Table where SAP_Status='UPD'", con); SqlDataAdapter da = new SqlDataAdapter(cmd); DataSet ds = new DataSet(); da.Fill(ds); RfcDestination dest = RfcDestinationManager.GetDestination("NCO_TESTS");
if (ds != null) { lblfetch.Text = DateTime.Now + " : " + ds.Tables[0].Rows.Count + " Records Found From Sap_Table(SQL)"; foreach (DataRow dr in ds.Tables[0].Rows) { IRfcFunction func = dest.Repository.CreateFunction("ZBAPI_COLLE"); IRfcStructure impStruct = func.GetStructure("ITNEW"); lblsqlfun.Text = DateTime.Now + " : ZBAPI_COLLECT Call Complited(RFC). "; impStruct.SetValue("CHARG", dr["SAP_Batch_No"].ToString()); impStruct.SetValue("LOCATION", dr["SAP_Location"].ToString()); func.Invoke(dest); cmd = new SqlCommand("UPDATE Sap_Table SET SAP_Status ='S' WHERE SAP_Batch_No='" + dr["SAP_Batch_No"].ToString() + "'", con); cmd.CommandType = CommandType.Text; cmd.ExecuteNonQuery(); }
lblsend.Text = DateTime.Now + " : Send " + ds.Tables[0].Rows.Count + " Records to sap From Sql Server"; } else { lblfetch.Text = DateTime.Now + " : No Records Found From SQL Sap_Table"; }