huysentruitw / SapNwRfc

SAP NetWeaver RFC library for .NET 5, .NET Core and .NET Framework
MIT License
149 stars 43 forks source link

SAP RFC Error: RFC_CONVERSION_FAILURE with message: PRUEFLOS of type RFCTYPE_NUM cannot be converted to type RFC_INT8 #93

Open wangfei9999 opened 10 months ago

wangfei9999 commented 10 months ago

我想将一个长度为11的数字转为C#的long可惜失败了。我尝试转为字符串类型,实际返回的是’010000522694‘,默认开头追加了0,这不是我预期的结果,我想应该是’10000522694‘,请问我该如何操得到想要的结果。

tom-j-irvine commented 10 months ago

Assuming I'm translating your message correctly, you'll need to parse the value yourself. In SAP and ABAP, the NUMC data type (RFCTYPE_NUM) is character data (string) that is restricted to holding numeric characters. So, after receiving the c# string value, you could use Int64.Parse() or Int64.TryParse() to convert the value to a long, if appropriate.