Memory exhausted when reading files into LSMW
When handling exceptionally large files, LSMW will sometimes throw an error like this one returning a mysterious "Return code = 14" instead of declaring that the source data is too large to read into memory. The 14 comes from the GUI_UPLOAD function throwing an error when it runs out of memory because the EXCEPTION
for dp_out_of_memory
is assigned to 14 in the /SAPDMC/SAP_LSMW_READ_FORMS
include
.
Error when uploading file (return code = 14) Message no. /SAPDMC/LSMW_OBJ_070010
The easy solution is to break the source data into multiple, smaller pieces that can be read into LSMW without throwing this error. Try breaking the file into halves or quarters in order to prevent LSMW from running out of memory during the read.
CALL FUNCTION 'GUI_UPLOAD' EXPORTING filename = l_filename filetype = l_filetype codepage = l_codepage * HAS_FIELD_SEPARATOR = ' ' * HEADER_LENGTH = 0 * READ_BY_LINE = 'X' * IMPORTING * FILELENGTH = * HEADER = TABLES data_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.