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

To Read data from another server through the function module

Former Member
0 Likes
679

A new be spoke program is required in one server A that reads the data from another server B via the new function module and updates the table in A . The program needs to have the field PURCHORG as selection criteria, which is passed to the new function module.

The program should act according to what is new from the B table and what is already in A. Existing entries should be updated, new ones inserted and no longer existing ones removed.

Please do the needful.

Thank you,

Raghu

1 REPLY 1
Read only

Former Member
0 Likes
394

Hi Raghu,

The options to solve the issue mentioned by you are as under:

The steps for the first way are as under:

1. Use FM: FTP_CONNECT twice, once to connect Source server and Once to Destination Server.

2. Use FM: FTP_COMMAND with command: put <source dir/file> <dest dir/file>.

3. Use FM: FTP_DISCONNECT to close the connections.

But this kind of procedure would require some kind of FTP service running .

The other way could be to take the help of RFC Destinations.

You can define two RFc destinations, each pointing to the specific application server. Assuming the server names are SOURCE and TARGET, you can have two RFC destinations where you differentiate the servers by specifying the host name or IP address.

Once the destinations are defined, you need to develop two RFC enabled function module, one will be used to read the file and return it in form of internal table. The other will be to get the internal table as input and should save it on server (using abap commands open dataset etc.)

Now you can have an ABAP program where you first call the function which is reading the file. In call function you mention the RFC destination of source server.

Once the file is read, you than call the second function module with destination to target server and save the internal table to a file.

And regarding your query where you want to update the DB table based on the availability of the already existing data,you can write the logic for the same in your ABAP program after creading the data with the first FM.

In case you have any further clarifications,do let me know.

Regards,

Puneet Jhari.