dynamically pass input and output fields #267
Replies: 2 comments
-
I have updated the title to make it better readable. Original title formated: dynamically pass input and output fields through JSON data "function":{
"name":"BAPI_EQMT_DETAIL",
"inputFields":[
{
"fieldName":"EQUIPMENT",
"value":"20000000"
},
{
"fieldName":"FIELDNAME2",
"value":"BNAME"
}
],
"outputFields":[
{
"structureName":"EQUIMASTER",
"fieldName":"EQUIPMENT"
},
{
"structureName":"EQUIMASTER",
"fieldName":"EQUICATGRY"
},
{
"structureName":"EQUIMASTER",
"fieldName":"EQUITYPE"
}
]
}
|
Beta Was this translation helpful? Give feedback.
-
Hello NDayakarChowdary, It's by design that there is no sample for dynamic json input processing. As SAP functions are fixed it doesn't make much sense to build them fully generic from the input side. For output it may make sense for generic logging, there is a sample here: YaNco/test/SAPSystemTests/Program.cs Line 410 in c1070b3 However even in this case I recommend to to explicit mapping of all fields from SAP instead of a fully dynamic call. Best Regards, |
Beta Was this translation helpful? Give feedback.
-
dynamically specifying input and output fields through JSON data.
// Currently facing challenges with the CallFunction method and mapping structures dynamically.
// Would appreciate documentation or examples demonstrating the correct usage in such scenarios.
using Dbosoft.YaNco;
using LanguageExt.ClassInstances;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
var settingsJson = @"
{
""ashost"": ""SERVER"",
""sysnr"": ""001"",
""client"": ""001"",
""user"": ""userid"",
""passwd"": ""Password"",
""lang"": ""EN""
}";
// Deserialize JSON into a dictionary
var settings = JsonConvert.DeserializeObject<Dictionary<string, string>>(settingsJson);
var connectionBuilder = new ConnectionBuilder(settings);
var connFunc = connectionBuilder.Build();
using (var context = new RfcContext(connFunc))
{
}
input and output would dynamically pass through Json input ,have multiple setfeilds/getfields
Beta Was this translation helpful? Give feedback.
All reactions