将项目添加到IRfcTable项目、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_I...

我有一个功能,它的一个参数是一个表(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();
阅读全文

相关推荐

最新文章