Question

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.

Was it helpful?

Solution

Resolved.

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

Replaced by

RfcStructureMetadata am = repo.GetStructureMetadata( "Z_ITEMS" );
IRfcStructure articol = am.CreateStructure();
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top