cancel
Showing results for 
Search instead for 
Did you mean: 

How to call rfc with byte[] parameter?

Former Member
0 Kudos

I am building a middleware using SAP.NET connector but Im having a problem with a particular rfc. I am using C# and my problem basically is abut PIDs( persistent instance id, call list id). PIDs are composed of 32 characters(hexstring), 16 bytes in hexadecimal format. (e.g. A42103E78DCAD54A9EB09D5921C76F06). The rfc crm_call_list_get_calls requires a PID input of byte[] datatype (byte[] Iv_Call_List_ID). I've tried converting the hexstring into an array of bytes (C# format) for the said rfc (A42103E78DCAD54A9EB09D5921C76F06----> byte[] PID={0xA4, 0x21, 0x03, 0xE7, 0x8D, 0xCA, 0xD5, 0x4A, 0x9E, 0xB0, 0x9D, 0x59, 0x21, 0xC7, 0x6F, 0x06} but ive been getting the following error:

System exception thrown while marshaling RFCTYPE_XMLDATAto .NET type.

Unhandled Exception: SAP.Connector.RfcMarshalException: System exception thrown while marshaling RFCTYPE_XMLDATAto .NET type. ---> System.Xml.Xsl.XsltException: 'Byte[]' is an invalid QName.

Also a part of the generated code for the same rfc returns an error for missing array initialization.

(public override object CreateNewRow()

{

return new byte[]();

})

Ive modified the code to: return new byte[]{}

and I dont know if it will work for all situations. Please advise.

Thanks in advance.

Message was edited by: Kenny Martinez

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Some Years later I have the same Problem.

As discripet in the post before - first I've got an error in the Method "CreateNewRow()" where the Method wants to return "return new byte[]()". Well I don't know why the .Net-Connector creates that code - but it looks strange to me.

The origin Code is:

/// <summary>

/// Creates an empty new row of type byte[].

/// </summary>

/// <returns>The newbyte[].</returns>

public override object CreateNewRow()

{

return new byte[]();;

}

With Changing that method I've got the same Error as in the post before:

System exception thrown while marshaling RFCTYPE_XMLDATAto .NET type.

Does someone has found a solution for that kind of Problem?