Archive processed files at receiver file adapter

Hi Experts,
I need to archive(copy) processed messages from the target folder to another folder.
I tried using the Run OS Command after processing and not sure with the exact command.
Can anyone please provide the exact command (syntax) for copying file from the target file folder to another folder.
Do we need any authorization from BASIS team to perform this command in run OS Commandline please.
Note: the original file should not be deleted.
Thanks in advance!
Regards,
Mahakrishnan T.

hi Mahakrishnan Thangam,
                I used the OS command feature  where FTP is not used and it worked in the way I already posted. When it comes to FTP in receiver file adapter you need a batch file and a script both on PI server. The script will function as follows
1. Login to FTP server.
2. change to target folder you specified in target directory in cc.
  command: cd foldername
3.Read the file created by receiver file adapter in remote FTP location. File will be copied to local directory of PI server.
    command:  get filename
4. Now again change remote directory to archive directory.
5. Copy the file back to FTP server again from local directory to archive directory you want to copy to.
Now from batch file call this script.
Would suggest to read these links carefully
http://wiki.sdn.sap.com/wiki/display/XI/SAPXIFileAdapterOSCommandLine+Feature
http://www.cs.colostate.edu/helpdocs/ftp.html
Alter algorithms to meet your requirement.
Hope this solves your problem.
Regards
Anupam

