
The second instance of the command with 4 lines is the place where actually file transfer is achieved. This is exactly the same as SY-SUBRC in ABAP). (Return codes are checked after execution of most unix commands, before further processing is done.
Unix batch script example java program code#
Return code is 0 if the Connection was successful. We can check the outcome based on the return code. PI tries to connect to the sftp server and logs out immediately thereafter. Here, the first instance of the execution with ‘exit’ as the batch parameter is used to check if the sftp server is available at the moment. Here, I have put the contents of the batch file in bold. Hence, we need to prepare a separate batch file, before invoking the SFTP command. This command needs to be run in batch mode. It is used to transfer file from/to 3rd party sftp server to/from PI server.Ģ) SFTP Command: Since SCP command cannot be used to push/pull a file from a non-linux based system, the alternative command is SFTP.


This is an SAP provided option to leverage the powerful bash command arsenal.ġ) SCP Command: SCP means Secure copy. I would like to share my experience, working in Unix shell scripting in SAP PI, along with typical use cases.Ī single Unix command or a sequential execution of commands, saved in a bash script file can be invoked from OS Command option in File adapter.
