cancel
Showing results for 
Search instead for 
Did you mean: 

got error while trying to execute RFC API from C# .NET

Former Member
0 Kudos

Hello,

I got following error while trying to execute RFC API "RfcCallReceive" from C# .NET

Error : Method's type signature is not Interop compatible

Anybody know what's a problem?

Jigar

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Jigar,

how are you doing ?

can you please expand your description of the error:

the scenario in which it occurred ?

what is the requirement you are trying to fulfill with this piece of code, etc ...

currently it looks like that there could be a SOAP issue with the method invocation, or it could also be the proxy itself .

with respect,

amit

Former Member
0 Kudos

Can you tell me how can i declare RfcCallReceive API in C#?

Former Member
0 Kudos

Sorry for previous post.

I have declared RfcCallReceive in C# as follow:

[DllImport("librfc32.dll", SetLastError=false)]

[SuppressUnmanagedCodeSecurity]

internal static extern int RfcCallReceive(int handle, [MarshalAs(UnmanagedType.LPStr)] string function, [MarshalAs(UnmanagedType.LPArray)] RFC_PARAMETER[] exporting, [MarshalAs(UnmanagedType.LPArray)] ref RFC_PARAMETER[] importing, [MarshalAs(UnmanagedType.LPArray)] ref RFC_TABLE[] tables, [MarshalAs(UnmanagedType.LPStr)] ref string exception);

but still i got error "Object reference not set to an instance of an object."

actually i want to run any BAPI using RFC API. so that'swhy i have to first create Parameters and Tables object and pass it to RFC API. but got continuous error.

Former Member
0 Kudos

The error message 'Object reference not set to an instance of an object' occurs when the exact definiteion is not found on the server side

dependancies :-

1> r/3 permissions for the particular user on that object

2> client number

3> permissions on inherent dependancies

i cannot verify the definition itself, that you will need to check up on.

try a test user with the role permissions of 'sapall' just to check if this is the case.

then retrace to find where the permissions are not in place.

with respect,

amit

Former Member
0 Kudos

Thanks amit

Now my RfCallReceive API run, i am not getting any error while execute this API, but after this API execute, my imports and tables parameter gone to be blank. now what's a problem?

Former Member
0 Kudos

Hi Jigar,

how are you doing ?

glad to help out )

when your import parameters & tables go blank [are cleared], it usually means that they were not populated and saved.

after adding the rows to the tables you need to call the function to save the values to the objects

standard [of type : string, int, etc...] import values do not need to be explicitly saved though

it could just be a usage problem, if not let me know will try to find another solution...

with respect,

amit

Former Member
0 Kudos

Hi, JIgar, What is the cause to you use de RfcCallReceive unsafe function from C#.

In easier and more secure use the SAP.Connector C# APIS, i the warapper to libRFC32 apisIf do you want C# code exaple , please single it must ask for it to me.

Regards

Sergio.