TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
C# Corner
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
C# DataTable to IrfcTable (SAP)
Krishna Murthy
Jan 21
2016
Code
14.9
k
0
0
facebook
twitter
linkedIn
Reddit
WhatsApp
Email
Bookmark
expand
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#