Skip to Content
Author's profile photo Sreekanth Surampally

Copying files from one folder path to other in AL11 directory


In BW, files getting stored in a folder AL11 directory from Openhubs or any kind of FTPs. We may have to copy the files to other folder in the directory to take
a backup, if the files getting overwritten every day. In this document, detailed solution is explained to take the backup/copy the files to other folder.

SDN Photo.jpg

Author: Sreekanth Surampally

Company:  Accenture Inc.

Created on: 22 Jun 2013.

Business Scnerario:

In BW sytem, 3 openhubs are placing files in AL11 directory folder path, these files are sent to Oracle server with an FTP program which takes all the files in the AL11 folder and sends to oracle. It happens everyday. The kind of data sent to Oracle server is delta every day. So anyday, there should be current day’s files in the folder while FTP program executed. For this reason, files get overwritten everyday with new delta.

File history is not available in directory, with that troubleshooting has become difficult when some data is missed a month ago if any.


Created a ABAP program to copy the files from one folder to other in directory, added this step in the process chain.

Step1: Passing the source path value to variable LV_SRC_PATH, then to LV_DIR_PATH. the value can be maintained in TVARV table, so read the value and store it in the variable.


Call the function module ‘EPS_GET_DIRECTORY_LISTING’, with the exporting parameter source path value. It lists out all the files in the folder

File Copy1.png

Step2: Loop the internal table which has all the files in the source path, Ignoring header files by checking the condition, first letter is S then ignore the file. Then
concatenate the source path and the file name and also
concatenate the target path and file name with date and time to store the files separately.

Copy file2.png

Step3: Copy the Source file content to target file content,

Copy file3.png

Step4: in this subroutine, you write the open dataset to read and write the file content to target file, every line has commens, easy to understand.

File Copy4.png

Step4: Closing the dataset, then the subroutine is completed. Actually this subrutine is called in the loop statement which runs for every file in the folder path.

Copy file5.png

Step5: After execution of the program, files are copied to target path in the AL11 directory.

Assigned Tags

      1 Comment
      You must be Logged on to comment or reply to a post.
      Author's profile photo krunal shah
      krunal shah

      Very nice document. It Helped me:)




      Krunal Shah