-
-
Notifications
You must be signed in to change notification settings - Fork 45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Incorrect number of arguments supplied for call to method 'Char get_Chars(Int32)' (Parameter 'property') #97
Comments
What does your C# parameter class look like? I would expect it to look something like the following. The array parameter needs to be another object and if it doesn't have a name, the SapName attribute can set it to an empty string.
|
In fact, my service receives REST requests that contain JSON in the body. Later, I transform the JSON into a dynamic object in C# and call
|
SAP RFC functions have strongly-typed input and output parameters. You can't just feed them dynamic wads of data and hope that everything works out. In SAP, the function module will have certain input and output parameters. As described in the documentation, you need map these to C#: https://github.com/huysentruitw/SapNwRfc?tab=readme-ov-file#call-function-with-input-and-output-parameters (or at least all of them you want to use). If you have some random json you need to feed into a SAP RFC function call, you'll need to transform that data into the appropriate parameters for the function and provide a strongly-typed object to hold the result. I can provide more input if you provide a full description of the SAP function module being called (screen shots of the Import, Export, Changing, and Tables tabs would be best). These will define what you need to pass in as parameters and what you will receive back as a response. |
When the object has properties that are arrays of primitive types, an exception with the message "Incorrect number of arguments supplied for call to method 'Char get_Chars(Int32)' (Parameter 'property')" is thrown.
Example of the request
I noticed that the error occurs in the TableField class, when it executes the Apply method, which ends up calling
InputMapper.Apply(RfcInterop interop, IntPtr dataHandle, object input)
.Does SapNwRfc support array of primitive types or is this not part of the project scope?
The text was updated successfully, but these errors were encountered: