Script Execution in File Adapter

Hi,
I have the following scenario,
There are two FTP folders(say FTP_SingleFile and FTP_MultipleFiles).
At any point of time, there would be only one file in FTP_SingleFile and n number of files in FTP_MultipleFiles.
A sender communication channel  picks the file from FTP_SingleFile  and pushes the file to a BPM.
Once my BPM receives this file from FTP_SingleFile, all the files in FTP_MultipleFiles need to renamed from *.tab to *.txt extension.
I am just thinking if this can be achieved by the operating system command before/after Message processing. I have never tried this though. I would appreciate if someone could guide me through this.
Thanks,
Senthil

Hi Senthilnathan,
Just an option to consider:
- construct a new bat file in PI local system. This file should include ftp commands like " ftp FTP_Multiplefile.... user ... pass... REN x y... ". It will do renaming issues when triggered. Then while transferring the file from FTP_Singlefille to BPM send it also to a new receiver, Local_RCV. Local_RCV is PI local host. You will do a dummy file(FTP_singlefile) to file (NFS) scenario just to trigger the bat file using "run OS command after message processing "...
I did not try this before but therotically it should work..
Regards,  
-Tarik

Similar Messages

  • Passing mulitple parameters to unix shell script via File adapter

    Hi,
    I have the following usecase.
    I have a set of files A, B, C, D  etc in a directory dir.  I also have a EOT ( end of transaction file).
    I need to merge this file once the EOT file is present in XI application server (  using NFS with File adpter).
    I have a script which can take the following paramters:
    1. EOT file name
    2. File names for A,B,C,D
    3. Directory names.
    Is it possible to send muliple parameters to the unix script from the File adapter?
    please share any blogs which do so.
    Thanks in advance,
    Best Regards
    Abhishek

    Hi,
    You can always call script from file adapter using "OS command" functionality, pass additional parameter like you do in unix for existing script (exact command which you type on unix prompt).
    Adapter will simply pass your OS command to operating system, so from XI point of view nothing is changed and it is your script which should take care of parameters.
    Regards,
    Gourav

  • Shell Scripts with File adapter

    Hi Everyone,
    Can we use shell scripts in File Adapter of XI.
    If yes can someone give me the configuration and any helpful blogs or links.
    Helpful answers will be rewarded points.
    Thanks,
    Rupash K

    Hi,
    you can just call the script in the File Adapter, before or after XI processing step.
    Nevertheless, sometimes it behavior different between to call the script as to typ the command directly on the channel configuration.
    Here is the [SAP official document|http://help.sap.com/saphelp_nw04/helpdata/en/84/e8763c997fda50e10000000a11405a/frameset.htm], it is quite easy to use. Just call the script as if you want to call it on the shell, you have to aware about the path and placeholder which you may want to pass the it as parameter to your script.
    Here are some more links
    https://www.sdn.sap.com/irj/scn/wiki?path=/display/xi/sapXIFileAdapterOSCommandLine+Feature
    https://www.sdn.sap.com/irj/scn/wiki?path=/display/xi/morewiththeFileAdapter
    regards,
    Hai
    Edited by: Hai Long on Nov 14, 2008 5:30 PM

  • File Adapter with Linux

    Hi
    I want to send file from linux server to XI File Adapter
    I cannot cr8 nfs between them ( our XI is running on AIX)
    there's an option of Using samba client ( which works likes FTP )
    does XI Supports that option?
    other thing i have been thiking on is 2 run script which will bring the file to XI Server
    will it work if I put the script on the file adapter befrore message proccessing ?
    Thx,Shai

    Hi Shai,
    Specify the port number of the FTP server. The default is the standard port for the FTP server (21).
    In active mode, the server establishes a data connection from its data port, port 20, to an end point chosen by the client.
    I would also suggest you go through this link....
    http://help.sap.com/saphelp_nw2004s/helpdata/en/e3/94007075cae04f930cc4c034e411e1/frameset.htm
    I hope it helps.....
    Regards,
    Abhy

  • Execution of remote script in File Adapter OS Command

    Hello.
    I'm having issues with a remote script placed on a file adapter which fails to execute in a clustered PI (Version 7.1), running on Windows 2008.
    Our current setup is as follows.
    - Machine A and Machine B make up a SAP PI Cluster node.
    - Machine C is our network file share, used as a sandbox for receiving and sending files.
    One given scenario would be having the Cluster picking up a file from a FTP folder (Machine D) and copying it over to a given location in Machine C. This is working without problems in the cluster environment.
    Now, a very specific scenario requires that after copying the file (to folder INPUT), a given script shall be executed over the received file and decide which folder should that file be archived, TO_PROCESS or NO_PROCESS folders.
    So, Outbound Channel is reading from the FTP, Inbound Channel stores in Machine C and has to run a script after message processing.
    The problem here is that the script is stored also in Machine C, so placing the OS Command should refer to a shared path:
    Example:
    sap-machine-c.gca.ad.root\InboundFiles\INPUT
    sap-machine-c.gca.ad.root\InboundFiles\TO_PROCESS
    sap-machine-c.gca.ad.root\InboundFiles\NO_PROCESS
    sap-machine-c.gca.ad.root\Scripts\procFile.bat
    If I give the command of "
    sap-machine-c.gca.ad.root\Scripts\procFile.bat %F" on the receiver channel, checking RWB, Communication channel says the command was executed with success but the file doesn't leave the INPUT folder.
    The script is know to execute with success from both instances, I have logged into each one of them and executed with RFCUSER in SE38 w/transaction RSBDCOS0.
    I have tried to replicate this issue, reducing even the procFile.bat script to just do an "echo" command but still doesn't work (RWB PI says it does).
    It seems to me that executing scripts from remote shares is a no go? Does anyone have a previous experience dealing with these cases?
    Thanks,
    Romeu

    Hi all.
    After taking some hints from this thread, we have found out that the problem lied some where in the installation part of PI.
    We've set up a basic script, local and not remote, and still the system would not execute that command.
    The RWB logs showed successful processing but the Application Server logs were full of errors and stack traces regarding the execution of any command. A support note was raised with SAP support in order to trace these errors.
    I'm therefore closing this question as the original question is not related with remote scripting.
    Thanks all for your help.
    Best regards,
    Romeu

  • External OS command script in file adapter - return value check possible?

    Is it possible to check return value of external OS script execution which is called in the file adapter? We want to see the result in the adapter monitoring. The documentation says: "Message processing is independent of any errors that occur during the execution of a configured operating system command."

    Hi Sanjay ,
    Seems possible : Try this :
    /people/michal.krawczyk2/blog/2005/08/17/xi-operation-system-command--error-catching
    Regards ,

  • Shell Script not getting invoked in File adapter

    Hi all,
    Requirement:
    PI need to pick the file from source directory and send it to target directory using SFTP.
    I'm using SCP command for this purpose.
    When I run the shell script (with simple SCP command) from command prompt, script is working fine.
    Same script is called from PI File adapter but script is not getting invoked.
    In the communication channel logs, "Executed OS command" is available. There are no Error/Warning messages in the log.
    NFS transport protocol is used in the File communication channel.
    Complete directory path of the shell script is mentioned in File channel -> Run Operating System command after message processing.
    Even the following simple command is not working from PI receiver file channel:
    echo "Test file" >> /data/test.txt
    Please let me know if I'm missing out something.
    Thanks,
    Geetha

    Hi Geetha,
    I think the syntax u are using is not correct. Please follow the below syntax:
    /path/<script_name> %F
    for ex: /staging/Interface/XI/Script/FTPData %F
    use the above in the communication channel.
    %F should be after a space.
    FTPData is the script name
    /staging/Interface/XI/Script/ is the location where the script is present
    Cheers,
    Souvik
    Edited by: Souvik Chatterjee on Apr 14, 2011 3:38 PM

  • Command Line Scripts in File Adapter

    Hi,
    In the file adapter, does the command line script support "PERL" Scripts.
    thanks.
    Krishnan

    YES It will support.
    For clarification check below one.
    /people/sameer.shadab/blog/2005/09/21/executing-unix-shell-script-using-operating-system-command-in-xi
    FTP channel - not processing files, coz one of the files is wrong,

  • Reg: UNIX shell script at File Adapter

    Hi all,
    I am doing a File to file scenario and using command line arguments in Sending file adapter. I am using UNIX shell script ".sh" file for executing the command.
    I gave the following path at "Run OS command before message processing" parameter:
    /temp/xidelivery/send/FILOSC004_shell.sh
    and this file contains following code:
    <b>#!/user/bin/sh cp /temp/xidelivery/send/FILOSC004_in.txt /temp/xidelivery/send/FILOSC004_input_copy4.txt</b>
    I put the source file, FILOSC004_in.txt and shell script files at the respective paths.
    If I give "cp" command directly in command line it is working fine. But I could not execute this with shell script. Can any body give me the reason where I gone wrong.
    Regards,
    Pavani.

    Hi,
    can you try this,
    bash /temp/xidelivery/send/FILOSC004_shell.sh
    let me know.
    hey you can check the blog below to catch the OS errors,
    /people/michal.krawczyk2/blog/2005/08/17/xi-operation-system-command--error-catching
    Prasad Babu.
    Message was edited by:
            PrasadBabu Koribilli

  • Calling unix scripts in File Adapter

    All,
    we have a script recindicator.sh in the root of the unix server. This script take 1 parameter.
    In the File adapter - "Run Operatning System Command After Message Processing" - we put the following,
    recindicator.sh %f
    we see the adapter working, but we are not seeing the effects of the script which is supposed to create 2 different files.
    Can we run scripts in the "Run Operatning System Command After Message Processing" ? If yes, what is wrong with our configuration?
    When we run the script directly on the server, with the parameter - it is working. so no issue in the script.
    Thanks,

    Hi,
    Yes, the script is in XI server. we tried with %F also, it is not working.
    At what directory level is the command that we give in the configuration run? is it in the root? or some other SAP folder like - "/SAP/user/..."?
    Thanks.

  • Sender File Adapter - remote FTP server program execution

    Hi all,
    I have a scenario
    X12 -> XI -> File
    where sender File adapter is used. The input file is X12 txt document which needs to be converted into X12 xml format. I have created astylus studio XSLT mapping which uses Convertor to convert this txt file to X12 XML.
    I don't know how to configure sender file adpater to run this mapping on the source file before picking it up. have created a windows batch file on the FTP server which runs tis XSLT mapping on the txt file and replaces it with X12 format xml. This batch file uses command line parameters of stylus studio to run XSLT mapping on input txt file and generates an xml.
    I am not sure how to run this mapping on the input file before processing starts in PI file adapater.
    I tried running command line parameters of Sender file adapter but that didn't worked.
    Please help.
    Thanks
    -Kulwant

    Hi, Kulwant:
    Looks like you would like to execute your mapping program before file adapter pick it up.
    Right ? for one interface, it seems out of the XI scope, however if this is your requirement, you can separate into two interfaces:
    The first interface is file to file scenario, it is used to execute your mapping program:
    The file sender just pick up the txt file, send to integration engine.
    Your Message Mapping program need to specify your XSLT mapping, after the mapping, the message is XML format,
    then you will use file receiver to send it to certain directory.
    Now the XML format file is your input of your second interface.
    Regards.
    Liang

  • Encrypt a file in PI using file adapter.

    Hi,
            I need to Encrypt a flat file and ftp it. Since the target server is a bank, the data after been placed there should be decrypted. How can i achieve this?

    Hi
    In case you are using a file adapter then you can use Operating system command after and before execution. in which before processing you can decrypt the file using some decrypting command line tool and after execution you can use command line command to delete the file. and after decryption and before deletion of file you can use file content conversion
    Or else you have to write a module processor for File adapter which will decrypt the message.
    These may help you
    How XML Encryption can be done using web services security in SAP NetWeaver XI
    How XML Encryption can be done using web services security in SAP NetWeaver XI
    How to achieve encryption in XI
    This thread is similar to your question and his question is solved. Please go through it.
    triggering encryption script with XI
    Hope this is usefull
    Thanks
    Saiyog
    Edited by: Saiyog Gonsalves on Jul 16, 2008 10:16 AM

  • Date and Time in Sender File Adapter Target Directory

    Hi there,
    is there a way of using Date and Time from XI to the Target Directory naming? To use variable substitution some fields of the message had to contain that date and time information, which is not our case.
    For filename you can use "add time stamp" option, but and for target directory?
    Thanks and regards,
    Henrique.

    > <i>Do you have further information on how to perform
    > this with shell commands?</i>
    > >> You need to write a shell script. This script will
    > add the date/time stamp into the folder in the target
    > system. This shell script is executed from the File
    > adapter. So once the file is written into the target
    > directory, then it will rename the directory.
    Hi there, Moorthy
    We've tried to write that shell script that you mentioned, but now we have a few doubts on how to make it create the proper directory.
    In the file adapter, my target directory is "/%var1%/%var2%/", where %var1% and %var2% are variable substitutions, referencing data which comes from the payload. Now, I need the shell script to append "/<Year>/<Month>/" in the target directory. But where to archive the script? If it stays in the root directory, than how to make it create "/<Year>/<Month>/" folders inside a directory which is variable (/%var1%/%var2%/)?
    Is there a way of passing %var1% and %var2% as parameters for the shell script?
    Thanks a lot,
    Henrique.

  • Archiving TXT files in Sender File Adapter--Unformatted Way

    Hello,
    I am Archiving TXT files thru Sender file adapter, files are getting archived to specified directory.No issues in that.,
    When i open the archived files, those are not in the correct format way that i placed before file pickup.
    Header & lines got messed up side by side.
    Regards

    Hi,
    If the file that it being archived is not transformed, it should exactly be the same as the original file.
    Please make sure that you are not transforming the archive file by any means(unix script, mapping logics etc).
    As suggested above, it is advisable to open the file in the editors like textpad, ultraedit etc. The difference in the alignment could be because of the notepad editor.
    Try to open the original and archived files in any of those(textpad,ultraedit etc) editors and check.
    Please let us know if you are still able to find the difference in the alignment.
    Regards,
    Subbu

  • Questions about using FILE adapter to connect to other systems

    Hi,
    in my PI scenario i am facing a problem in usage of the file adapter.
    Our PI system is installed on a UNIX server. The target system for upload an download files is a WINDOWS system. The software installed on the WINDOWS system is only able to export the needed file lokal on the WINDOWS server.
    Between UNIX systems i can connect a together used fileshare folder. But this won´t help me in my UNIX <> WINDOWS scenario.
    I thougt on using an FTP server on the WIDNOWS system to make the PI able to connect via the FTP adapter but this works fine for one or two systems. I don´t think that this ist the best solution when connection to a lot WINDOWS systems, but mayby i am wrong.
    Actually i use UC4 to copy the files between the two systems.
    Any ideas how to deal generally with such scenarios?
    Many thanks
    Michael

    Even though if you map Unix and Windows OS to read the files, in the long run the design will put you in trouble. Means it requires constant support. Better you go with unix script as per the above suggestion.
    Regards
    Pothana

Maybe you are looking for

  • IMac sound is gone, what shall I do???

    I still have the start up sound, other than that the machine is completely quite. The speaker sign at upper right is grey. When I use keyboard shortcut to do volume adjustment, it shows a small disable sign at bottom like a strike through "O". Checke

  • JDBC sender adapter: Update before mapping

    Dear all, following scenario: in a database we have a field called "statpi". We pick all messages that have statpi =  0 and update the data record to statpi = 1 via UPDATE function in JDBC sender adapter. Every select statement is limited to 100 data

  • Entity Framework in WPF Application - Using Statement or Implement IDisposable

    I have a WPF application that uses Entity Framework. I have implemented a Repository that implements IDisposable, that holds my EF context.  When the application starts up I new up a Repository, which news up an EF context, then when the application

  • Itunes and Aperture 3

    Any ideas how to reconnect or clean up the itunes section in aperture? I moved my itunes to an external drive but do not know how to fix aperture

  • Ctype header in 10.8

    When I try to compile anything with #include <ctype>, g++ says it's not available. I tried running it through Xcode as well as opposed to the shell to no avail. Xcode actually marks it as an error in the editor. I just upgraded to OS X 10.8 and Xcode