Application Development and Automation 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: 
Read only

switch between application servers through ABAP program

Former Member
0 Likes
961

Dear Experts,

I have a program that executes in background. This program reads data from the application server and continues with further processing. The data is uploaded on application server using transaction CG3Z. Now, we have 5 applicatioin servers. The data is available on one of them. When program executes, it searches for the file on that particular application server. And if it fails to get the data, it does not proceed further. Is there any way where if the file is not found on one application server, the program should check the other application server for the file and read from there.

Regards,

Sonal

1 REPLY 1
Read only

Former Member
0 Likes
611

Hi Sonal,

It is possible, but depends on the directory structure on all the 5 app servers, if they are the same, then you could try to open the file as shown below on all the servers. This is just a high level pseudo code, you can use this as a guideline.

Pay attention to the directory structure on the servers, and ensure your logic can support all of them.

call function - TH_SERVER_LIST

Loop at list_of_servers.

concatenate list_of_servers-servername '\folder\subfolder\filename' into filepath.

open dataset filepath.

if sy-subrc eq 0.

read dataset

file_read_flag = X.

endif

if file_read_flag = X.

exit.

endif.

endloop.

Note: You might also want to explore the logical filepaths options(TCODE: FILE, there is enough documentationon the net) and store the logical filepaths in a Z table.

Regards,

Chen