*&---------------------------------------------------------------------*
*& Form MOVE_FILE
*&---------------------------------------------------------------------*
*& Archiving the file
*&---------------------------------------------------------------------*
FORM move_file USING pv_s_filepath TYPE string
pv_t_filepath TYPE string.
DATA: lv_eof_reached TYPE flag,
lv_buffer(20480),
lv_buflen TYPE i.
"open source and target files and start copying
OPEN DATASET pv_s_filepath FOR INPUT IN BINARY MODE.
IF sy-subrc NE 0.
"Add error handling
ENDIF.
OPEN DATASET pv_t_filepath FOR OUTPUT IN BINARY MODE.
IF sy-subrc NE 0.
"Add error handling
ENDIF.
CLEAR lv_eof_reached.
DO.
CLEAR lv_buffer.
READ DATASET pv_s_filepath
INTO lv_buffer LENGTH lv_buflen.
IF sy-subrc = 4.
lv_eof_reached = abap_true.
ELSEIF sy-subrc > 4.
"Add error handling
ENDIF.
TRANSFER lv_buffer TO pv_t_filepath
LENGTH lv_buflen.
IF sy-subrc NE 0.
"Add error handling
ENDIF.
IF lv_eof_reached = abap_true.
EXIT.
ENDIF.
ENDDO.
"Delete the source file
DELETE DATASET pv_s_filepath.
"Close the connection
CLOSE DATASET pv_s_filepath.
CLOSE DATASET pv_t_filepath.
IF sy-subrc <> 0.
"Add error handling
ENDIF.
ENDFORM. "MOVE_FILE
Wednesday, 10 April 2019
AL11: Move file from one path to another
Subscribe to:
Posts (Atom)
Report to find CDS view of Standard Table
A small change has been made to the original program ( SAP YARD Article ) so that it can also display the common CDS used by multiple table...
-
Step 1: Goto Transaction: SE41 Step 2: Click on Status or press CTRL+F6 Step 3: Fill up the dialog box as below: Frm Program: SAPLSALV...
-
Report: Z_R_ALV REPORT z_r_alv . CLASS gcl_event_handler DEFINITION DEFERRED . "Data Declaration INCLUDE z_r_alv_top . "...
-
AT SELECTION-SCREEN OUTPUT event gets triggered before generating the Selection Screen. Thus, it can be used to manipulate the elements of...