F How to copy a file using CL_GUI_FRONTEND_SERVICES class in SAP ABAP | CodeTheta

How to copy a file using CL_GUI_FRONTEND_SERVICES class in SAP ABAP

October 16, 2023

Here I have used CL_GUI_FRONTEND_SERVICES class to copy TXT file content.

In below program demo.txt file must exist in your desktop with some content in it.

Code :

DATAlv_source TYPE string.
DATAlv_dest TYPE string.

lv_source 'C:\Users\CODETHETA\Desktop\demo.txt'.
lv_dest 'C:\Users\CODETHETA\Desktop\dest.txt'.

CALL METHOD cl_gui_frontend_services=>file_copy
  EXPORTING
    source               lv_source
    destination          lv_dest
    overwrite            SPACE
  EXCEPTIONS
    cntl_error           1
    error_no_gui         2
    wrong_parameter      3
    disk_full            4
    access_denied        5
    file_not_found       6
    destination_exists   7
    unknown_error        8
    path_not_found       9
    disk_write_protect   10
    drive_not_ready      11
    not_supported_by_gui 12
    OTHERS               13.
IF sy-subrc <> 0.
* Implement suitable error handling here
ELSE.
  WRITE'file copied successfully'.
ENDIF.

IDE Used To Test This Code : SAP ABAP Editor.

Try this code in your computer for better understanding. Enjoy the code. If you have any Question you can contact us or mail us. We will reply you as soon as possible.

Post a Comment

PRODUCTS

LISTS OF PRODUCTS

SERVICES

SKILLS
SOFTWARE DEVELOPMENT
WEBSITE DEVELOPMENT
WEB HOSTING
BULK SMS SERVICE
SEO SERVICE
ANDROID APPS
QR CODE / BARCODE
HARDWARE SERVICE
OUR WORK AREA