Application Development and Automation 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: 
Read only

Conversion of data from String to RAW data

Former Member
0 Likes
6,760

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

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
Read only

Former Member
0 Likes
3,265

chk this fm..to convert CHAR to RAW

RS_SCRP_FIELDS_CHAR_TO_RAW

Read only

0 Likes
3,265

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

Rgds

Kishore

Read only

Former Member
0 Likes
3,265

Try with this FM CONVERT_FROM_CHAR_SORT_RFW

Read only

0 Likes
3,265

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

Rgds

Kishore

Read only

0 Likes
3,265

Hi,

Use CALL FUNCTION 'SCMS_STRING_TO_XSTRING'

EXPORTING

text = <string>

IMPORTING

buffer = <xstring>

EXCEPTIONS

failed = 1

OTHERS = 2.

Thanks,

Shailaja Ainala.

Read only

Sandra_Rossi
Active Contributor
0 Likes
3,265

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

Read only

0 Likes
3,265

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

Read only

0 Likes
3,265

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.

Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
3,265

Hello Sandra,

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

BR,

Suhas