ASP.net 将Table做为参数传入SAP函数
来源:互联网 发布:关于网络文学社的建议 编辑:程序博客网 时间:2024/06/10 02:18
public static DataTable SetTable(string functionName, Hashtable inputParame,string tableName)
if (functionName == "" || functionName == null)
{
dt = null;
}
else
{
RfcDestination dest = GetRfcDestination();
RfcRepository rfcrep = dest.Repository;
IRfcFunction myfun = null;
myfun = rfcrep.CreateFunction(functionName);
myfun.Invoke(dest);
myfun = rfcrep.CreateFunction(functionName);
if (inputParame.Count > 0)
{
foreach (DictionaryEntry de in inputParame)
{
if (de.Key.ToString().Trim() != "IT_BANK")
{
if (de.Value != null)
{
IRfcTable t_items = myfun.GetTable(de.Key.ToString().Trim());
t_items.Insert();
Hashtable htValue = (Hashtable)de.Value;
foreach (DictionaryEntry de_item in htValue)
{
t_items.CurrentRow.SetValue(de_item.Key.ToString().Trim(), de_item.Value.ToString().Trim());
}
myfun.SetValue(de.Key.ToString().Trim(), t_items);
}
}
else
{
if (de.Value != null)
{
IRfcTable t_items = myfun.GetTable(de.Key.ToString().Trim());
ArrayList list = (ArrayList)de.Value;
for (int i = 0; i < list.Count; i++)
{
t_items.Insert();
IT_Bank it = (IT_Bank)list[i];
t_items.CurrentRow.SetValue("BANKS", it.BANKS);
t_items.CurrentRow.SetValue("BANKL", it.BANKL);
t_items.CurrentRow.SetValue("BANKN", it.BANKN);
t_items.CurrentRow.SetValue("KOINH", it.KOINH);
t_items.CurrentRow.SetValue("BKREF", it.BKREF);
t_items.CurrentRow.SetValue("BKONT", it.BKONT);
}
myfun.SetValue(de.Key.ToString().Trim(), t_items);
}
}
}
}
myfun.Invoke(dest);
IRfcTable myrfcTable = null;
if (tableName != "" || tableName != null)
{
myrfcTable = myfun.GetTable(tableName);//rfc server function 返回值table结构名称
}
if (myrfcTable != null)
{
dt = new DataTable();
int liElement = 0;
for (liElement = 0; liElement < myrfcTable.ElementCount; liElement++)
{
RfcElementMetadata metadata = myrfcTable.GetElementMetadata(liElement);
dt.Columns.Add(metadata.Name);//循环创建列
}
foreach (IRfcStructure dr in myrfcTable)//循环table结构表
{
DataRow row = dt.NewRow();//创建新行
for (liElement = 0; liElement < myrfcTable.ElementCount; liElement++)
{
RfcElementMetadata metadata = myrfcTable.GetElementMetadata(liElement);
row[metadata.Name] = dr.GetString(metadata.Name).Trim();
}
dt.Rows.Add(row);
}
}
}
return dt;
{
DataTable dt = null;if (functionName == "" || functionName == null)
{
dt = null;
}
else
{
RfcDestination dest = GetRfcDestination();
RfcRepository rfcrep = dest.Repository;
IRfcFunction myfun = null;
myfun = rfcrep.CreateFunction(functionName);
myfun.Invoke(dest);
myfun = rfcrep.CreateFunction(functionName);
if (inputParame.Count > 0)
{
foreach (DictionaryEntry de in inputParame)
{
if (de.Key.ToString().Trim() != "IT_BANK")
{
if (de.Value != null)
{
IRfcTable t_items = myfun.GetTable(de.Key.ToString().Trim());
t_items.Insert();
Hashtable htValue = (Hashtable)de.Value;
foreach (DictionaryEntry de_item in htValue)
{
t_items.CurrentRow.SetValue(de_item.Key.ToString().Trim(), de_item.Value.ToString().Trim());
}
myfun.SetValue(de.Key.ToString().Trim(), t_items);
}
}
else
{
if (de.Value != null)
{
IRfcTable t_items = myfun.GetTable(de.Key.ToString().Trim());
ArrayList list = (ArrayList)de.Value;
for (int i = 0; i < list.Count; i++)
{
t_items.Insert();
IT_Bank it = (IT_Bank)list[i];
t_items.CurrentRow.SetValue("BANKS", it.BANKS);
t_items.CurrentRow.SetValue("BANKL", it.BANKL);
t_items.CurrentRow.SetValue("BANKN", it.BANKN);
t_items.CurrentRow.SetValue("KOINH", it.KOINH);
t_items.CurrentRow.SetValue("BKREF", it.BKREF);
t_items.CurrentRow.SetValue("BKONT", it.BKONT);
}
myfun.SetValue(de.Key.ToString().Trim(), t_items);
}
}
}
}
myfun.Invoke(dest);
IRfcTable myrfcTable = null;
if (tableName != "" || tableName != null)
{
myrfcTable = myfun.GetTable(tableName);//rfc server function 返回值table结构名称
}
if (myrfcTable != null)
{
dt = new DataTable();
int liElement = 0;
for (liElement = 0; liElement < myrfcTable.ElementCount; liElement++)
{
RfcElementMetadata metadata = myrfcTable.GetElementMetadata(liElement);
dt.Columns.Add(metadata.Name);//循环创建列
}
foreach (IRfcStructure dr in myrfcTable)//循环table结构表
{
DataRow row = dt.NewRow();//创建新行
for (liElement = 0; liElement < myrfcTable.ElementCount; liElement++)
{
RfcElementMetadata metadata = myrfcTable.GetElementMetadata(liElement);
row[metadata.Name] = dr.GetString(metadata.Name).Trim();
}
dt.Rows.Add(row);
}
}
}
return dt;
}
inputParame传入的参数包含需要传入SAP的表名及表的数据
0 0
- ASP.net 将Table做为参数传入SAP函数
- MS SQL Server 2008 新特性 - User-Defined Table Type 实现将.NET DataTable作为参数传入数据库
- C++.net 定义类 将类对象作为函数参数传入另一个类 出现错误
- 需要DLL函数输出的结果信息,尽量使用传入参数做为输出变量~!
- 如何把多维数组传入函数做为参数之几个方法
- 数组做为函数参数
- 将引用做为传递参数
- asp.net 将table保存为Excle
- asp.net将table写入excel
- 一级指针做为函数参数
- 数组做为参数传入Oracle存储过程操作数据库
- 数组做为参数传入Oracle存储过程操作数据库
- ASP.NET中如何在前端ASP里面调用一个后台方法并传入参数
- .net 如何接受传入参数
- 数组做为参数传递给函数
- 基础备忘:数组做为函数参数
- javascript中函数做为参数的调用
- 函数指针做为参数的例子
- 最小生成树算法
- JSONObject,JSONArray使用手册 .
- Thread.sleep()和Thread.currentThread().sleep()区别
- UVa10305 Ordering Tasks
- xml格式异常-CDATA嵌套
- ASP.net 将Table做为参数传入SAP函数
- jQuery HTML5 uploader
- PowerDesigner逆向工程导入MYSQL数据库总结
- 文言文翻译
- 如果宏安全性设置为“禁用所有宏,并且不通知”,将自动禁用所有宏。使用下列步骤可启用宏。
- EA(Enterprise Architect)修改字体大小
- 字符串与指针
- Cocos2d-x常见问题汇总 第二期
- SMTP POP3 命令