Skip to Content
Jan 24, 2011 at 03:49 PM

Add items To IRfcTable


0 down vote favorite

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.