Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

GUI_UPLOAD from excel in binary mode

Hello,

We are using GUI_UPLOAD function to upload the data from presentation server by using excel file in binary mode but for some reason the data is not uploaded correctley could any one check the below code and let me know the issue,

once the data is uploaded i am concatenating in byte mode to create an XML message and in XML message i am not getting the data in binary mode could someone help,

DATA: BEGIN OF hex_record,

myhex(1024) TYPE x,

END OF hex_record.

DATA: lw_fname TYPE string,

tab LIKE hex_record OCCURS 1 WITH HEADER LINE,

lw_fname = rlgrap-filename.

CALL FUNCTION 'GUI_UPLOAD'

EXPORTING

filename = lw_fname

filetype = 'BIN'

TABLES

data_tab = tab

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.

*--Append the attachment data to the attachment itab

CLEAR gw_attachment_data.

lw_lines = LINES( gt_attachment_data ).

gw_attachment_data-att_index = lw_lines + 1.

gw_attachment_data-name = l_file.

gw_attachment_data-filetype = l_mime_type.

gw_attachment_data-fileextn = l_extension.

LOOP AT tab.

CONCATENATE gw_attachment_data-datastream tab-myhex

INTO gw_attachment_data-datastream IN BYTE MODE.

ENDLOOP.

APPEND gw_attachment_data TO gt_attachment_data.

Thanks

Former Member
Not what you were looking for? View more on this topic or Ask a question