-
If you create custom sap server and register any (custom) function, you need to create function parameters. Samples show two char parameters (by use of AddChar function from function builder). But how to add table parameter? "AddTable" function from function builder expects an ITable ort type desription but how to create such instance or description? Is there any factory method? How to describe table or structure parameters? |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 2 replies
-
Hello, currently the API to generate types and structures in YaNco is limited to implementations that look up the function definition or a single type definition from the SAP backend. But in case that you would like to create a type description from a existing type in the backend you can create a ITypeDescription using a RfcRuntime instance: var res =
from connection in rfcRuntime.OpenConnection(serverSettings)
from typeDescriptionA in rfcRuntime.GetTypeDescription(connection, "TYPE_A")
from typeDescriptionB in rfcRuntime.GetTypeDescription(connection, "TYPE_B")
select new {TypeA = typeDescriptionA, TypeB = typeDescriptionB};
var types = res.Match(
r => r,
l =>
{
// just to extract the value from the either
l.Throw();
return default;
}); Please note that in this case the type description is hold in a process wide reference by the NW RFC library, so you should create it only once. You can then use the type in AddStructure or AddTable to add a structure or table parameter within the ServerBuilder. But again, I strongly recommend using WithClientConnection as in the example if you need to provide complex function definitions: var serverBuilder = new ServerBuilder(serverSettings)
.WithClientConnection(clientSettings, c => c
.WithFunctionHandler("ZYANCO_SERVER_FUNCTION_1",
cf => cf
.Input(i =>
i.GetField<string>("SEND"))
.Process(Console.WriteLine)
.Reply((_, f) => f
.SetField("RECEIVE", "Hello from YaNco")))) |
Beta Was this translation helpful? Give feedback.
-
Thank you for support and response. Yes, you are right, using WithClientConnection makes live a lot easier. Maybe i should describe why i started this discussion. This means either you describe whole HTTP_POST_FILES function on custom server side (which leads to the problem with missing implementation or factory of ITable interface) or you fetch parameter definitions from backend (as you describe in your answer) and create parameters with correct names on customer server side. Do you have any other idea? Or is there another, less complicated way of doing this? DO you plan to create factories for ITable and / Or structures etc? |
Beta Was this translation helpful? Give feedback.
-
Please have a look at this blog, where KPRO DMS access is implemented with saphttp callbacks: https://dbosoft.eu/de-de/blog/creating-a-sap-dms-library-with-yanco-part-2 We also have a full rest API for SAP DMS that already implements all common use cases like upload of files or management of documents. Just send a mail to [email protected] if this may be helpful for your project. |
Beta Was this translation helpful? Give feedback.
Hello,
currently the API to generate types and structures in YaNco is limited to implementations that look up the function definition or a single type definition from the SAP backend.
The underlying SAP Netweaver RFC library offers many APIs to generate types at runtime, but in practice it is recommended not to use static type definitions for complex types. The main reason is that any change of structures in the ABAP backend will make it incompatible with the structures defined in the rfc server.
SAP only recommends this for caching, but with the recent performance improvements in function metadata lookup, there is not much benefit to doing so.
But in case that you would like to create a …