cancel
Showing results for 
Search instead for 
Did you mean: 

SFTP adapter OS command %F placeholder is set to sftp user home directory not filepath,need help

0 Kudos

Hi all,

I'm new with SAP PI,

When I define OS Command using placeholder %F which should be an absolute file name including path

like this

/home/ftpuser/data/output/xi_output20160702-020238-323.dat

but it is set to SFTP user home directory /home/ftpuser/

sometimes OS Command is executed before file is send to path is this normal because with FTP I always see OS Command executed after file transfer, this is important for me because msg must be transfer 1st after msg successfully transfer and file have been completely written my script will run and create, send an empty file to same place with file above

I have spent a couple days searching for this but I got no clue about this,

If anyone have faced this problem please let me know the cause and solution for this

Regard

This is my msg log

P/S this work fine on FTP adapter

sh /script.sh %F %f

SFTP adapter

02.07.2016 02:02:38.239InformationTrying to connect to host 10.0.1.225
02.07.2016 02:02:38.325InformationFilename is xi_output20160702-020238-323.dat
02.07.2016 02:02:38.325InformationServer is 10.0.1.225
02.07.2016 02:02:38.326InformationHome directory is /home/ftpuser
02.07.2016 02:02:38.326InformationPath is /home/ftpuser/data/output/
02.07.2016 02:02:38.328InformationWriting to file: xi_output20160702-020238-323.dat
02.07.2016 02:02:38.331Informationsend xi_output20160702-020238-323.dat to /home/ftpuser/data/output/
02.07.2016 02:02:38.332InformationExecuting OS command: sh /script.sh /home/ftpuser xi_output20160702-020238-323.dat
02.07.2016 02:02:38.539InformationMessage was successfully processed by the JCA adapter
02.07.2016 02:02:38.539InformationMessage was successfully transmitted to endpoint <local> using connection SOAP_http://sap.com/xi/XI/System
02.07.2016 02:02:38.543InformationMessage status set to DLVD

02.07.2016 01:14:17.871InformationTrying to connect to host 10.0.1.225
02.07.2016 01:14:17.973InformationFilename is xi_output20160702-011417-972.dat
02.07.2016 01:14:17.973InformationServer is 10.0.1.225
02.07.2016 01:14:17.974InformationHome directory is /home/ftpuser
02.07.2016 01:14:17.974InformationPath is /home/ftpuser/data/output/
02.07.2016 01:14:17.976InformationWriting to file: xi_output20160702-011417-972.dat
02.07.2016 01:14:17.980InformationExecuting OS command: sh /script.sh xi_output20160702-011417-972.dat /home/ftpuser
02.07.2016 01:14:17.980Informationsend xi_output20160702-011417-972.dat to /home/ftpuser/data/output/
02.07.2016 01:14:18.188InformationMessage was successfully processed by the JCA adapter
02.07.2016 01:14:18.189InformationMessage was successfully transmitted to endpoint <local> using connection SOAP_http://sap.com/xi/XI/System
02.07.2016 01:14:18.194InformationMessage status set to DLVD

FTP adapter

01.07.2016 08:55:20.984InformationConnecting to FTP server "10.0.1.225"
01.07.2016 08:55:20.984InformationFile Adapter Receiver Channel CH_FTP: Start processing; party " " / service "BC_FTP"
01.07.2016 08:55:21.074InformationWrite to FTP server "10.0.1.225", directory "/home/ftpuser/data/output", ->  file "xi_output20160701-085521-070.dat"
01.07.2016 08:55:21.074InformationTransfer: "BIN" mode, size 886 bytes, encoding -
01.07.2016 08:55:21.078InformationExecute OS command "sh /script.sh xi_output20160701-085521-070.dat /home/ftpuser/data/output/xi_output20160701-085521-070.dat"
01.07.2016 08:55:21.298InformationFile processing finished
01.07.2016 08:55:21.300InformationMessage was successfully transmitted to endpoint <local> using connection SOAP_http://sap.com/xi/XI/System
01.07.2016 08:55:21.302InformationMessage status set to DLVD

Defining OS Commands for Message Processing by SFTP Adapter - SAP Process Integration, secure connec...

Accepted Solutions (0)

Answers (1)

Answers (1)

nitindeshpande
Active Contributor
0 Kudos

Hi Thach,

There are two options for processing your command. If you want to process the command before processing or after processing. Based on this command will be executed after writing the file or before writing the file.

You can refer to point number 5, in the SAP Help link mentioned by you -

Defining OS Commands for Message Processing by SFTP Adapter - SAP Process Integration, secure

connectivity add-on Config…

About your error log, can you post the screenshot of your channel configuration? Additionally you can refer to below Wiki for more info -

SAP XI File Adapter OS Command Line Feature - Process Integration - SCN Wiki

Regards,

Nitin