Hi everyone,
I am trying to read into a buffer the content of a binary file (like Excel) and to write that content file using open data set into a folder destination.
The file destination has a size diferent than from the original one and cannot be open.
Here is the code.
DATA: lv_file_name(100),
lt_content LIKE sdokcntbin OCCURS 0 WITH HEADER LINE.
MOVE '\computerTestA1.xls' TO lv_file_name.
OPEN DATASET lv_file_name FOR INPUT IN BINARY MODE.
IF sy-subrc NE 0.
EXIT.
ENDIF.
DO.
READ DATASET lv_file_name INTO lt_content-line.
IF sy-subrc NE 0.
EXIT.
ENDIF.
APPEND lt_content.
ENDDO.
CLOSE DATASET lv_file_name.
* DELETE DATASET lv_file_name.
*****************************************************
CLEAR: lv_file_name.
MOVE '\computerTestB2.xls' TO lv_file_name.
OPEN DATASET lv_file_name FOR OUTPUT IN BINARY MODE.
IF sy-subrc NE 0.
EXIT.
ENDIF.
LOOP AT lt_content.
TRANSFER lt_content-line TO lv_file_name.
ENDLOOP.
CLOSE DATASET lv_file_name.
THanks in advance.
Regards.
Message was edited by:
David Fryda