Skip to Content
avatar image
Former Member

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

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

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

4 Answers

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

    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.

    Add comment
    10|10000 characters needed 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.

  • Jul 20, 2017 at 11:47 AM

    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

    Add comment
    10|10000 characters needed characters exceeded

  • Jul 20, 2017 at 01:38 PM

    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.

    Add comment
    10|10000 characters needed characters exceeded

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

    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

    Add comment
    10|10000 characters needed characters exceeded