Want to become a Vibe Coder? Join Vibe Coding Training here
x
C# Corner
Tech
News
Videos
Forums
Jobs
Books
Events
More
Interviews
Live
Learn
Training
Career
Members
Blogs
Challenges
Certification
Contribute
Article
Blog
Video
Ebook
Interview Question
Collapse
Feed
Dashboard
Wallet
Learn
Achievements
Network
Refer
Rewards
SharpGPT
Premium
Contribute
Article
Blog
Video
Ebook
Interview Question
Register
Login
C# DataTable to IrfcTable (SAP)
WhatsApp
Krishna Murthy
Jan 21
2016
15.8
k
0
0
DataTable dtrfc =
new
DataTable();
RfcConfigParameters rfc =
new
RfcConfigParameters();
rfc.Add(RfcConfigParameters.Name, “mySapName”);
rfc.Add(RfcConfigParameters.AppServerHost, ConfigurationManager.AppSettings[“SAPIP”].ToString());
rfc.Add(RfcConfigParameters.Client, “700”);
rfc.Add(RfcConfigParameters.User, ConfigurationManager.AppSettings[“SAPUSERID”].ToString());
rfc.Add(RfcConfigParameters.Password, ConfigurationManager.AppSettings[“SAPPWD”].ToString());
rfc.Add(RfcConfigParameters.SystemNumber, ConfigurationManager.AppSettings[“SYSTEMNO”].ToString());
rfc.Add(RfcConfigParameters.Language, “EN”);
rfc.Add(RfcConfigParameters.PoolSize, “5”);
rfc.Add(RfcConfigParameters.PeakConnectionsLimit, “10”);
rfc.Add(RfcConfigParameters.ConnectionIdleTimeout, “25000”);
RfcDestination rfcDest = RfcDestinationManager.GetDestination(rfc);
RfcRepository rfcRep = rfcDest.Repository;
IRfcFunction
function = rfcRep.CreateFunction(“ << RFC Name >> ”);
//Get reference to table object
IRfcTable Gt_ReportTable = function.GetTable(“GT_TABLE”);
DataTable dtTable =
new
DataTable();
dtTable = (DataTable) Session[“ << DataTable Object >> ”];
foreach
(DataRow oRow
in
dtTable.Rows)
{
Gt_ReportTable.Append();
Gt_ReportTable.SetValue(“ << Table Field Name >> ”, Convert.ToString(oRow[“ << Field Name >> ”]));
}
IRfcTable POReports = function.GetTable(“IT_Output”);
function.SetValue(“IDATE”, << Date Value >> );
function.SetValue(“MATNR”, ddlpublication.SelectedItem.Value);
function.SetValue(“GT_TABLE”, Gt_ReportTable);
function.Invoke(rfcDest);
int
NumberOfRows = POReports.Count;
DataTable
IrfcTable
C#
Up Next
C# DataTable to IrfcTable (SAP)