Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Conversion of data from String to RAW data

Former Member
0 Kudos

Hi Experts,

I am working ona UPgrade to ECC6.0 project.

The issue I am facing is the program has UNICODE type incompatibitlity while oving data from String to internal table with only field of Raw type.

Basically I am looking for a way to convert either a String or character to RAW data format.

Is there any FM. PLease help.

Rgds

Kishore

9 REPLIES 9

Former Member
0 Kudos

chk this fm..to convert CHAR to RAW

RS_SCRP_FIELDS_CHAR_TO_RAW

0 Kudos

No This function module could not resolve my issue. Let me know if there is any other way.

Rgds

Kishore

Former Member
0 Kudos

Try with this FM CONVERT_FROM_CHAR_SORT_RFW

0 Kudos

No this did not work.Let me know of there is any other way.

Rgds

Kishore

0 Kudos

Hi,

Use CALL FUNCTION 'SCMS_STRING_TO_XSTRING'

EXPORTING

text = <string>

IMPORTING

buffer = <xstring>

EXCEPTIONS

failed = 1

OTHERS = 2.

Thanks,

Shailaja Ainala.

Sandra_Rossi
Active Contributor
0 Kudos

An easy solution found by Dirk Boller () is to use:


data l_string type string.
data l_xstring type xstring.
DATA l_buffer TYPE xstring.

l_string = 'ABCD'.

EXPORT my_data = l_string TO DATA BUFFER l_buffer.
IMPORT my_data TO l_xstring FROM DATA BUFFER l_buffer IN CHAR-TO-HEX MODE.
FREE l_buffer.

* l_xstring will contain hex 4100420043004400 if your system is UTF-16LE

0 Kudos

Hi,

I see that the solution you have given is converting the character value to hexadecimal value.

Here the requirement for me is to convert data from of a character or string type to RAW data format.

PLease check and assist.

Rgds

Kishore

0 Kudos

Should I do everything?

Add the following lines after the block above. Of course, the raw field (abap X type) must be long enough.


DATA rawfield TYPE x LENGTH 10.
rawfield = l_xstring.

0 Kudos

Hello Sandra,

I generally use the table INDX for this : IMPORT / EXPORT to DATABASE. I think this is the easiest solution

BR,

Suhas