OS command before msg processing: In sender FTP

hi all,
           i have a file-to-file scenario.Now i have to pick the latest file from FTP folder based on timestamp.All the files are named in yyyymmdd format .I came to know that i can run an OS command before message processing to delete the old files and keep the latest file in the folder.
But i do know know how to write the script for this particular requirement.Can anybody please help me out with the code???
regards,
Nisheeta

HI,
If you want to delete filenames from Adapter use the following sample code:
File adapter OS Command: D://server_dir//subdir//myCMDfile.bat %F
Batch file:
del %1 new_filename_with_path
OR
Please see the below links
/people/michal.krawczyk2/blog/2005/08/17/xi-operation-system-command--error-catching
OS Command on FTP
OS command line script - Need help
FTP - Run OS Command before file processing
Hope this solves your problem.
Regards
Chilla..

Similar Messages

  • OS command before file processing in Sender File adapter

    Hi there,
    I'm having troubles running a os command from the sender file (NFS) adapter.  The batch file which I try to run is not getting executed at all.
    When I manually run the same batch file from the command prompt then it works perfectly.
    The OS command looks like this from the adapter config:
    myserver\xi\interface\in\dothis.bat
    I have also try with this notation
    G:\myserver\xi\interface\in\dothis.bat
    Please give me some tips how can I solve this problem, is there any way how can I debug the OS command? When I look at the adapter monitonr no errors are showed.
    Thanks for any tips.
    Roberto

    Hi all,
    The problem is solved.
    Issue: File Receiver Channel does not execute the OS Command before message processing.
    Reason: XI always expects an input file (in my case the sender communication channel) on the source folder. If no input files are found then the rest of the adapter configuration is not executed at all.
    In our scenario the OS command is responsible for retrieving the input files from a FTP server the adapter. SO XI will never trigger the OS Command.
    Solution: Place a dummy input file on the source folder , the sender adapter will always read in this file and put it back on the same location.(e.g. using a condition in the receiver determination).
    Thanks,
    Roberto

  • FTP Adapter with Runtime OS Command before Message Processing

    Hi PI Techies,
    I have a confusion in using Sender FTP Adapter with Runtime OS Command before Message Processing.
    Scenario is like this:
    Ftp Adapter has to pick a file from FTP server after it checks that a Blank Marker file exists on PI server AL11 directory say "tmp directory".
    For this I am using Runtime OS Command before Message Processing where a shell script will check the existence of Blank Marker file on PI server AL11 and if found , it exits the script and FTP Adpater will then pick the Actual Data File and Process it.
    Now Confusion:
    I am confused in technical execution of steps by FTP Adapter..
    Whether FTP Adapter polling initiates the Interface or Runtime OS command checking the File existence will initiate the Interface?
    May be its follish to you guys... but please answer ..
    Regards,
    Anurag

    Hi,
    I will take it other way as we need to process the Data File not Marker File ( its just for checking the Data File is completely written on FTP server).
    Other way mean " Will Poll for Data.txt File and if  found then Runtime OS Command will do connect to FTP and check if Marker File exists, if yes then delete the marker file and read the actual Data File for processing.
    Please let me know, if Marker File does not exists on FTP folder, will it still read the Data File or will it exit the Adapter execution?
    Your help is much appreciated.
    Regards,
    Anurag

  • File-FTP command before message processing

    Hi experts,
    my requirement is as follow :
    i have 5 files on my FTP server. All are named FILE_hhssmm.xml
    In the configuration of my CC out, i have put as specific file name to get picked 1*.xml
    I need a command line in the 'run operating system command before message processing' that renames one of the files as 1FILE_hhssmm.xml so that the files get picked one by one.
    I can not manage to do that, i only managed to write a batch file but i only can run it locally...
    please, any help would be greatly appreciated...
    Kindly,
    Jamal

    Hi
    I have been following this for a while (from other posts as well), you are trying quite hard to get this done
    I have couple of ideas...
    If you think that this is not going to work, then you can try another solution,
    - let the .bat file be scheduled by the scheduler of your OS (this is quite simple) say every 30 mins
    - make the .bat file move your input files from your current folder to a child folder
    - let XI poll the child folder, every 5 secs or so... anyway your scheduler will send the file only after every 30 mins
    - Now you need not rely on the OS command from the Fileadpater of XI
    My suspicion (though it is not documented anywhere in help, as far as I know) is that the OS command executes only if there is proper reading of the file (or its presence as per the configuration in adapter settings) & not per polling of the adapter. I infer this from your previous post. but your requirement is peculiar that though the file is present that itself has to have a different name - to be read by adapter...some kind of clashes ??!!.
    The problem could be something else also, but the above is a possibility as well..
    all the best
    Regards
    Vishnu

  • FTP - Run OS Command before file processing

    Hi,
    I have a requirement wherein I need to FTP a file from XI to a folder in a FTP server . Now FTP Server is set up in such a way that I cannot put the file directly. Before transferring the file , I have to use CD ( change directory command ) to access a particular folder and then transfer the file. This means that I cannot give the folder information directly to TARGET DIRECTORY.
    To address this, I decided to use the feature "Run OS Command BEFORE file processing " . And wrote a command 'cd <foldername> .It is not working. Then I tried using "Run OS Command AFTER file processing "  and it also didnot work.
    Does anyone have any clue how can I address this requirement using FILE Adapter.
    thanks,
    rakesh

    HI,
    OS commands will be executed in XI server not in the FTP server. So first you need to connect into FTP server and then you need execute CD command.
    option 1) Get the absolute path ie direct path from FTP server so that you can directly connect to FTP server's specific directoty
    22) In this case , write the file into your XI server itself by NFS File Transport protocol. Then ftp this file from your XI server into FTP server using Shell Script.
    So write a shell script which will be executed in the XI server, inside this write a logic of tranfer of files with FTP protocol. This shell script is executed from the Reciever File adapter with the option OS command.
    Hope this helps,
    Regards,
    Moorthy

  • Runtime OS command before Message processing

    Hi all,
    I have a scenario where the input file from a particular FTP server has to be moved to XI server and then process the message from there. For this I am trying to use "Runtime OS command before Message processing" My problem is that how do I define it in the normal adapter configuration i.e. File access parameters for the sender.
    My Query is:
    Now should I use the NFS protocol or the FTP protocol ie.in the File access parameters should I specify the directory from which the file needs to be processed after movement to the XI server or should I specify the FTP server details choosing the FTP protocols.
    Also provide me some links on how to configure using OS commands.
    Thanks & Regards,
    Nithiyanandam

    Hi,
    U can use NFS ...also for RUN Operating sysyrm command
    Try using RUN OPERATING SYSTEM COMMAND AFTER MESSAGE PROCESING and RUN OPERATING SYSTEM COMMAND BEFORE MESSAGE PROCESING.
    You just post ur output file in some folder(Target) , lets say /usr/sap/sapout/test/.and the shell script in this path /usr/sap/bin/convert.sh (use ur Rename logic here).
    Inside the File access parameters put target directory and filename scehme and for shell script give processing parameters as File construction mode , File type and OS Command and use a space after the shell script name and the %F.
    And for input can use it directly.
    For the shell script (which u will use to rename the file after processing) you can put anywhere inside /INTERFACE/XI/ but athe time you provide the pat it will be exactly matching as from where you are using the Shell Script and the file at the coressponding places. It shud be in XI. Thats it and u r done.
    Check out these links. First one will help you in acheiving want you want.
    /people/sameer.shadab/blog/2005/09/21/executing-unix-shell-script-using-operating-system-command-in-xi
    /people/michal.krawczyk2/blog/2007/02/08/xipi-command-line-sample-functions
    /people/michal.krawczyk2/blog/2005/08/17/xi-operation-system-command--error-catching
    http://help.sap.com/saphelp_nw70/helpdata/en/e3/94007075cae04f930cc4c034e411e1/content.htm
    I hope this will solve your problem
    thanq
    krishna
    Edited by: krishnachitanya siddavattam on Mar 10, 2008 5:38 AM

  • RUN OPERATING SYSTEM COMMAND BEFORE MESSAGE PROCESSING

    hi.
    just i want to know what is the purpose of run operating system command before message processing,after message processing under file sender adapter.
    waiting for your great answer.
    bye.
    regards.
    seeta ram.

    Hello Seeta,
    let me see if I give it using a simple scenario that I implamented : i nedd to transfer a very large file from one server to the other by XI.
    to save space and network traffic I use an OS command before picking up the file to run a zip command to zip the file.
    after I transfer the file to the target server I run another OS command after the transfer to unzip the file.
    now to your second question:
    the before Os command on the target server is used mostly for checks (make sure there isn't a file by that name or backing up existing data)
    and the after sender OS command is usualy for backing up or erasing existing files (cause it is done only after the first part was finished succesfully).
    Uri Lifshitz.
    p.s.
    there was a blog obout this titled "XI as a huge file mover"
    and you can see a description and my scripts at https://www.sdn.sap.com/irj/sdn/wiki?path=/display/profile/2007/05/03/additionaltipsforusingXIasahugefiletransfer%28withbatchscripts%29&

  • OS level command before message processing

    Hello
    I am getting the files from the SFTP server through the shell script and expecting to be processed by my File sender adapter.
    I have configured my File adapter which will poll the directory into which the shell script gets the file and it is scheduled at say 60 sec duration and i had configured OS level command before message processing.
    But when i monitored my communication channel and also my directory I found out that its not executing the OS level command. I tried dropping the dummy file into the directory. This time when checked in comm channel monitoring, it executes the OS  level command and gets the file from the SFTP server and adapter polls the SFTP file as well. But i don't want to use dummy file each time.
    Is there any way by which we can always make adapter to execute OS level command. I tried various options like Process Empty files etc etc but no luck.
    Thanks in advance.
    regards
    rajeev

    Rajeev
    How about placing a dummy file of 0 bytes, setting up the 'Handling of Empty Files = Don't create message', Processing mode = 'Test' and then writing a post operating command script as well, to move all the files to archive directory except the dummy file.
    Not a clean solution but just a thought.
    http://help.sap.com/saphelp_nw70/helpdata/en/e1/69a740aa053a13e10000000a155106/frameset.htm

  • Operating command before message processing

    Hi experts,
    i have a file to jdbc scenario.
    My problem is that i want to send files that are generated on a ftp seperately.
    To do so, i wrote a .bat script to rename the files the way I want, and then the CC takes the file under the specific name I specified.
    My script works locally, it renames correctly the files.
    But how do i execute my script before the message processing on the files of the FTP ?
    I entered the name of the script in the command line, but doesnt work, looks like nothing is launched.
    Can i launch my script on the FTP ?
    Kind regards,
    Jamal

    Hi
    Check these blogs
    /people/michal.krawczyk2/blog/2007/02/08/xipi-command-line-sample-functions
    /people/santhosh.kumarv/blog/2008/07/27/glimpse-at-os-command-yet-another-scenario
    https://www.sdn.sap.com/irj/scn/wiki?path=/display/xi/sap%252bxi%252bfile%252badapter%252bos%252bcommand%252bline%252bfeature
    Regards
    Vishnu

  • Use of OS command after message processing in sender MS Access

    Hi experts,
    My scenario is as follows :
    how can i trigger a macro in ms access?...do we have OS commands ?
    as XI will be 64 bit compliant , and the MS access will be 32 bit complaint...will the OS command work in the sender channel?..
    The other option i thought abt was...
    to send the data to a table xyz, then pass an OS command to trigger the macro using OS command after processing?..
    is this a feasible solution?...kindly suggest
    sender is ABAP proxy which triggers a macro in MS access..has ne one worked on it?...have nt seen too much info on sdn
    Edited by: Ravindra Teja on Jul 9, 2009 6:54 AM

    >
    carme alentorn wrote:
    > Hi,
    >
    > Please, check user and execution permision for shell script.
    > Check with -->  sh /usr/sap/tmp//FTP_test.sh
    >
    > Regards,
    >
    > Carme.l
    Quote!
    Check Permission for script!

  • Operating System Command After File Processing in Sender File Adapter

    Hello guys,
    actually we have different interfaces, and the client to take all the files from only one directory, for example D:/DPI.
    Unitl now we had one adapter for every file with the content conversion, so we didn't have problems with that. Now we have the problem that we sould maintain an order processing files.
    We thougth that an idea could be to execute one file pointing to D:/DPI and at the Operating System Command put like: copy D:/DPI/file.txt D:/DPI/outbound/file.txt, so when file is executed, we move the next file to another directory where is pointing the adapter. Doing this we have an error on the adapter giving us the message: Could not process due to error: java.lang.NullPointerException
    We are using a Windows.
    There is anyway to do in our way, or there is a better solution to resolve this problem?
    Any other idea to do this?
    Many thanks in advance.
    Regards,
    Xavi.

    Helo Guys,
    maybe I haven't explained well.
    We have one directory with different files. We have one adapter for every file( we need for the content conversion ) using NFS and all the adapters are pointing to the same directory.
    The problem is that if we have files A.txt, B.txt and C.txt we need to process in an order.
    And the problem we see is that for every file we have one adapter, so for example if we process file A.txt with one adapter, when this part is finished, we want to process file B.txt with another adapter, and the same for the rest of the files.
    So the idea we had is to create another directories, and when A.txt has finished move file B.txt to another directory.
    However this way is not running, if we log on the PI machine and execute cmd, we can do a copy of one file from one directory to another, but when we put this sentence in the adapter in OS command if we see the adapter log we see an error executing the OS command, but we don't know what is the error, there is no more information.
    There is any way to do this or maybe we have to manage in a different way?
    Many thanks in advance.
    Regards,
    Xavi.

  • Command line wasn't executed in ftp adapter

    Hi,gurus:
        I met a problem when I used "Run operating system command before message processing" in a file to file scenario.After the message was processed successfully I found the command wasn't executed.However,the command(bat file) could be executed in XI server.
       The value of the parameter "command line" is  "c:\data\copyResult.bat %F %f".I want to use the bat file to delete the archived file after the message is processed successfully.But now it was not executed.The content of relavant file is below.Any ideas?Any help will be appreciated.
      ( Also I have referred to michal's blog about error catching,but it didn't work.)
    copyResult.bat
    ftp -s:copyResult.txt
    copyResult.txt
    open <ftp_host>
    <username>
    <password>
    cd /archive
    delete send.txt
    quit

    Hi,
    Have you tried to check the execution of BAT file directly on FTP server or may be you are trying with XI server. What are the results for it.
    Plesae check the log of each and every step ...in Runtime Worbench in Communication Channel on sender or receiver side.
    Thanks
    Swarup

  • Dynamic File selection using sender FTP adapter

    HI
    I have a FTP> SOAP scenario. In source i want to pick files based on date.
    File names would be like *****date.csv  
    Is there any way i can pick only files for current date?

    Hi ,
    You may use run operation system command before message processing option and write a script to rename the file which are of current date and specify that new filename in the sender channel.
    Regards,
    Beena.

  • Error attempting to process incomplete inbound FTP file

    We are currently receiving some large files into PI via FTP.  Here is the communication channel definition:
    Adapter Type:  File
    Transport Protocol:  File System (NFS)
    Message Protocol:  File
    Adapter Engine:  Integration Server
    Poll Interval (secs):  600
    Msecs to Wait Before Modification Check:  10000
    Our issue is that at times PI attempts to process the file before it has completed uploading, and throws this error:  "Attempt to send file failed because file was modified during processing. 2428928 bytes expected, 2675033 bytes found. Trying to resend file".  The next time the file system is polled for new files, PI selects and processes the file successfully. 
    Two questions:
    1)  Is it possible for PI to wait until the upload has fully completed before it attempts to process the file?  For example, can I run an operating system command before message processing which attempts to put a lock on the file and waits until it is successful before the file is processed?
    2)  We have implemented alert monitoring from Solution Manager for errors in PI.  These cases are throwing an alert upon the initial error, but these turn out to be false since the message is eventually processed successfully.  Can I configure Solution Manager to bypass this type of error?
    Thank you very much for your help with this.

    Hi Mark,
    >>>1) Is it possible for PI to wait until the upload has fully completed before it attempts to process the file? For example, can I run an operating system command before message processing which attempts to put a lock on the file and waits until it is successful before the file is processed?
    there is an easy way to achive it
    put the file with a different name (let's say .lfg extension for flag)
    after the application finishes uploading make sure it will also change the name to .xml etc.
    inside PI file adapter specify to upload only .xml extensions - this way it will only take the whole file
    >>>>2
    as for solman question if you do like I suggest you will not have the errors in solman
    Regards,
    Michal Krawczyk

  • Sender FTP picks up incomplete files while transfering...any clue?

    Hi !!
    After reading some posts, I understand that this problem has no complete solution yet. Am I right?
    The "Msecs to wait before Modification check" advanced option, only works for NFS, not for FTP. I am using central adapter engine.
    How about the Run OS Command BEFORE message processing...?? when does this OS command exactly runs ?? before mapping ?? after succesfully polling target directory?
    Thanks
    Matias

    I was asking for a more detailed answer...specifically this: does the Run OS command BEFORE, runs:
    - before the file adapter starts polling the source directory
    - after file adapter found any file in the source directory
    depending on the answer, I could run a shell script to "pre-rename" all files matching a condition, to ensure the poll finds them, or something like that...
    Now I'm thinking that maybe it is not important...if it runs after founding a source file, those renamed files could be found by the adapter in the next cycle of the loop.
    Thanks,
    Matias.

Maybe you are looking for

  • Image Maps link not working in Acrobat 8 3D PDFs generated from RoboHelp 7

    All of my hyperlinks work when I just generated my RoboHelp project to PDF using RoboHelp 7 with the new Adobe Technical Communications Suite (with Acrobat 8 3D). However, the links to topics within the document didn't maintain from the image maps. I

  • How do I prevent attachments from embedding into email messages in Lion on an Exchange Server?

    I work in an Exchange Server environment, one of only two Macs in a building filled with Windows machines. When I was using Snow Leopard, I had to send attachments to my fellow workers using the same mail server via plain text messages, so that the a

  • How can I tell if an install DVD is a family pack or a single-user?

    I'm now running Tiger, and want to install Leopard. I can't go to Snow Leopard because my processor is powerPC -- not Intel. I have purchased a new Leopard install DVD from a seller on Ebay. I paid for a family pack. It does not say "family pack" any

  • Flash can't load playerglobal.swc, flash.swc, ik.swc

    My copy of Flash CS4 has stopped publishing AS3 swf files. Everytime I try to export a swf I get these three warnings in the compiler errors window: Warning: unable to load SWC flash.swc, Warning: unable to load SWC ik.swc, Warning: unable to load SW

  • Partial Transfer of Assets

    Hi,    We are trying to transfer LVA assets to another asset account. The assets doesn't have no values in 01 depreciation area and having balances in tax and local depreciation area.    While using the t.code ABUMN , and entered the value in the amo