Add items to IRfcTable

我只是一个虾纸丫 提交于 2019-12-30 05:23:25

问题


I have a function and one of it's parameter is a table (T_ITEMS).

Item of tables is of type/structure Z_ITEM with two fields: Value, Quantity;

How can I add to this table items of type Z_ITEM?

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 );
}

In repo.GetStructureMetadata("Z_ITEMS") I have the structure but when I cast to IRfcStructure variable articol is null.


回答1:


Resolved.

IRfcStructure articol = repo.GetStructureMetadata("Z_ITEMS") as IRfcStructure;

Replaced by

RfcStructureMetadata am = repo.GetStructureMetadata( "Z_ITEMS" );
IRfcStructure articol = am.CreateStructure();


来源:https://stackoverflow.com/questions/4783739/add-items-to-irfctable

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!