本文介绍了将项目添加到IRfcTable的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个功能,它的一个参数是一个表(T_ITEMS)。
I have a function and one of it's parameter is a table (T_ITEMS).
表项的类型/结构Z_ITEM与两个字段:值,数量;
Item of tables is of type/structure Z_ITEM with two fields: Value, Quantity;
我如何添加到类型Z_ITEM这个表的项目?
How can I add to this table items of type Z_ITEM?
我所做的是下面的code:
What I have done is following code:
IRfcFunction fnct = repo.CreateFunction( "MY_FUNCTION" ); IRfcTable t_items = fnct.GetTable( "T_ITEMS" ); foreach( XmlNode oneNode in postdata.Items.SelectNodes( "//articles/article" ) ) { IRfcStructure articol = repo.GetStructureMetadata("Z_ITEMS") as IRfcStructure; articol.SetValue( "Value", oneNode.Attributes[ "value" ].Value ); articol.SetValue( "Quantity", oneNode.Attributes[ "quantity" ].Value ); t_items.Append( articol ); }在repo.GetStructureMetadata(Z_ITEMS)我有结构的,但是当我投来 IRfcStructure变量articol为空。
In repo.GetStructureMetadata("Z_ITEMS") I have the structure but when I cast to IRfcStructure variable articol is null.
推荐答案解决。
IRfcStructure articol = repo.GetStructureMetadata("Z_ITEMS") as IRfcStructure;
按
RfcStructureMetadata am = repo.GetStructureMetadata( "Z_ITEMS" ); IRfcStructure articol = am.CreateStructure();更多推荐
将项目添加到IRfcTable
发布评论