将项目添加到IRfcTable [英] Add items to IRfcTable

查看:1125
本文介绍了将项目添加到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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