Skip to Content
0

RFC for conditon based File transfer from SAP to SFTP via SAP PI

Jul 20, 2017 at 10:53 AM

131

avatar image
Former Member

Hello everyone,

I need to transfer a .csv file from SAP to an SFTP server using SAP PI. I know that SFTP adapter will be used at receiver communication channel but we need to trigger the file transfer if any change is made in source file. If source file is modified, the PI should replace/overwrite the existing file in SFTP server. If I need to create a RFC to achieve this, so file in PI source path get replaced with new file & this file is transferred to SFTP destination. please do tell me how to acheive this.

Thanks

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

4 Answers

avatar image
Former Member Jul 20, 2017 at 01:19 PM
0

Is this a real time scenario? Do you need to upload the changes immediately or would it be possible to upload it a few minutes later? If you dont neet real time, you could easily pick up the source file periodically (e.g. every hour, half hour or so, using file adapter) and simply overwrite it on the target side.

Show 1 Share
10 |10000 characters needed characters left characters exceeded
Former Member

Hi Moritz,

Yes, you can assume it to be a real time scenario, trigger must set to changes made on file. First I need to replace the source file with latest one, then transfer to the target can be managed.

0
Ram Burugu Jul 20, 2017 at 11:47 AM
0

Would like to check if the program creating the file make a proxy call to PI to let it know that there is a file? This way the application program takes responsibility of notifying PI instead of PI trying to identify if the file has been modified.

You can create an RFC but what is the logic you are planning for the RFC to have coded in it? If you are thinking Timestamp, it can only work for scenarios like is it modified today or modified in last hour etc. but it is not possible to identify if the file has been modified since the last run unless you persist the last run somewhere.

If you lwould ike to proceed with timestamp logic, please see this post on how to retrieve modified date time.

https://wiki.scn.sap.com/wiki/display/Snippets/Reading+properties+of+files+on+application+server

Share
10 |10000 characters needed characters left characters exceeded
Evgeniy Kolmakov Jul 20, 2017 at 01:38 PM
0

Hi Azizulah!

Is there any reason not to delete the source file after processing?

Or the source file is rewritten every time regardless to its content changes?

Regards, Evgeniy.

Show 2 Share
10 |10000 characters needed characters left characters exceeded
Former Member

Hi Evegeniy,

we expect to the file to be modified frequently, source file can be deleted after processing but PI must fetch the new the file in its directory when changes are made. So i want RFC to specifically generate the .csv when a change is made in records.

Thank you.

0

Hi Azizullah!

It's not the integration part but ABAP development part.

Regards, Evgeniy.

0
avatar image
Former Member Jul 21, 2017 at 07:06 AM
0

I'm in favor of the proxy idea but provided that we're not talking an SAP standard program that you're using to create the file, instead of using it as a notifier, I would go one step further and include the data to be transferred in the message. This approach has many benefits over file-based integration on the SAP side.

- It is real-time - the moment the data is fetched from the tables, it will be transferred to PI and uploaded to the target SFTP side. Any file based integration on SAP side will inevitably require periodic polling.

- It is more efficient. You get better performance and are not wasting system resources on unnecessary polling cycles

- You eliminate file-system dependency. Such dependency can be a small risk or a big annoyance depending on your support structure.

Regards,
Patrick

Share
10 |10000 characters needed characters left characters exceeded