<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Converting xstring to string and back? in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/converting-xstring-to-string-and-back/m-p/4416410#M1049200</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Victor,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try this code...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;REPORT yh_sample.
DATA: w_s TYPE string.
DATA: w_s1 TYPE xstring.
DATA: lr_conv_ci TYPE REF TO cl_rpe_convert .

CREATE OBJECT lr_conv_ci.

w_s1 = '42'.
CALL METHOD lr_conv_ci-&amp;gt;xstring_to_string
  EXPORTING
    input  = w_s1
  IMPORTING
    output = w_s.
WRITE:/ w_s.

CALL METHOD lr_conv_ci-&amp;gt;string_to_xstring
  EXPORTING
    input  = w_s
  IMPORTING
    output = w_s1.

WRITE w_s1.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Indu&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 04 Sep 2008 13:02:22 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-09-04T13:02:22Z</dc:date>
    <item>
      <title>Converting xstring to string and back?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/converting-xstring-to-string-and-back/m-p/4416404#M1049194</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello, everybody&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a problem where I have an ID for an element that is made of 32 hexadecimal elements (hence a size 32 xstring). I need to use it in another system which requires a shorter parameter, but of type string. Therefore, I came to the conclusion that converting my xstring to a string I could turn it into a smaller element than making a simple "one-to-one" conversion (for example, converting 'AF543'  where each element is a Hexadecimal to 'AF543'  where each element is a character).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I looked into the forum and I found the following Function Modules: NLS_STRING_CONVERT_TO_SYS and NLS_STRING_CONVERT_FROM_SYS.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However, when I convert the xstring &lt;STRONG&gt;'00300571B3851DDD9DFFF7A753C08326'&lt;/STRONG&gt;  to a string, I get &lt;STRONG&gt;'#0#q³##Ý#ÿ÷§SÀ#&amp;amp;'&lt;/STRONG&gt;  as a result. I realized that the character # repeats itself several times, although there is no repetition of elements in the xstring. Obviously, when I converted this string back to xstring, I got a different result, because the # character was always interpreted as the same number.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Isn't this conversion supposed to be unique? How could I convert my xstring to a unique string and be able to make the conversion the other way around, getting my original xstring back?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any support will be very appreciated. Thank you in advance.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 04 Sep 2008 12:05:57 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/converting-xstring-to-string-and-back/m-p/4416404#M1049194</guid>
      <dc:creator>VitorSeifert</dc:creator>
      <dc:date>2008-09-04T12:05:57Z</dc:date>
    </item>
    <item>
      <title>Re: Converting xstring to string and back?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/converting-xstring-to-string-and-back/m-p/4416405#M1049195</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Victor,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try these FM,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CRM_IC_XML_STRING2XSTRING : Converts string to xstring&lt;/P&gt;&lt;P&gt;CRM_IC_XML_XSTRING2STRING : Converts xstring to string&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Indu.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 04 Sep 2008 12:12:34 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/converting-xstring-to-string-and-back/m-p/4416405#M1049195</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-09-04T12:12:34Z</dc:date>
    </item>
    <item>
      <title>Re: Converting xstring to string and back?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/converting-xstring-to-string-and-back/m-p/4416406#M1049196</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Link:&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.sapfans.com/forums/viewtopic.php?p=403405&amp;amp;sid=e524cddae19e7ae48a12477e68c6032d" target="test_blank"&gt;http://www.sapfans.com/forums/viewtopic.php?p=403405&amp;amp;sid=e524cddae19e7ae48a12477e68c6032d&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 04 Sep 2008 12:14:22 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/converting-xstring-to-string-and-back/m-p/4416406#M1049196</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-09-04T12:14:22Z</dc:date>
    </item>
    <item>
      <title>Re: Converting xstring to string and back?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/converting-xstring-to-string-and-back/m-p/4416407#M1049197</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;@ Indu: Thank you for the tip, but I couldn't find these Function Modules on my system.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;@ Syed: The solution presented in this link has the same problem I had before: it repeats the # characters on the conversion, therefore the resulting string is not unique.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 04 Sep 2008 12:30:40 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/converting-xstring-to-string-and-back/m-p/4416407#M1049197</guid>
      <dc:creator>VitorSeifert</dc:creator>
      <dc:date>2008-09-04T12:30:40Z</dc:date>
    </item>
    <item>
      <title>Re: Converting xstring to string and back?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/converting-xstring-to-string-and-back/m-p/4416408#M1049198</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;If possible show code.&lt;/P&gt;&lt;P&gt;Adil&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 04 Sep 2008 12:38:48 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/converting-xstring-to-string-and-back/m-p/4416408#M1049198</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-09-04T12:38:48Z</dc:date>
    </item>
    <item>
      <title>Re: Converting xstring to string and back?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/converting-xstring-to-string-and-back/m-p/4416409#M1049199</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This is the code which is not working:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;data: lv_uuid1          type xstring,&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;         &lt;EM&gt;test              type xstring,&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;         &lt;EM&gt;l_out             type string,&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;         &lt;EM&gt;l_out2            type xstring.&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;lv_uuid1 = '00300571B3851DDD9DFFF7A753C08326'.&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;CALL FUNCTION 'NLS_STRING_CONVERT_TO_SYS'&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;  &lt;EM&gt;EXPORTING&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;    &lt;EM&gt;LANG_USED = 'D'&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;    &lt;EM&gt;SOURCE    = lv_uuid1&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;  &lt;EM&gt;IMPORTING&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;    &lt;EM&gt;RESULT    = l_out.&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;write: lv_uuid1, '   ',  l_out.&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;CALL FUNCTION 'NLS_STRING_CONVERT_FROM_SYS'&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;  &lt;EM&gt;EXPORTING&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;    &lt;EM&gt;LANG_USED = 'D'&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;    &lt;EM&gt;SOURCE    = l_out&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;  &lt;EM&gt;IMPORTING&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;    &lt;EM&gt;RESULT    = l_out2.&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;write: / lv_uuid1, '   ',  l_out2.&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Notice that the l_out2 result is not the same as lv_uuid1, what proves that the conversion is not unique.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Vitor Eduardo Seifert Bazzo on Sep 4, 2008 2:42 PM&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Vitor Eduardo Seifert Bazzo on Sep 4, 2008 2:42 PM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 04 Sep 2008 12:40:41 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/converting-xstring-to-string-and-back/m-p/4416409#M1049199</guid>
      <dc:creator>VitorSeifert</dc:creator>
      <dc:date>2008-09-04T12:40:41Z</dc:date>
    </item>
    <item>
      <title>Re: Converting xstring to string and back?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/converting-xstring-to-string-and-back/m-p/4416410#M1049200</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Victor,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try this code...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;REPORT yh_sample.
