cancel
Showing results for 
Search instead for 
Did you mean: 

read XML file from FTP using FTP_SERVER_TO_R3

0 Kudos

read XML file from FTP using FTP_SERVER_TO_R3 getting # character in text content data

Sandra_Rossi
Active Contributor

Why # could not be the actual value? # instead of what?

Probably you read it with the wrong code page. What is the original code page of the file? You may read the file in binary mode + BLOB and decode the text using the right code page...

Hi Sandra,

The actual file is not having # character, getting it after reading from FTP server.

"ÿþ<#?#x#m#l# #v#e#r#s#i#o#n#=#"#1#.#0#"# #e#n#c#o#d#i#n#g#=#"#U#T#F#-#8#"<"

I am trying to read XML file from FTP using FTP_SERVER_TO_R3 character mode directly in ABAP, also tried BLOB but not able to decode the text and not able to do XML parse.

The same file from local machine, is working fine.

please suggest.

Thanks

HCG

View Entire Topic
roberto_vacca2
Active Contributor
0 Kudos

Hi.

It seems two bytes for character.

I suggest you put the content of g_t_xml_tab in an xstring field (cv_string).

After that convert this content in a string field (lv_xml_string)

Finally create your file.

Hope to help



  CALL METHOD cl_abap_conv_in_ce=>create
    EXPORTING
      input = cv_string "(Xstring variable WITH XML)
    RECEIVING
      conv  = lr_conv.

  CALL METHOD lr_conv->read
    IMPORTING
      data = lv_xml_string. "(String variable WITH XML ENCODING UTF-8)


* Write new file using UTF-8 encoding


  OPEN DATASET f_filen FOR OUTPUT   IN TEXT MODE ENCODING UTF-8 IGNORING CONVERSION ERRORS.

  CHECK sy-subrc EQ 0.

  TRANSFER lv_xml_string TO f_filen.

  CLOSE DATASET f_filen.