11-21-2007 10:48 AM
I tried to use the GUI_UPLOAD
but it seems it cannot get the correct data by the length i defined if the record contains 2-byte words.
11-21-2007 10:52 AM
Hi,
I think it should work
try like this.
*--Call the function to get the file into an internal table.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = lv_file
filetype = 'ASC'
TABLES
data_tab = pr_eord
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.
File not found.
MESSAGE e503.
ELSE.
regards,
Prashant
03-31-2008 9:26 AM
Solved.Get all content to a string then use the following method
TRY.
CALL METHOD CL_ABAP_LIST_UTILITIES=>READ_FROM_DISPLAY_LAYOUT
EXPORTING
DISPLAY_DATA = IO_OUTPUT
DISPLAY_OFFSET = I_OFFSET
DISPLAY_LENGTH = I_LENTH
IMPORTING
FIELD = I_STRING.
CATCH CX_PARAMETER_INVALID_RANGE .
ENDTRY.