cancel
Showing results for 
Search instead for 
Did you mean: 

Getting marshaling .NET type 0 to RFCTYPE_CHAR

Former Member
0 Kudos

Hi,

Our .NET application makes a standard RFC call (BAPI_ACC_DOCUMENT_POST) to SAP. When the

same call is repeated in a loop, after a couple of calls, we get the following error:

Exception {"System exception thrown while marshaling .NET type 0 to RFCTYPE_CHAR"} System.Exception {SAP.Connector.RfcMarshalException}

InnerException {"Unable to cast object of type 'System.Decimal' to type 'System.String'."} System.Exception {System.InvalidCastException}

This error happens from the .NET connector generated proxy code:

object[]results = null;

results = this.SAPInvoke("Post",new object[] {

DocumentHeader,CustomerCPD,ContractHeader,AccountGl,AccountReceivable,AccountPayable,AccountTax,CurrencyAmount,Criteria,Valuefield,RealEstate,Extension1,Extension2,Return0,PaymentCard,ContractItem });

Does anyone have any idea on why this could be happening? I suspect this is a bug in the SAP .NET connector itself.

Thank you in advance for your help.

Sudha

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

Hi,

I am working on SAP BI 7.0, and i have this error marshaling from RFCTYPE_CHAR to .NET type. Does anybody have any clue on this ?

Your inputs are highly appreciated.

Thanks.

Former Member
0 Kudos

I've got the same error in Bapi_Acc_Document_Post. The solution:

-We have stopped to use a method we constructed using System.Reflection. This method gets the values of members of an 'origin' class and sets these values to the related members of a 'destination' class (members with the same name in both classes), the destination class was a SAPStructure in this case. Doing this manually (without using Reflection) solved our problem.

Please, don't ask why it solved my problem, because i don't know. I`ve seen about this solution in another thread in this forum and don't know where it is.

Former Member
0 Kudos

Hello,

I started getting this exception message today - can anyone provide suggestions for troubleshooting this error message? The error occurs in the SAPInvoke method of the proxy generated code.

Thank you.

Philip

Former Member
0 Kudos

Hi Samudrikam,

how are you doing ?

the type conversion error could possibly be created based on a particular field.

could you check if you can isolate exactly which field is causing the error on the ABAP side / or even on the .NET side

also please verify if the proxy generated is for the latest version of the active rfc / bapi on the target system

with respect,

amit

Former Member
0 Kudos

Hi Amit,

I should have given these details too in my case. All our project binaries were earlier built on Visual Studio 2003 (.Net 1.1). Now we are migrating to VS2k5 (.Net 2.0). And the SAP .Net Connector used is still 1.1

So now when we call the proxy, it gives the mentioned RFCException at run-time. So could you suggest solution for this?

Thanks for your prompt response,

Abhishek

Former Member
0 Kudos

Hi Abhishek,

how are you doing ?

the error you are experiencing at run time is due to a mismatch in assemblies.

2 migrate to vs2k5, you will need to regenerate your proxies from NCo 1.1 to 2.0

it is a one time effort which is definitely worth the trouble for small to medium projects.

if you have a large project [100+ proxies], it is better to get a dedicated box which runs the old config and expose the functionality as web services.

these can then be consumes by your newer applications created with vs2k5

upgrading NCo projects from vs2k3 to vs2k5 does not give you any value for your effort, as you can always consume web services.

with respect,

amit

Former Member
0 Kudos

Hi Sudha,

I have come across the same exception that you have mentioned below. The scenario is also similar.

So if you (or any one else) has found some solution to this, please reply to me.

Thanks in advance,

Abhishek.