cancel
Showing results for 
Search instead for 
Did you mean: 

Error - while marshaling .NET type 0 to RFCTYPE_CHAR

Former Member
0 Kudos

Folks,

I have a simple .NET program that calls BAPI_MATERIAL_SAVEDATA. I have verified that the parameters being passed are correct. However, when I make a call to this BAPI, I get an exception about marshaling .NET type 0 to RFCTYPE_CHAR. When I look at the inner exception, the exception is thrown from SAP.Connector.Rfc.RfcMarshal.NetFieldToRfcField() method. The internal message says - unable to cast System.Decimal to System.String.

I don't understand why we are getting this error. I don't even understand why NetFieldToRfcField does a blind cast. I would appreciate it if anyone has an insight on how to fix this problem.

Thank you in advance for your help.

Regards,

Sheetal

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Sheetal,

below you see the .NET code for serializing between SAP and .NET for a Decimal property field.



*[RfcField(AbapName = "/XX/XXXXX", RfcType = RFCTYPE.RFCTYPE_BCD, Length = 9, Length2 = 9, Decimals = 3, Offset = 83, Offset2 = 166)]*
[XmlElement("_-XX_-XXXXX", Form=XmlSchemaForm.Unqualified)]
public Decimal Xxx_xxxx
{ 
    get
    {
       return xxx_xxxx;
    }
    set
    {
       xxx_xxxx = value;
    }
}

if this won't help you, please explain in detail or provide us the source code.

Cheers, Norbert

Former Member
0 Kudos

This message was moderated.