<?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: Convert xstring to string (File-Upload) in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/convert-xstring-to-string-file-upload/m-p/5260233#M1214963</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For this kind of convertion use FM &lt;STRONG&gt;HR_KR_XSTRING_TO_STRING&lt;/STRONG&gt; . You will get rid of unwanted # marks when uploading the file.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Marcin&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 11 Mar 2009 13:50:13 GMT</pubDate>
    <dc:creator>MarcinPciak</dc:creator>
    <dc:date>2009-03-11T13:50:13Z</dc:date>
    <item>
      <title>Convert xstring to string (File-Upload)</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/convert-xstring-to-string-file-upload/m-p/5260230#M1214960</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've created a BSP-page to upload a file (types PDF, jpg, doc) and save it with a BO using GOS. Unfortunately I face a problem converting file-content xstring to string using class CL_ABAP_CONV_IN_CE. First I tried method CREATE with default-encoding, but in this case calling method READ raises exception CX_SY_CONVERSION_CODEPAGE. So I tried the following code: There is no exception, but I'm not able to open the saved document in the GOS of the BO. I assume that I'm using a wrong codepage.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; CALL FUNCTION 'NLS_GET_FRONTEND_CP'&lt;/P&gt;&lt;P&gt;      EXPORTING&lt;/P&gt;&lt;P&gt;          langu                       = sy-langu&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;         FETYPE                      = 'MS'&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;      IMPORTING&lt;/P&gt;&lt;P&gt;          frontend_codepage           = lv_codepage&lt;/P&gt;&lt;P&gt;      EXCEPTIONS&lt;/P&gt;&lt;P&gt;         illegal_syst_codepage       = 1&lt;/P&gt;&lt;P&gt;         no_frontend_cp_found        = 2&lt;/P&gt;&lt;P&gt;         internal_or_db_error        = 3&lt;/P&gt;&lt;P&gt;         OTHERS                      = 4.&lt;/P&gt;&lt;P&gt;TRY.&lt;/P&gt;&lt;P&gt;            lv_encoding = lv_codepage.&lt;/P&gt;&lt;P&gt;            cl_abap_conv_in_ce=&amp;gt;create(&lt;/P&gt;&lt;P&gt;              EXPORTING&lt;/P&gt;&lt;P&gt;                encoding    = lv_encoding&lt;/P&gt;&lt;P&gt;                input       = lv_file                            " Type XSTRING&lt;/P&gt;&lt;P&gt;              RECEIVING&lt;/P&gt;&lt;P&gt;                conv        = conv&lt;/P&gt;&lt;P&gt;                   ).&lt;/P&gt;&lt;P&gt;            conv-&amp;gt;read(&lt;/P&gt;&lt;P&gt;              IMPORTING&lt;/P&gt;&lt;P&gt;                data   = file_content                        " Type STRING&lt;/P&gt;&lt;P&gt;                   ).&lt;/P&gt;&lt;P&gt;          CATCH cx_parameter_invalid_range .&lt;/P&gt;&lt;P&gt;          CATCH cx_sy_codepage_converter_init .&lt;/P&gt;&lt;P&gt;          CATCH cx_sy_conversion_codepage .&lt;/P&gt;&lt;P&gt;          CATCH cx_parameter_invalid_type .&lt;/P&gt;&lt;P&gt;ENDTRY.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm looking forward to your hints! &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Greetings&lt;/P&gt;&lt;P&gt;Wolfgang&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Mar 2009 10:26:50 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/convert-xstring-to-string-file-upload/m-p/5260230#M1214960</guid>
      <dc:creator>wolfgang_brunneder</dc:creator>
      <dc:date>2009-03-11T10:26:50Z</dc:date>
    </item>
    <item>
      <title>Re: Convert xstring to string (File-Upload)</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/convert-xstring-to-string-file-upload/m-p/5260231#M1214961</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Check this code..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
DATA &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;convin&amp;nbsp;&amp;nbsp;&amp;nbsp;     TYPE&amp;nbsp;REF&amp;nbsp;TO&amp;nbsp;cl_abap_conv_in_ce,

CALL METHOD cl_abap_conv_in_ce=&amp;gt;create
    EXPORTING
      encoding    = 'UTF-8'
      endian      = 'L'
      ignore_cerr = 'X'
      replacement = '#'
      input       = l_buffer              " Xstring
    RECEIVING
      conv        = convin.

  CALL METHOD convin-&amp;gt;read
    IMPORTING
      data = l_data.                  " String

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Avinash Kodarapu on Mar 11, 2009 4:04 PM&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Mar 2009 10:34:34 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/convert-xstring-to-string-file-upload/m-p/5260231#M1214961</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-03-11T10:34:34Z</dc:date>
    </item>
    <item>
      <title>Re: Convert xstring to string (File-Upload)</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/convert-xstring-to-string-file-upload/m-p/5260232#M1214962</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for your promp reply!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Unfortunately your hint does not solve the problem. If I open the saved file in the BO the pdf viewer (acrobat) reports that the file my be damaged!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Debugging my code I found out that the generated string contains quite a lot # signs. I assume that many characters could not be converted and where replaced by #.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Greetings &lt;/P&gt;&lt;P&gt;Wolfgang&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Addition: We are running a unicode-system!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Wolfgang Brunneder on Mar 11, 2009 1:52 PM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Mar 2009 11:40:34 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/convert-xstring-to-string-file-upload/m-p/5260232#M1214962</guid>
      <dc:creator>wolfgang_brunneder</dc:creator>
      <dc:date>2009-03-11T11:40:34Z</dc:date>
    </item>
    <item>
      <title>Re: Convert xstring to string (File-Upload)</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/convert-xstring-to-string-file-upload/m-p/5260233#M1214963</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For this kind of convertion use FM &lt;STRONG&gt;HR_KR_XSTRING_TO_STRING&lt;/STRONG&gt; . You will get rid of unwanted # marks when uploading the file.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Marcin&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Mar 2009 13:50:13 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/convert-xstring-to-string-file-upload/m-p/5260233#M1214963</guid>
      <dc:creator>MarcinPciak</dc:creator>
      <dc:date>2009-03-11T13:50:13Z</dc:date>
    </item>
    <item>
      <title>Re: Convert xstring to string (File-Upload)</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/convert-xstring-to-string-file-upload/m-p/5260234#M1214964</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;May be the codepage retrieval is not correct. You can use this method to get the codepage &amp;amp; use your code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;DATA:
