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

Converting xstring to string

Former Member
0 Likes
1,529

Hello Experts,

I am trying to read a survey of a service request in CRM 6.

There is not problem getting the valuexml from the correct survey but when I try to convert to string with Function Module CRM_SVY_DB_CONVERT_HEX2STRING (have also tried FM ECATT_CONV_XSTRING_TO_STRING) the returned string contains nothing more then chinese and japanese characters. If I use the xml browser in the debugger the xml is displayed correctly (I assue it converts the asian characters to xml somehow) but I cannot work with the string.

So my question is: has this happen to anyone of you? And what did you do to fix it?

The survey is made entirely in English (UK), the system language is English, can there be some translation function somewhere causing this?

I have tried it from different workstations so it is not my local settings anyway.

1 ACCEPTED SOLUTION
Read only

daniel_kaoro
Product and Topic Expert
Product and Topic Expert
0 Likes
962

Hello,

The function module 'CRM_SVY_DB_CONVERT_HEX2STRING' does not do any code page conversion.

That is you must execute the code page conversion additionally into the system code page. For this purpose you must know in which Encoding the XSTRING is. If the XSTRING is encoded for example in UTF8, you could call the method 'XCONVCP_UTF82SYST' of the class 'CL_SURVEY_TOOLKIT' BEFORE the call of the function module 'CRM_SVY_DB_CONVERT_HEX2STRING'.

I think this should resolve the issue.

Regards,

Daniel.

3 REPLIES 3
Read only

daniel_kaoro
Product and Topic Expert
Product and Topic Expert
0 Likes
963

Hello,

The function module 'CRM_SVY_DB_CONVERT_HEX2STRING' does not do any code page conversion.

That is you must execute the code page conversion additionally into the system code page. For this purpose you must know in which Encoding the XSTRING is. If the XSTRING is encoded for example in UTF8, you could call the method 'XCONVCP_UTF82SYST' of the class 'CL_SURVEY_TOOLKIT' BEFORE the call of the function module 'CRM_SVY_DB_CONVERT_HEX2STRING'.

I think this should resolve the issue.

Regards,

Daniel.

Read only

Sandra_Rossi
Active Contributor
962

This problem is quite common, it implies code conversion, search the forum. Briefly, the official way to convert is to use CL_ABAP_CONV_IN_CE class. This class is supplied with documentation.

Read only

Former Member
0 Likes
962

YES,

thank you Daniel that was spot on.