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

GUI_UPLOAD - Problem in uploading xml file

Former Member
0 Likes
2,664

Hi,

I have problem in uploading xml file into itab.

Here is the code

begin of GS_STRING,
        STR(72) type C,
      end of GS_STRING,

      GT_STRING like standard table of GS_STRING,

 call function 'GUI_UPLOAD'
      EXPORTING
        FILENAME                = FILE_NAME
        FILETYPE                = 'ASC'
      TABLES
        DATA_TAB                = GT_STRING
      EXCEPTIONS
        FILE_OPEN_ERROR         = 1
        FILE_READ_ERROR         = 2
        NO_BATCH                = 3
        GUI_REFUSE_FILETRANSFER = 4
        INVALID_TYPE            = 5
        NO_AUTHORITY            = 6
        UNKNOWN_ERROR           = 7
        BAD_DATA_FORMAT         = 8
        HEADER_NOT_ALLOWED      = 9
        SEPARATOR_NOT_ALLOWED   = 10
        HEADER_TOO_LONG         = 11
        UNKNOWN_DP_ERROR        = 12
        ACCESS_DENIED           = 13
        DP_OUT_OF_MEMORY        = 14
        DISK_FULL               = 15
        DP_TIMEOUT              = 16
        others                  = 17.
    if SY-SUBRC <> 0.
      message I499(SY) with 'File upload failed'.
      stop.
    endif.
  endif.

In debuggin mode, i can see the itab uploaded with xml payload. But in that same place, the hexadecimal format has double zeros 00 after each character.

XML message : <?xml

Correct Hexadecimal : 3C3F786D6C

Hexadecimal in itab : 3C003F0078006D006C00

This makes the resultant xml invalid.

can anyone help me to solve this?

Thanks,

Uma

Edited by: Uma Maheswari on May 30, 2008 4:15 PM

7 REPLIES 7
Read only

Former Member
0 Likes
1,443

Try passing codepage while uploading the xml.

I am not sure which code page to try.

thnx,

Ags.

Read only

0 Likes
1,443

Thanks.

After changing the code page, double zeros are removed.

But now, only first 144 characters of xml are present. so again the xml is invalid.

If you have any suggestions, pls let me know

Thanks,

Uma

Read only

0 Likes
1,443

Did you checked with all possible code pages?

One of them will definitely help you in uploading whole XML without those double zeros.

Also try UTF-8.

thnx,

Ags.

Read only

0 Likes
1,443

hi,

I used code page 4103. All double zeros are removed. But the problem was with the size of xml uploaded in itab.

Then, by increasing length of itab string element, the xml uploaded correctly.

My confusion is about varying uploaded xml size w.r.t. codepage changes.

Thanks,

Uma

Edited by: Uma Maheswari on May 30, 2008 6:02 PM

Read only

athavanraja
Active Contributor
0 Likes
1,443

what do you want to do with the uploaded XML?

i use the following


constants: line_size type i value 255.

 data: begin of xml_tab occurs 0,
           raw(line_size) type x,
        end   of xml_tab,
        file  type string,
        size  type i.
 call function 'GUI_UPLOAD'
    exporting
      filename            = filename
      filetype            = 'BIN'
      has_field_separator = ' '
      header_length       = 0
    importing
      filelength          = size
    tables
      data_tab            = xml_tab
    exceptions
      others              = 1.

Read only

Former Member
0 Likes
1,443

hi check this...

DATA:

lt_t005 TYPE STANDARD TABLE OF t005.

TYPES:

xmlline(1024) TYPE x.

DATA:

lt_xml TYPE STANDARD TABLE OF xmlline.

SELECT * FROM t005 INTO TABLE lt_t005.

CALL TRANSFORMATION id

SOURCE data_node = lt_t005

RESULT XML lt_xml.

CALL METHOD cl_gui_frontend_services=>gui_download

EXPORTING

filename = 'C:\table.xml'

filetype = 'BIN'

CHANGING

data_tab = lt_xml.

regards,

venkat

Read only

0 Likes
1,443

hi venkat appikonda ,

the requestor is talking about GUI_UPLOAD