rc TYPE i  VALUE 0,
v_encoding TYPE abap_encoding.

* Get the LOGON Encoding for the particular user
CALL METHOD cl_gui_frontend_services=&amp;gt;get_saplogon_encoding
  CHANGING
    rc                            = rc
    file_encoding                 = v_encoding
  EXCEPTIONS
    cntl_error                    = 1
    error_no_gui                  = 2
    not_supported_by_gui          = 3
    cannot_initialize_globalstate = 4
    OTHERS                        = 5.
IF sy-subrc &amp;lt;&amp;gt; 0 OR
   v_encoding = 0.
  CLEAR v_encoding.
ENDIF.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;BR,&lt;/P&gt;&lt;P&gt;Suhas&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Mar 2009 14:09:04 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/convert-xstring-to-string-file-upload/m-p/5260234#M1214964</guid>
      <dc:creator>SuhaSaha</dc:creator>
      <dc:date>2009-03-11T14:09:04Z</dc:date>
    </item>
    <item>
      <title>Re: Convert xstring to string (File-Upload)</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/convert-xstring-to-string-file-upload/m-p/5260235#M1214965</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for your reply! &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Unfortunately cl_gui_frontend_services=&amp;gt;get_saplogon_encoding doesn't work (sy-subrc = 3) - I assume because I'm working with BSP.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Mar 2009 14:18:09 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/convert-xstring-to-string-file-upload/m-p/5260235#M1214965</guid>
      <dc:creator>wolfgang_brunneder</dc:creator>
      <dc:date>2009-03-11T14:18:09Z</dc:date>
    </item>
    <item>
      <title>Re: Convert xstring to string (File-Upload)</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/convert-xstring-to-string-file-upload/m-p/5260236#M1214966</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Marcin!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your reply! Can you tell me how I can find the correct codepage to pass to the function module? &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; Greetings Wolfgang&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Mar 2009 15:41:38 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/convert-xstring-to-string-file-upload/m-p/5260236#M1214966</guid>
      <dc:creator>wolfgang_brunneder</dc:creator>
      <dc:date>2009-03-11T15:41:38Z</dc:date>
    </item>
    <item>
      <title>Re: Convert xstring to string (File-Upload)</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/convert-xstring-to-string-file-upload/m-p/5260237#M1214967</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Wolfgang,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You don't use any code page here. Just give your XSTRING in input and receive STRING on output. As you read the file byte by byte you don't need to worry about text convertion, as it is read excatly as it appears.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Marcin&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Mar 2009 17:38:29 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/convert-xstring-to-string-file-upload/m-p/5260237#M1214967</guid>
      <dc:creator>MarcinPciak</dc:creator>
      <dc:date>2009-03-11T17:38:29Z</dc:date>
    </item>
    <item>
      <title>Re: Convert xstring to string (File-Upload)</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/convert-xstring-to-string-file-upload/m-p/5260238#M1214968</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Marcin!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've tried your hint, but it doesn't work. But now I found a working solution:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;            cl_abap_conv_in_ce=&amp;gt;create(&lt;/P&gt;&lt;P&gt;              EXPORTING&lt;/P&gt;&lt;P&gt;                encoding    = 'NON-UNICODE'&lt;/P&gt;&lt;P&gt;                endian      = 'L'&lt;/P&gt;&lt;P&gt;              RECEIVING&lt;/P&gt;&lt;P&gt;                conv        = conv&lt;/P&gt;&lt;P&gt;                   ).&lt;/P&gt;&lt;P&gt;            conv-&amp;gt;convert(&lt;/P&gt;&lt;P&gt;              EXPORTING&lt;/P&gt;&lt;P&gt;                input           = fileupload-&amp;gt;file_content     " type xstring&lt;/P&gt;&lt;P&gt;              IMPORTING&lt;/P&gt;&lt;P&gt;                data            = file_content                     " type string&lt;/P&gt;&lt;P&gt;                   ).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your help! I rewarded some points!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Greetings Wolfgang&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Mar 2009 06:17:50 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/convert-xstring-to-string-file-upload/m-p/5260238#M1214968</guid>
      <dc:creator>wolfgang_brunneder</dc:creator>
      <dc:date>2009-03-12T06:17:50Z</dc:date>
    </item>
  </channel>
</rss>

