Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I want to read a SAP Table STXL which contains a RAW field and insert into a SQL Server table with type nvarchar.
The Schema suggested converting the RAW into byte[] but how can I convert this to nvarchar ?
Thank you in advance.
Andrew
Have you tried this in your tMap? Create your String output column and use the code below (or similar) to convert the byte[] ....
new String(row1.yourRawByteArray, StandardCharsets.UTF_8)
Hi Rhall_2_0 ,
Thanks for your input. When I tried adding what you've suggested , I get the error message "StandardCharSets cannot be resolved to a variable".
I enclose a picture of what I've attempted - is that what you meant ?
My mistake. You need to give it's full path unless you have previously imported it. To make it easy, just replace with this...
new String(row1.yourRawByteArray, java.nio.charset.StandardCharsets.UTF_8)
One Step further.... thank you.... but I still appears to me to be just raw data rather than the character text.
I can't help you without knowing more about the Raw data. It could just be the wrong character set that is being used in the conversion. I guessed UTF-8. Do you know the original character set? Do you know what the data should look like? Do you know if maybe it has been converted or encrypted? The first thing I would do is look for the correct character set or just try others out if you cannot get the character set.
The solution was not to attempt to read RAW but to use the RFC_READ_TEXT object which would then return the text in an XML DOC structure.
With thanks to Chetan!