Similar Messages

  • Having Some unknown characters in my file of Receiver Mail Adapter

    Hi All,
            I have a unique problem, I am having special characters(  #S@u201D E" E$ u201Däu201Där 4TåE$R   D0u201CC3 u0192    c@u201DÔôETÄPu201Du201Eu20220u201D 3@u201C  ó ró#  u20ACu201C  ó# ó#  u2019 ) in text file of Receiver Mail Adapter.I am providing you a part my input text file
    1747021     000070     0001     Production Baseline     ZTAN          100A     0039     2204229-1     50     PLANT3002     Honeywell Aerospace Bournemouth - R     3212774     NOZZLE     HIS     M22     12/31/2008     01/05/2009              1.000              1.000            1.000     01/05/2009     
    1745558     000100     0001     Production Baseline     ZTAN          100A     0039     801137-1     80     304030     LUFTHANSA TECHNIK AG     45111378001     WHEEL     HIS     M22     12/30/2008     01/12/2009              3.000              3.000            3.000     01/12/2009     COOP Legacy Notes - Note Type: 07N UPDATE AS OF 11/8 SH AVS Legacy Notes - Note Type: AB 1. A QTY OF 53 NEW PARTS WERE PURGED ON 3-5-99 PER KAREN MOSS' REQUEST. PARTS ARE SUSPECT OF BEING DAMAGED DUE TO BEING STORED IN ASRS IN A METAL TO METAL SITUATION.
    1740335     000100     0002     Production Baseline     ZTAN          100A     0039     3176647-4     80     341734     SAUDI ARABIAN AIRLINES CORP     8233950     VALVE, CONTROL     Jaroslav Kral     M18     12/24/2008     12/31/2008              1.000              1.000            1.000     01/23/2009     COOP Legacy Notes - Note Type: 07N D PARTS NEED TO CHEC WITH LUPE WIN ISSUIN COOP Legacy Notes - Note Type: POG REPLCS 3176647-3 AS A MANDATORY CHANGE. 3399100-11    V17138 (TAKES -4 TO -11) 3399100-11    V17139 (TAKES -9 TO -11) 3399100-10    V17140 (TAK
    1734808     000100     0002     Production Baseline     ZTAN          100A     0039     3883240-6     80     300168     IBERIA LAE     48017888601     CONTROL FUEL     HIS     M13     12/20/2008     01/10/2009              1.000
                  1.000            1.000     04/29/2009     AVS Legacy No
    Can any one help me out?

    Hi Stefan,
    I am Using Transport Protocol as IMAP4
                     Message Protocol as XIPayload
    Connection Parameters to Mail Server
    URL  -
    .mycompany.com
    Mail Attributes
    Use Mail Package
    content Encoding   base64
    Keep attachments
    I have Used the following Modules
    Processing Sequence
    Module Name                                                                Module Type                             Module Key
    localejbs/AF_Modules/PayloadSwapBean                        Local Enterprise Bean                Payload
    localejbs/AF_Modules/MessageTransformBean                Local Enterprise Bean                Transform
    sap.com/com.sap.aii.adapter.mail.app/XIMailAdapterBean Local Enterprise Bean                mail
    Module Configuration
    Module                              Parametername                           Parameter Value
    Payload                             swap.KeyName                           content-type
    Payload                             swap.KeyValue                            text/xml
    Transform                          Transform.ContentDescription       MyReport.txt
    Transform                           Transform.ContentDisposition       attachment
    Transform                           Transform.Contenttype                 text/xml

  • 0 byte txt file using receiver File Adapter

    HI,
    My scenario is Flat File to Fixed Length File.
    Mapping : Based on the condition Reciever node need to generated , In some cases it wont generate any node ( No data )
    Receiver Communication channel :  I used FCC for Fixed length Format.
    Problem : When i am generatingf the receiver file with some data it executes. But when i am generating the file with no data , it fails in the receiver comminication channel.
    Could not process due to error: java.lang.Exception: Exception in XML Parser (format problem?):'java.lang.Exception: Message processing failed in XML parser: 'Conversion configuration error: Unknown structure 'ns0:Message1' found in document', probably configuration error in file adapter (XML parser error)'
    I need the receiver file to generate with 0 bytes when there is empty data.
    can any one help on this.
    Thanks

    Hi,
    >>Problem : When i am generatingf the receiver file with some data it executes. But when i am generating the file with no data , it fails in the receiver comminication channel.
    What happens in this case is, when you send a blank file to PI it processes but once it went to Receiver Adapter, it looks out for some fields because of the FCC settings. So it throws an error/exception because some fields are expected and it is not coming. Because of that you getting below exception.
    Secondly, Once you send data with few values or fields it will process in Receiver file adapter FCC and if there is some error it throws error. this is why you getting exception in moni, and other places.
    Regards
    Aashish Sinha

  • How to create multiple files with Receiver File Adapter in SAP PI 7.31 Java Stack

    Dear Friends,
    I am using Sender JDBC Adapter and Receiver File Adapter in Integration Flow in SAP PI 7.3 EHP 1 SP08 Java Stack environment. The requirement is that we need to create multiple files based on the row count in jdbc resultset. If there are 5 rows in resultset, we need to create 5 XML files with one row elements in one file. Similarly if there are 10 rows, we need to create 10 XML files.
    So how can we create multiple files in this scenario. I tried placing a for loop in the Java Mapping as below in the transform method:
    DynamicConfiguration conf = arg0.getDynamicConfiguration();
    StringBuffer sbFileData = new StringBuffer();
    for (int i =0; i < record.size(); i++ {
         . // Create XML for each row and Marshal the object into to the String Buffer
         String strFileName = "DC_" + new SimpleDateFormat("ddMMyyyyHHmm").format(new java.util.Date())+"_"+i+".xml";
         conf.put(KEY_FILENAME, strFileName);
         arg1.getOutputPayload().getOutputStream().write(sbFileData.toString().getBytes("UTF-8"));
         arg1.getOutputPayload().getOutputStream().flush();
    So here I'm flushing the OutputStream for each record. But it's not creating the multiple file, instead it creates only one file will all record XMLs appended to each other.
    Please let me know if I missing something or need to do some thing else.
    Regards,
    Shreyansh Shah

    Hi
    You can easily achieve this using graphical mapping.  Create your target message type like below
    MT_Target
      Details  0 to 1
          Data  0 to 1
    Source sample structure
    <resultset>
    <row>
    <column-name>column-value</ column-name>
    </row>
    Then do the message mapping like below
    map <row> with  MT_Target
    contant ----> Deatils
    column-name ------>Data
    In the signature tab of message mapping, choose the occurrence of your target message type as
    0 to unbounded.
    This will generate multiple files from multiple rows.
    Let me know if you have any doubt.

  • File conversion and append file in receiver file adapter

    Hi
    I have a batch IDoc -> XI(3.0) -> file scenario with file conversion to create a flat CSV-like file. The problem is that because of the amount of data sent from R/3 (~20000 employees), the idoc is split into several idocs. In my receiver file adapter I want to append all the idocs contained in this data transfer to one flat file, before transmitting to FTP server.
    For the next batch transfer (the next day) XI should start all over and create a new file and append all idocs contained in that transfer before transmitting the flat file to FTP server.
    Can this be done using the 'Use Temporary File' and 'Append' options in the FTP connection Parameters in the comm-channel?
    It is not an option to append the file in the FTP-server, because the files in the destination folder are moved immediately after arrival, so the file will be moved before file adapter can append all the files.
    Does anyone have any suggestions to how to solve this?
    Br
    Kenneth

    Hi Kenneth
    Did you ever get a solution to this problem?
    Regards
    Russel Irvine
    [email protected]

  • When to use "Use Temporary File" in receiver FTP adapter

    Hi Experts,
    I have nerver used "Use Temprary File" as the "Write Mode" in receiver ftp adapter.
    I want to knwo under what kind of requirment we should use this option?
    Thanks in advance.
    Best Regards,

    Hi Aditya
    Usually it's advisable to use "use temporary file" as write mode when you want to avoid your file to be picked up by receiver while PI channel is still writing it.
    Obviously larger the file, more chances you have that this issue could occur.
    If you select the "use temporary file", XI will write the content to a temporary file with another name of your choice and only once writing has finished it will rename it to the actual name setup in the "file name scheme".
    Regards,
    Giuseppe

  • Problem in Overwriting the file in Receiver File adapter

    Hi  all,
    I configured my scenario Proxy to File. Every day the back ground job runs in SAP and send all Employee Details to XI, XI then write it into File in XI server, in Receiver File adapter i enable overwrite existing file.
    But some times its over writing the file some times came up with error like "Access Denied".
    Can any one tell me what could be the problem.
    Kind Regards,
    Kiran

    > But some times its over writing the file some times
    > came up with error like "Access Denied".
    This can be a Authorization problem...may be at that time you are unable to write any file in that directory..or some other application is using it and it make a lock at that time.
    Thanks
    Farooq.

  • Generating HTML Files via RECEIVER File Adapter

    Hi All,
    I have the Following Scenario: 
    R/3 ( ABAP Proxy ) -
    >XI------>HTML Files ( File Adapter ).  
    Basically I would like to generate, HTML files out the RECEIVER File Adapter.   How can this be achieved?
    I  have invested some time in thinking about a adapter module, which can do this? Any Blogs would be Helpful here.
    Is there any alternative way? 
    Any Blogs or help Links would be appreciable.
    Thanks in advance,
    Best Regards,
    Abhishek Vinayaka

    Hi
    Look these thread for Create HTML file format
    if the reciever adapter is file i want in messages to be  in HTML format
    Re: idoc-xi-file scenario.  how to display file in html format

  • 'Use Temporary File' in Receiver File channel

    hi all,
    I am facing a strange issue with receiver file channel which I am not sure if somene had already faced. I couldnt find any help from blogs..!
    I have configured the Receiver File channel with Write mode as  'Use Temporary File'  with a temporary file name(say tmp.xml)  scheme and Empty-Message Handling set to 'Write Empty File'
    When the scenario is executed, its so happening that the temporary file of 0 bytes(empty file) is being created as tmp<msgID>.xml before the actual file is being completely written. It is expected that once the Actual file is completely written, the tmp file should be deleted, but here is not the case.Thus causing both the files being present in the target location. This is not happening often though.
    As the receiving application is processing all files from the target direcotry, the file is getting errored out in the target application.
    I think the 'Write Empty File' has nothing to do with this as the option 'Write Empty File' is for empty payloads resulting from the message mapping.
    Please correct me if am wrong and also provide me the inputs on my issue. Am on PI7.0
    thanks in advance,

    Hi Tilak,
    this is real time interface
    real time by using a file... that's a non-sens according to me. You should use a non physical solution (web service, JMS, JDBC, etc...) but a not a file. well... Anyway, you can image that the receiver application schedule the folder every 30s or every 1min, that's almost a real time. Real time is mainly a conceptual view (only synchronous exchange needs really real time). Morevoer, if you really wanted a real time, you should not add a tool like PI (or other) between your source and your target system, the more we have systems, the less it's efficient (in term of delay and response time!).
    Even if we propose that the receiver application should have a condition to its script to avoid picking the tmp*.xml files, after a period of time there would be a chance that the *tmp files may increase in number..
    No ! coz if my theory is good, if your receiver application does not pick-up tmp.xml, that means this file is not currently treated and so PI is authorized to delete it. So no increase of tmp.xml files in this folder.
    Another solution: to create the target file without option "temporary", but to create it in another folder than this one scheduled by your receiver application, and use an OS command AFTER processing, in your receiver CC, which move the created file from the "temp" folder to the target folder.
    [http://wiki.sdn.sap.com/wiki/display/XI/SAPXIFileAdapterOSCommandLine+Feature]
    regards.
    Mickael

  • Mutiple sender files and receiver files with different file names

    Hi All,
    Following is my scenario: File (FTP) --> XI --> File (NFS actually SAP system)
    I have 5 source files like ABC<b>1</b>_DateTimeStamp, ABC<b>2</b>_DateTimeStamp, ABC<b>3</b>_DateTimeStamp, ABC<b>3</b>_DateTimeStamp and ABC<b>3</b>_DateTimeStamp.
    I can use single sender file FTP adapter with file name ABC* which picks up all 5 files, but can I use single receiver adapter to create 5 different files with the following file names: ABC1, ABC2, ABC3, ABC3 and ABC3 ?? And last 2 files (ABC3 and ABC3....same name) should be created after 30min and 60min of first ABC3 file. We have to do this because we have jobs scedule on SAP side with variants having file names.
    Is it possible to achieve using single sender/receiver file adapter??
    If not any suggestions how to do this scenario?? 
    Thx
    Navin

    Navin,
    I doesn't know whether its feasible for you or not. Please see the below option
    Create 3 Sender  comm.channels and 1 Receiver comm.channel. In Sender /Receiver file adapter check the Adapter Specific Message attributes.
    I'm suggesting the soln using BPM.
    In IR, Create 3 Outbound Interface (Abstract) and create 1 Inbound Interface(Abstract).
    First 2 comm.channel and 2 Oubtound interface refers to file 1 & file2 respectively.
    The 3rd comm.channel and 3 Outbound interfaces refers to file3 & file4& file 5 .
    Please see the BPM design.
    http://www.flickr.com/photo_zoom.gne?id=698877499&size=o
    Note : Navin the above suggestion is my thought, I think it will work. U can juz give a try.
    Best regards,
    raj.

  • How to ignore the empty file using Receiver file adapter with Coma separato

    Hi,
      I am trying to create the .csv file at the receiver but when there is no data I wan to ignore the file even I do not want to create the file with comma also (I just went and check in my file system created with commas)
    Source1 -> T1
           T1
            -> S1
                  ->Field1
                  -> Field2
    Because I am using receiver side FCC populating with empty node
    Based on condition T1 is populating when condition fails I am populating target T1 and structure elements are mapped with constant. 
    Ex: Target payload when condition failed below data is populating ..
    In this I want to ignore creating the file.
    <T1>
    <S1>
    <Field1/>
    <Field2/>
    </S1>
    </T1>
    Here Is the my content conversion parameters,
    S1.fieldNames - Field1,Field2
    S1.fieldSeparator - ,
    S1.endSeprator u2013 u2018nlu2019
    I used processing tab u2018Ignoreu2019 option id did not worked. Appreciate your help. 
    Regards,
    Venu.

    Hi Raj,
       I went my receiver mapping signature tab I chagned occurance from 1 to 0..1
    then my mapping got lossed now message type level I put the condition. When my condition not satisfy I am not creatin gthe target node itself.(I mean here message type) Messages ->message1 only is creating..
    but in SXMB_MONI below error I am getting..
      <?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
    - <!--  Request Message Mapping
      -->
    - <SAP:Error xmlns:SAP="http://sap.com/xi/XI/Message/30" xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/" SOAP:mustUnderstand="">
      <SAP:Category>XIServer</SAP:Category>
      <SAP:Code area="MAPPING">GENERIC</SAP:Code>
      <SAP:P1>Split mapping created no messages</SAP:P1>
      <SAP:P2 />
      <SAP:P3 />
      <SAP:P4 />
      <SAP:AdditionalText />
      <SAP:Stack>Split mapping created no messages</SAP:Stack>
      <SAP:Retry>M</SAP:Retry>
      </SAP:Error>
    Thanks for your response.
    Regards,
    Venu.

  • File To File Scenario - Receiver Channel Adapter Module

    Hello,
    We have PI 7.4 in our landscape.
    There is one File To File scenario which needs to be implemented.
    In this scenario, at source diretory we have multiple files (country wise) which needs to be read and put into mutiple folders (country wise) at the target directory.
    Please note we are not making any objects in ESR and directly configurations need to be done in Integration Directory.
    At sender side we can read mutiple files using a single Sender File adapter using the the "Advanced Selection for Source File" option.
    At receiver side we are planning to implement a custom Adapter Module which will put the files in their corresponding country wise folders.
    We are using NWDS 7.3 EHP 1 SP12 for building the adapter module.
    Suggestions are required for below mentioned points:
    1. Is the approach follwed is most suitable as we do not want to make mutiple reciever channels for each folder.
    2. How to read the file name in the receiver adapter module as Namespace will not be created (we will put a dummy namespace in ID).
    3. If any body has already implemented such logic or any suggestions for the same.
    All the suggestions are welcome and thanks in advance.
    Regards,
    Ujjwal Kumar

    Hi Ujjwal
    Yes, that is the correct namespace as long as you are using the File adapter.
    Your code is nearly there, just need the new keyword when creating a new object instance. Below is the sample
    // Get Dynamic Configuration
      MessagePropertyKey fileNameKey = new MessagePropertyKey("FileName", "http://sap.com/xi/XI/System/File");
      String fileName = msg.getMessageProperty(fileNameKey);
    // Set Dynamic Configuration
      String targetDir = "/blah/blah/blah";
      MessagePropertyKey dirKey = new MessagePropertyKey("Directory", "http://sap.com/xi/XI/System/File");
      msg.setMessageProperty(dirKey, targetDir );
    You can refer to the following SAP JavaDocs for more infomration on the Message class (which you use to get/set the property)
    Message
    Rgds
    Eng Swee

  • Regarding .trg file from receiver file adapter

    Hi,
    My scenario is IDOC to File.
    i am using file adapter at receiver side. My client want me to generate .trg file at the end once i create .dat file. After that one .net program will run and it will check for .trg file and will pick up the .dat file with the same name. They want me to do this because other applications also creating .trg file.
    They are saying that C#.net program should not pick the file before XI completes writing the file fully.
    ( .net we may have option to check whether any other aplication is locked the file, but they dont want to use that ).
    My question is, do we really need to create .trg file. What is the posibility of the .dat file being picked by C#.net program before XI completes writing the file fully if we dont use .trg file.
    Will the file visible for .net program before file fully wirten to the share folder. How file adapter works?
    Will it create a file and keep on appending the lines? OR it will write everyting at a shot?

    HI Ashok,
    You need to create two fiels .dat and .trg but should be in sequence.
    Either you can add the simple BPM i.e. Receiver step and two send steps in sequence then it will resolve the purpose.
    OR
    make the external control on communication channel to be activate in pre-defined sequence so 1st Dat file will be created and then .trg file.
    You can even schedule the communciation channels accordingly, this way you can add multiple receivers with scheduling
    Thanks
    swarup
    Edited by: Swarup Sawant on Jun 13, 2008 7:45 AM

  • Add header line to the text file in receiver file adapter

    Hello Experts,
    I have to add a new line to the text file generated at the receiver end.
    My structure is
    Record
       Item......0-unbounded
             field1
             field2
             field3
    I have defined below parameters in receiver FCC.
    RecordSet Structure : Record,Item
    Item.fieldSeparator : ;
    Record.fieldSeparator : nl
    Record.endSeparator : '0x0D''0x0A' ( this is to get a carriage return at the end of the file)
    Item.addHeaderLine : 1
    With the above configuration, i am getting the desired output with NO header line.
    Please help.
    Thanks,
    Swetha.

    Hi, it looks like that the headerline "specification is only permitted if exactly one structure is defined." Please check [SAP help under Define Parameters for Recordset Structures|http://help.sap.com/saphelp_nw73/helpdata/en/44/686e687f2a6d12e10000000a1553f6/frameset.htm].
    One solution would be to generate the header fields in the message payload. Generate an additional first line containing the header names, e.g.
    <Item>
    <field1>Header1
    <field2>Header2
    <field3>Header3

  • Receiver file adapter archiving

    Is there any mechanisam to archive the files at receiver file adapter?

    Hi Praveen,
    Use file adapter to put the file into the archive directory and use the above mentioned OS commands in "Execute OS commands after message processing" section of Receiver file adapter.. so your file will be placed in archive folder and then copied to actual folder.
    This process is followed so as to make sure that you have the receiver file archived.. suppose you have a receiver process which will read the output of PI and delete the file .. then just to make sure we have a copy in the archive location we are first putting the file in archive directory and then copying it to the correct location
    Regards
    Suraj

Maybe you are looking for