‎2006 Aug 21 11:59 AM
Hi Experts,
See the following code.I am getting list of files in the table ifile.But when i use CALL METHOD cl_gui_frontend_services=>gui_upload
I am getting sy-subrc = 19.
Can any body tell me what may be the problem?
Thanks in Advance.
data: ifile type table of file_info.
data: wa_file like line of ifile.
data: xfile type string.
data: xcount type i.
data: l_xml_table_size TYPE i.
TYPES: BEGIN OF t_xml_line, "Structure for holding XML data
data(256) TYPE x,
END OF t_xml_line.
DATA: l_filename type string.
DATA: l_xml_table TYPE TABLE OF t_xml_line. " XML Table of the structure
call method cl_gui_frontend_services=>directory_list_files
exporting
directory = 'D:\'
FILTER = '*.XML'
FILES_ONLY = 'X'
DIRECTORIES_ONLY =
changing
file_table = ifile
count = xcount
exceptions
cntl_error = 1
directory_list_files_failed = 2
wrong_parameter = 3
error_no_gui = 4
others = 5.
*loop at ifile .
write:/ 'ifile'.
*endloop.
loop at ifile into wa_file.
l_filename = wa_file-filename.
Upload file from the client's workstation
CALL METHOD cl_gui_frontend_services=>gui_upload
EXPORTING
filename = l_filename
filetype = 'BIN'
IMPORTING
filelength = l_xml_table_size
CHANGING
data_tab = l_xml_table
EXCEPTIONS
OTHERS = 19.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
endloop.
‎2006 Aug 21 12:12 PM
Dear Ravi,
Please concatenate the file path with your file name before you call the upload method.
loop at ifile into wa_file.
New line ******************
concatenate 'D:\' wa_file-filename into l_filename.
New line ******************
Upload file from the client's workstation
CALL METHOD cl_gui_frontend_services=>gui_upload
EXPORTING
filename = l_filename
filetype = 'BIN'
IMPORTING
filelength = l_xml_table_size
CHANGING
data_tab = l_xml_table
EXCEPTIONS
OTHERS = 19.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
endloop.
Please reward points if found useful.
Regards,
Prabhas.
‎2006 Aug 21 12:05 PM
hi Ravi,
Try this way ..
ifile type standard table of char256.
‎2006 Aug 21 12:12 PM
Dear Ravi,
Please concatenate the file path with your file name before you call the upload method.
loop at ifile into wa_file.
New line ******************
concatenate 'D:\' wa_file-filename into l_filename.
New line ******************
Upload file from the client's workstation
CALL METHOD cl_gui_frontend_services=>gui_upload
EXPORTING
filename = l_filename
filetype = 'BIN'
IMPORTING
filelength = l_xml_table_size
CHANGING
data_tab = l_xml_table
EXCEPTIONS
OTHERS = 19.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
endloop.
Please reward points if found useful.
Regards,
Prabhas.