DATA: w_s TYPE string.
DATA: w_s1 TYPE xstring.
DATA: lr_conv_ci TYPE REF TO cl_rpe_convert .

CREATE OBJECT lr_conv_ci.

w_s1 = '42'.
CALL METHOD lr_conv_ci-&amp;gt;xstring_to_string
  EXPORTING
    input  = w_s1
  IMPORTING
    output = w_s.
WRITE:/ w_s.

CALL METHOD lr_conv_ci-&amp;gt;string_to_xstring
  EXPORTING
    input  = w_s
  IMPORTING
    output = w_s1.

WRITE w_s1.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Indu&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 04 Sep 2008 13:02:22 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/converting-xstring-to-string-and-back/m-p/4416410#M1049200</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-09-04T13:02:22Z</dc:date>
    </item>
    <item>
      <title>Re: Converting xstring to string and back?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/converting-xstring-to-string-and-back/m-p/4416411#M1049201</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;try this FM's&lt;/P&gt;&lt;P&gt;HR_KR_STRING_TO_XSTRING        &lt;/P&gt;&lt;P&gt;Convert unicode string into xstring&lt;/P&gt;&lt;P&gt;HR_KR_XSTRING_TO_STRING        &lt;/P&gt;&lt;P&gt;Convert encoded string to unicode string&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 04 Sep 2008 13:12:04 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/converting-xstring-to-string-and-back/m-p/4416411#M1049201</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-09-04T13:12:04Z</dc:date>
    </item>
    <item>
      <title>Re: Converting xstring to string and back?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/converting-xstring-to-string-and-back/m-p/4416412#M1049202</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;@ Indu: Thank you for the code, but I am still not able to recover my original xstring. This time the resulting xstring is even larger than the one I had before.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;@ Adil: Thank you for the tip, but I can't find these function modules in the system.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 04 Sep 2008 13:18:45 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/converting-xstring-to-string-and-back/m-p/4416412#M1049202</guid>
      <dc:creator>VitorSeifert</dc:creator>
      <dc:date>2008-09-04T13:18:45Z</dc:date>
    </item>
    <item>
      <title>Re: Converting xstring to string and back?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/converting-xstring-to-string-and-back/m-p/4416413#M1049203</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Which system your using.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 04 Sep 2008 13:26:25 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/converting-xstring-to-string-and-back/m-p/4416413#M1049203</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-09-04T13:26:25Z</dc:date>
    </item>
    <item>
      <title>Re: Converting xstring to string and back?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/converting-xstring-to-string-and-back/m-p/4416414#M1049204</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you for all the support. I will stop looking into this issue for now.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Vitor Eduardo Seifert Bazzo on Sep 4, 2008 4:09 PM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 04 Sep 2008 13:27:36 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/converting-xstring-to-string-and-back/m-p/4416414#M1049204</guid>
      <dc:creator>VitorSeifert</dc:creator>
      <dc:date>2008-09-04T13:27:36Z</dc:date>
    </item>
    <item>
      <title>Re: Converting xstring to string and back?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/converting-xstring-to-string-and-back/m-p/4416415#M1049205</link>
      <description>&lt;P&gt;You can refer to below class-method set to convert instead of using unreleased FMs.&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;    " Convert XString to String
