Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Function module to read the directory list and also run in background

Former Member
0 Kudos

Hi All,

I need to read few files from a folder in the server and upload the data in the file using a BDC. This process has to happen in the background as I am going to schedule the program. I had used the function module "EPS_GET_DIRECTORY_LISTING" to list the file names, it is working properly but when I schedule the program this function module does not work, the jobs gets finished in 0 secs. I am suspecting that it is not running in back ground. Can any one suggest me the function module which runs in background to read the files or an alternate method.

Ajeetha

1 ACCEPTED SOLUTION

former_member225631
Active Contributor
0 Kudos

This FM is working properly in background mode. Please post your code.

7 REPLIES 7

Sandeep_Kumar
Product and Topic Expert
Product and Topic Expert
0 Kudos

Reading file from presentation server will not work in background. You can put your files in application server first and then process the files from here.,

0 Kudos

Dear Sandheep,

The file is in the Application server, I need to read the files in a scheduled manner. This can happen only when I run the program in background, the function module which I used to read the directory of the folder does not run in background, this is what my issue is.

Ajeetha

former_member225631
Active Contributor
0 Kudos

This FM is working properly in background mode. Please post your code.

0 Kudos

Thanks for the reply.

Sorry, this function module is working properly, why I assumed it is not working is that the background job got completed in 0 secs which made me feel that the function module is not working. Also I am subsequently copying the file to another folder and deleting it from the source folder, actually thiese two functionalities are not working in background. which added to my conclusion that all the function modules are not working in background. I am using two methods to copy and delete files, they are

CL_GUI_FRONTEND_SERVICES=>FILE_COPY,

CL_GUI_FRONTEND_SERVICES=>FILE_DELETE.

as these are not working in background, now I need to replace them with a method or function module which will run in background.

As I have mentioned earlier, my main objective is to upload the data in the file using a bdc. If I am not able to delete the file in the source folder, then duplicate upload will happen which I have to avoid. So, if someone could help me to find a way to delete the file will be of great help to me.

Ajeetha

0 Kudos

Hi Ajeetha,

as the name says:

CL_GUI_FRONTEND_SERVICES=>

is for the frontend GUI. GUI stands for graphical user interface. In background, there is no interaction with a user. There is no SAPGUI, there is no frontend.

Background processing runs on the SAP server. Here you have to work with DATASETs - open, close, delete. Enter these keywords in editor and press F1 or use google or SDN.

Regards,

Clemens

0 Kudos

You cannot be using the frontend methods to read from the application server. They read from the presentation server (i.e. your pc's file system).

0 Kudos

Thank you all for the reply, I issue is resolved, I used Open dataset and transfer to copy the files and function module EPS_DELETE_FILE to delete the files, both are working in back ground.

Ajeetha