In my C# application I am making a call to an SAP RFC, which returns the binary format of a pdf (the associated type in SAP is HRB2A_TAB_RAW255).
However, when I read the returned data in C#, it is a string data type - "255044462D312E330D0A25E2E3CF...etc".
Response.Binarywrite needs a byte array, not a string representation of binary data.
How can I use that block of binary data when it comes over as a string data type?
======================================
UPDATE 2: Finally, I got it to work.
Since each row is a 255 byte array, I use Array.Copy to create one single row where the number of elements = 255 * rows returned from SAP
IRfcFunction uploadFile = rfcrep.CreateFunction("ZTEST_BOL");
IRfcTable fileBin = uploadFile.GetTable("BIN");
uploadFile.SetValue("SHIPMENT_NO", "701324577");
uploadFile.Invoke(dest);
int len;
byte binary = new byte[255 * fileBin.RowCount + 1];
for (int i = 0; i <= fileBin.RowCount - 1; i++)
{
fileBin.CurrentIndex = i;
if(i==0)
{
Array.Copy(fileBin.CurrentRow.GetByteArray("CONTENT"), 0, binary, 0,
fileBin.CurrentRow.GetByteArray("CONTENT").Length);
len = fileBin.CurrentRow.GetByteArray("CONTENT").Length;
}
else
{
Array.Copy(fileBin.CurrentRow.GetByteArray("CONTENT"), 0, binary, len,
fileBin.CurrentRow.GetByteArray("CONTENT").Length);
len += fileBin.CurrentRow.GetByteArray("CONTENT").Length;
}
}
System.IO.File.WriteAllBytes(@"C:\Projects\hello.pdf", binary);