*&amp;amp;---------------------------------------------------------------------*
DATA: lv_string TYPE string,
      lv_xstring TYPE xstring.

DATA: lo_conv_in TYPE REF TO CL_ABAP_CONV_IN_CE.

lo_conv_in = CL_ABAP_CONV_IN_CE=&amp;gt;CREATE( input = lv_xstring ).
lo_conv_in-&amp;gt;READ( IMPORTING data = lv_string ).&lt;/CODE&gt;&lt;/PRE&gt;&lt;PRE&gt;&lt;CODE&gt;*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;    " Convert String to XString
*&amp;amp;---------------------------------------------------------------------*
DATA: lo_conv TYPE REF TO cl_abap_conv_out_ce.

lo_conv = cl_abap_conv_out_ce=&amp;gt;create( encoding = '4110' ).
lo_conv-&amp;gt;convert( EXPORTING data   = lv_string
                  IMPORTING buffer = lv_xstring ).&lt;/CODE&gt;&lt;/PRE&gt;&lt;PRE&gt;&lt;CODE&gt;*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;    " Convert XString to Binary
*&amp;amp;---------------------------------------------------------------------*
 data: lt_binary_tab     TYPE solix_tab. " table of solix

      CLEAR: lt_binary_tab.
      lt_binary_tab = cl_document_bcs=&amp;gt;xstring_to_solix(
                      ip_xstring = lv_xstring ).&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 21 Nov 2023 07:32:34 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/converting-xstring-to-string-and-back/m-p/4416415#M1049205</guid>
      <dc:creator>robinthakral</dc:creator>
      <dc:date>2023-11-21T07:32:34Z</dc:date>
    </item>
  </channel>
</rss>

