Tag: File Transfer Protocol (FTP)

Archive Files with the File Receiver Communication Channel

Archive Files with the File Receiver Communication Channel

The File Sender Communication Channel is able to move processed file to an archive directory and append the current timestamp. The File Receiver Communication Channel lacks an parameter to archive files. This is okay in most cases. The receiving system should take care of the file after processing. But, what if the demand is to move a file to an archive directory on the receiving system before overwriting it?

Solutions:

  1. It is possible to use an (cc)BPM(N) which orchestrates the archiving and the creation of the new file. You would need a configuration, a File Sender Communication Channel, a File Receiver Communication Channel and dummy interfaces to grab the old file and move it to a new directory. After the archiving is done, you can use a second configuration to store the new file. In addition, a third configuration is necessary which receives the source file and triggers the ccBPM or BPM. One BPM and three configurations – a lot afford for a simple archive.
  2. The File Receiver Communication Channel has a parameter to run script or commands on the operating system before and after creating the file. A simple move command wil do the trick.
    If your SAP Process Integration / Process Orchestration runs on Unix, use

    mv test.xml archive/test_$(date +%Y-%m-%d).xml

    If your SAP Process Integration / Process Orchestration runs on Windows, use

    ren “test.xml” “test_%date:~10,4%%date:~7,2%%date:~4,2%.xml”

    Move command in File Receiver Communicaiton Channel
    Move command in File Receiver Communicaiton Channel

    In case you use dynamic filenames, you can use the following placeholders:

    Placeholder Description
    %F target file path
    %f target file name

    Unfortunately, this will only work in NFS mode. You could create a script which connects to the FTP server and archives the file and run this script with the Communication Channel, but I would highly advise against this.

To read more about the File Receiver Communication Channel, check out the SAP Documentation.