-
Hello, thank you for lib. Trying to work with. From discussion #114 found out that I can use .ToDictionary(). It works well, but how to get values from dictionary? Value is not public property. var xx = await RfcCtx.CallFunction("MAIN_FUNC",
Input: f => f.SetField("IV_ID", id),
Output: f => from stuct1 in f.Bind(x1 => x1.GetStructure("STRUCT1")
.MapTable("TABLE1", row => row.ToDictionary())
)
let items = f.Bind(
x1 => x1.GetStructure("STRUCT1")
.MapTable("TABLE2", row => row.ToDictionary())
)
select new { Entries = stuct1, Items = items }
)
.IfLeftAsync(l => throw new Exception(l.Message));
foreach (var entry in xx.Entries)
{
var entryId = entry.TryGetValue("ID") - ???
} |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hi,
This solution should be sufficient in almost all cases when you know the property type of the field. Another - more generic approach is to use the FieldMapper of IRfcRuntime: IRfcRuntime rfcRuntime; // get this from dependency injection
rfcRuntime.FieldMapper.FromAbapValue<string>(dictionary["ID"]).Match(
id =>
{
// do something with the value
},
(left) =>
{
// handle error
}
); Access to IRfcRuntime is possible via IConnection or directly from dependency injection if used. |
Beta Was this translation helpful? Give feedback.
Hi,
as you can see in your screenshot the type of field ID is actually a AbapStringValue. So you can cast the property to access the value:
var id = ((AbapStringValue) r["ID"]).Value;
This solution should be sufficient in almost all cases when you know the property type of the field.
Another - more generic approach is to use the FieldMapper of IRfcRuntime:
Access to IRfcRuntime is possible via IConnection or directly from d…