Receiver File adapter Append Mode

Hi
I have scenario where i am sending multiple idocs to file ...when i putting the file construction mode to append i can put multiple idoc in to file but i wanna do it on daily basis Means i wanna send the newly crated or changed Idoc on a daily basis to a single file ..
How can i achieve that
SV

Hi
You can achieve this using dynamic file names.
Every day different files
FileName-<DD>-<MMM>
chk these
/people/michal.krawczyk2/blog/2005/11/10/xi-the-same-filename-from-a-sender-to-a-receiver-file-adapter--sp14
/people/sameer.shadab/blog/2005/09/23/an-interesting-usage-of-variable-substitution-in-xi
/people/sravya.talanki2/blog/2005/08/11/solution-to-the-problem-encountered-using-variable-substitution-with-xi-sp12
rgds
Arun

Similar Messages

  • Appending data in receiver file adapter

    Hi EveryBody,
    I have an IDOC to File Scenario.I need to create a flat file in the receiver file adapter directory and want to append the data in the same file every time the IDOC is trigged.I have File Construction Mode as Append but still i am not able to append the data.It gives the following error : <b>Message processing failed. Cause: com.sap.aii.af.ra.ms.api.RecoverableException: file already exists and must not be overwritten</b>

    Hi,
    In Order to Append the files do the following. It worked in my case.
    >change the file creation mode to create and select the check box for overwriting the file
    >After selecting the check box change the file creation mode to Append.
    You should be able to append the files now. Please award points if it works.
    Regards,
    Saipriya.

  • 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]

  • Append in Receiver File Adapter

    Hi All,
    i want to append data into the same file in the receiver file Adapter.
    <b>for Example ..</b>I have given XYX a file name in the target directory ..for the first execration it puts the data in to the file..
    for the Next execution its not appending data to that file..
    <b>the Requirement is</b>
    for the first time XYX has data 1234
    for the next time XYZ need to add
    1234 and below this the next data must come
    2345 like this
    how can i archive this in receiver file adapter,?
    thanks
    shakif

    hello,
    if you put that question into the correct forum (i.e. XI) you'll probably get an answer within minutes.
    kind regards, anton

  • File adapter - APPEND not working

    Hi Everyone,
    I want to append a text file on the target side. I am using FCC on the receiver side and the file construction mode is "APPEND" and file type is "TEXT". When i test my scenario, the file gets created for the first time and for the next time onwards, I get an error : "Target file already exists and must not be overwritten".
    Kindly help me to solve this issue.
    Thanks,
    Laawanya

    Check the below thread for the same:
    Have you checked overwrite box?
    It should be checked as well, and also check for necessary authorizations for this.
    Appending data in receiver file adapter
    Divyesh Vasani

  • Creating file in append mode

    Hi All,
    I have below problem, please let me know your views.
    I have requirement to trigger huge data using proxy from ECC and create a single file out of it on file server. Since the data is huge, in order to avoid performance issues,  I am planning to trigger multiple message from ECC to XI. Say after every 2000 records are processed, proxy message will be triggered to XI and the program will continue execution.
    Now my problem is on the receiver side I need a single file to be created out of all the messages triggered from ECC during a single run. This i think can be done using File adapter in "Append" mode.
    However the problem is, data will contain 1 Header record and multiple Item records. In append mode the Header record will be appended multiple times in the file which is not desirable.
    Is there any way to avoid this?
    Is there any other approach that is feasible in this case where in I need to extract large data from ECC using proxy program and write it to a single file?
    Thanks for your help.
    Anand

    Hi Anand,
    I also faced this requirement and solved successfullyby using CREATEIF node function. Please follow below approach...
    So your proxy will send several files which you need to create as single file at receiver side. First file only has to create with header. So for this The proxy data which is coming first time should have header data, now compare in mapping whether header data coming in sender proxy data or not. If Header data coming then by using CREATEIF node function, create the target header structure in mapping(target header structure should have 0..1 occurance). If header data is not coming in sender proxy(this is not first proxy execution as it is not having header data) CREATEIF node function doesnt create the target header structure.
                    In receiver file adapter select append mode so that first time file will create with header as CREATEIF node function create the target structure and for the next executions of proxy it will create only data records.
    thanks,
    madhu

  • Receiver file adapter settings

    Hi,
    I have a scenario in which I need to generate a file in tab delimited format. But in the receiver file adapter configuration we have only text/binary file creation mode. By setting the File Type in “TEXT” mode will I be able to do a tab de-limited file?? Or is there any other configuration settings need to be done?
    -Ken

    Hi Amanda,
      Thank you so much for the great info. I think I can find some stuff but still it would be helpful if you could forward the doc to [email protected] Also, yeah it looks like the receiving file format would be complex with header and footer. In the content conversion can we specify header and footer?? or is there any other way to define...FYI my source file also contains header and footer..I am just a little confused on how to set up the message types for mapping...
    Many thanks..
    -ken

  • Need to get the Mail attachment name as it is to the receiver file adapter

    I am doing a Mail to File scenario. I need to get the attachment from the mail and store it on the file server. I am using the PayloadSwap bean in the sender mail adapter. My requirement is to carry forward the attachement name as it is to the receiver file adapter side and store the file with the same name.
    Did any one try doing this? I was looking at developing an adapter module but got struck as I could not find whether the attachement name is stored in the XI payload after it has got swapped using the swap bean.
    Any help would be appreciated.
    VJ

    Oops pressed the send key. Take two.
    This is becoming a damn nightmare. When I run the adapter I am getting ModuleExceptions. Can you pass your eyes over these Java config settings to see what I am doing wrong. Using NWDS CE 7.1 with PI 7.1 both at SP07. All the imports were taken from PI 7.1 after SP07 was applied. The build id of NWDS is
    SAP NetWeaver Developer Studio
    SAP NetWeaver 7.1 Composition Environment SP07 PAT0001
    Build id: 200901152336
    APPLICATION.XML
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE application PUBLIC "-//Sun Microsystems, Inc.//DTD J2EE Application 1.3//EN"
    "http://java.sun.com/dtd/application_1_3.dtd">
    <application>
    <display-name>MailPOP_EAR</display-name>
    <description>EAR description</description>
    <module>
    <ejb>MailPOP_EJB.jar</ejb>
    </module>
    </application>
    APPLICATION-J2EE-ENGINE.xml
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE application-j2ee-engine SYSTEM "application-j2ee-engine.dtd">
    <application-j2ee-engine>
    <reference reference-type="hard">
    <reference-target provider-name="sap.com" target-type="service">engine.security.facade</reference-target>
    </reference>
    <reference reference-type="hard">
    <reference-target provider-name="sap.com" target-type="library">engine.j2ee14.facade</reference-target>
    </reference>
    <reference reference-type="hard">
    <reference-target provider-name="sap.com" target-type="service">com.sap.aii.af.svc.facade</reference-target>
    </reference>
    <reference reference-type="hard">
    <reference-target provider-name="sap.com" target-type="interface">com.sap.aii.af.ifc.facade</reference-target>
    </reference>
    <reference reference-type="hard">
    <reference-target provider-name="sap.com" target-type="library">com.sap.aii.af.lib.facade</reference-target>
    </reference>
    <reference reference-type="hard">
    <reference-target provider-name="sap.com" target-type="library">com.sap.base.technology.facade</reference-target>
    </reference>
    <fail-over-enable mode="disable" />
    </application-j2ee-engine>
    EJB-J2EE-ENGINE.XML
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE ejb-j2ee-engine SYSTEM "ejb-j2ee-engine.dtd">
    <ejb-j2ee-engine>
    <enterprise-beans>
    <enterprise-bean>
    <ejb-name>GetMailAttachment</ejb-name>
    <jndi-name>GetMailAttachment</jndi-name>
    <session-props/>
    </enterprise-bean>
    </enterprise-beans>
    </ejb-j2ee-engine>
    EJB-JAR.XML
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans
    2.0//EN"
    "http://java.sun.com/dtd/ejb-jar_2_0.dtd">
    <ejb-jar>
    <description>EJB JAR description</description>
    <display-name>EJB JAR</display-name>
    <enterprise-beans>
    <session>
    <ejb-name>GetMailAttachment</ejb-name>
    <home>com.sap.aii.af.lib.mp.module.ModuleHome</home>
    <remote>com.sap.aii.af.lib.mp.module.ModuleRemote</remote>
    <local-home>com.sap.aii.af.lib.mp.module.ModuleLocalHome</local-home>
    <local>com.sap.aii.af.lib.mp.module.ModuleLocal</local>
    <ejb-class>sample.GetMailAttachment</ejb-class>
    <session-type>Stateless</session-type>
    <transaction-type>Container</transaction-type>
    </session>
    </enterprise-beans>
    </ejb-jar>
    SENDER MAIL ADAPTER modules
    1 AF_Modules/PayloadSwapBean Local EB 1
    2 GetMailAttachment Local EB 2
    3 sap.com/com.sap.aii.adapter.mail.app/XIMailAdapterBean Local EB 3
    1     swap.keyName          payload-name
    1     swap.keyValue          MailAttachment-1
    RECEIVER FILE MODULES
    1     localejbs/AF_Modules/DynamicConfigurationBean     Local Enterprise Bean     1
    2     localejbs/CallSapAdapter                    Local Enterprise Bean     2
    1     key.0          write http://sap.com/xi/XI/System/File FileName
    1     value.0          message.interface
    VARIABLE FILENAME SUBST WITH ASMA TURNED ON
    fName     message:interface_name
    JAVA SOURCE
    package sample;
    import javax.ejb.CreateException;
    import javax.ejb.SessionBean;
    import javax.ejb.SessionContext;
    import com.sap.aii.af.lib.mp.module.Module;
    import com.sap.aii.af.lib.mp.module.ModuleContext;
    import com.sap.aii.af.lib.mp.module.ModuleData;
    import com.sap.aii.af.lib.mp.module.ModuleException;
    import com.sap.engine.interfaces.messaging.api.Message;
    import com.sap.engine.interfaces.messaging.api.MessagePropertyKey;
    import com.sap.engine.interfaces.messaging.api.TextPayload;
    import com.sap.engine.interfaces.messaging.api.XMLPayload;
    import com.sap.aii.af.service.cpa.Channel;
    @ejbHome <{com.sap.aii.af.lib.mp.module.ModuleHome}>
    @ejbLocal <{com.sap.aii.af.lib.mp.module.ModuleLocal}>
    @ejbLocalHome <{com.sap.aii.af.lib.mp.module.ModuleLocalHome}>
    @ejbRemote <{com.sap.aii.af.lib.mp.module.ModuleRemote}>
    @stateless
    <code>GetMailAttachment</code>
    @SuppressWarnings("unused")
    public class GetMailAttachment implements SessionBean, Module {
         private static final long serialVersionUID = 7612238514043673502L;
         private SessionContext myContext;
         private MessagePropertyKey myFileName;
         public void ejbRemove() {
         public void ejbActivate() {
         public void ejbPassivate() {
         public void setSessionContext(SessionContext context) {
              myContext = context;
    @throws CreateException
         public void ejbCreate() throws CreateException {
         public void getMessageProperty(MessagePropertyKey FileName) {
              myFileName = FileName;
    @param moduleContext
               Contains data of the module processor that might be important
               for the module implementation such as current channel ID
    @param inputModuleData
               Contains the input XI message as principal data plus eventual
               set supplemental data
    @return ModuleData Contains the (changed) output XI message. Might be the
            response message if the module is the last in the chain.
    @exception ModuleException
                   Describes the cause of the exception and indicates whether
                   an retry is sensible or not.
         @SuppressWarnings("deprecation")
         public ModuleData process(ModuleContext moduleContext,
                   ModuleData inputModuleData) throws ModuleException {
              try {
                   Message msg = (Message) inputModuleData.getPrincipalData();
                   TextPayload payload = msg.getDocument();
                   String contentType = payload.getContentType();
                   // Content Type could be something like
                   // text/plain;charset="UTF-8";name="file.txt"
                   contentType = contentType.replaceAll("\"", "");
                   int i = contentType.lastIndexOf("=") + 1;
                   String fileName = contentType.substring(i);
                   msg.setMessageProperty(myFileName, fileName);
                   inputModuleData.setPrincipalData(msg);
              } catch (Exception e) {
              return inputModuleData;
    JAVA ERRORS
    2009-02-04 11:41:14     Information     Mail: calling the module processor for channel LMK_Common_Mail_Sender
    2009-02-04 11:41:14     Information     Swap: swapping by payload-name ? MailAttachment-1
    2009-02-04 11:41:14     Information     Swap: successfully swapped
    2009-02-04 11:41:14     Information     Mail: message leaving the adapter (call)
    2009-02-04 11:41:14     Information     The application tries to send an XI message asynchronously using connection AFW.
    2009-02-04 11:41:14     Information     Backward validation is enabled
    2009-02-04 11:41:14     Error     Unable to validate the message with message ID 8702df71-f254-11dd-9b9b-001a64a73518
    2009-02-04 11:41:14     Error     Returning to application. Exception: com.sap.engine.interfaces.messaging.api.exception.MessagingException: Content is not allowed in prolog.
    2009-02-04 11:41:14     Error     Mail: error occured: com.sap.engine.interfaces.messaging.api.exception.MessagingException: Content is not allowed in prolog.
    2009-02-04 11:41:14     Error     Mail: error occured: com.sap.aii.af.lib.mp.module.ModuleException

  • Error dynamic File Name in Receiver File Adapter

    Hi all,
    Dynamic file name for Receiver file Adapter Problem
    my multi mapping look like this in design mode
    messages
         message1
              SD01_E
                   FileName
                   row
         message2
              SD02_E
                   FileName
                   row
    by processing the xml look like this:
    <ns2:SD01_E xmlns:ns2="urn:lsv.de/SAP/XXX">
    <FileName>L40SA939.xiConstant</FileName>
    - <row>
    or
    <ns2:SD02_E xmlns:ns2="urn:lsv.de/SAP/XXX">
    <FileName>L40SA939.xiConstant</FileName>
    - <row>
    in file receivere adapter  i have try this but it dos not work
    payload:SD01_E,1,FileName,1
    Error:com.sap.engine.lib.xml.parser.ParserException: XMLParser: No data allowed here: (hex) 0(:main:, row:1, col:0)
    is there any way to have access to Filename  in different root elements??
    regards
    Ralf

    Hi Ralf,
    i think, you need for each XML msg (each different root element) a new adapter -> a new IF determination, new rec agreement and a new channel.
    Regards,
    Udo

  • Receiver file adapter posts multiples for singel source files

    Hi,
    I am using wild character in my input source ftp adapter but my receiver file adapter is creating multiple duplicate files. I am not sure why this happens as QOS is set to "Exactly Once" with archive processing mode. I tried with delete mode and the same error occurs. We had no problems testing it in our Dev environment but in QA its acting so strangely...Any advise is appreciated..
    -Teresa

    Hi,
    2. Homany files you posted at oubound directory?
    1.             You said duplicate files at receiver side, is the files having time stamp? if so those are not duplicate files.
    Thanks,
    Satish.

  • Receiver File Adapter - FTPEx: 550 Access denied

    Hi Experts,
    In my receiver file adapter scenario I'm getting 550 Access denied in RWB.
    I am a little confused here because I could access the FTP client from my desktop using the same User and Password informed in the Receiver CC. I also could drag and drop a file there.
    Here you have Detail Display in RWB, it seems that at least the user is working fine for PI also:
    Success: Connecting to FTP server "<FTP IP>"
    Success: Write to FTP server "192.168.10.85", directory "\Transportadoras\10326750000101\",   file "Nfe_teste.xml"
    Success: Transfer: "TXT" mode, size 8881 bytes, character encoding UTF-8
    Error: Attempt to process file failed with An error occurred while connecting to the FTP server '192.168.10.85:21'. The FTP server returned the following error message: 'com.sap.aii.adapter.file.ftp.FTPEx: 550 Access denied.'. For details, contact your FTP server vendor.
    Error MP: Exception caught with cause com.sap.aii.af.ra.ms.api.RecoverableException: An error occurred while connecting to the FTP server '192.168.10.85:21'. The FTP server returned the following error message: 'com.sap.aii.adapter.file.ftp.FTPEx: 550 Access denied.'. For details, contact your FTP server vendor.
    Regards,
    Daniela
    Edited by: Daniela Machado on Aug 11, 2010 10:18 PM

    Hi Daneial,
    This is an issue due to any firewall or proxy between your Xi system and the FTP.In this case the direct logon
    works with same user but when XI tries to create file at runtime you get this error due to network issues.
    To resolve this contact your Basis/Network guys  and
    1. Set the permissions to FTP User you are using as 777 rights(full access to read , write and delete)
    2.If you have access to PI server, try to telnet /connect to ftp using command prompt (open ftp .....) the FTP server form there, you should see the same error there , inform this to your network guys.
    3.Clear all the files places already in the ftp (take backup) and test afresh after permissions are set by basis team.
    Regards,
    $rinivas

  • Receiver File Adapter - File Content Converstion

    Hi,
    I have an xml-output (as a string) but I need to use the content converstion tool in the receiver file adapter to make this into one string without the nodes etc. Example of the format that i want the file to be in:
    1AXXX10363501       00000013PC..........etc.
    And I need each instance of SBR in a new row. How can I do this? Please tell me if things are unclear.
    Example of the structure the file has now without content converstion.
    <?xml version="1.0" encoding="UTF-8"?>
    <StockBalanceFlatfile><Rows><SBR>
    <Type>1</Type>
    <Mode>A</Mode>
    <Owner>XXX</Owner>
    <SKU>10363501</SKU>
    <Quantity>00000013</Quantity>
    <UOM>PC</UOM>
    <Attr1>2476</Attr1>
    <Status>0000</Status>
    <Filller>----
    </Filller>
    <ELM>*</ELM>
    <CRLF>CRLF</CRLF>
    </SBR></Rows></StockBalanceFlatfile>
    Best Regards
    Claes

    Claes,
      Use the below content conversion parameters.
    <u>Content Coversion Parameters</u>
    <b>Recordsetstructure</b>    StockBalanceFlatfile,Rows,SBR
    <b>Name</b>     <b>Value</b>
    SBR.endSeparator           'nl'
    If it doesn't help, reply back.
    Best Regards,
    raj.

  • 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.

  • Multiple Header line in Receiver File adapter

    Hi,
    I have an issue in Receiver File adapter with multiple header lines. I am able to get only 1 header lines in the receiver file but not multiple header lines with 'nl' since it is static in file mode
    [CommunityTag:Header]
    empNo,EmpName,Age
    [CommunityTag]
    I tried with the below in content conversion one as below with no luck
    Root.addHeaderLine=1
    Root.headerLine=[CommunityTag:Header] 'nl' empNo,EmpName,Age 'nl' [CommunityTag]
    Root.fiedSeparator=,
    Root.endSeparator='nl'
    I am getting the Header line as same row as static text.
    Can you advise this.

    Hi Gabriel, I suggest to produce the header lines from additional nodes in the message payload. That means you need to modify the data type of the target message in order to generate an extra structure in the payload. Use constants in message mapping to generate the header column names, e.g.
    <Header>
      <H1>CommunityTag:Header</H1>
      <H2>empNo,EmpName,Age</H2>
      <H3>CommunityTag</H3>
    </Header>
    In content conversion you have to convert the Header row with
    Header.endSeparator='nl'
    You won't need parameter addHeaderLine anymore then.
    Regards, Martin

  • File Conversion error in Receiver File Adapter

    Hi ,
    I am facing the below error in  receiver file adapter .
    Conversion initialization failed: java.lang.Exception: java.lang.NumberFormatException: For input string: "4|8|10|2|10|4|10|4|40|40|40|1|20|2|20|8|40|0|12|12|12|1|12|4|4|8|40|8|8|8|8|12|40|8|10|10|10|10|10|1|10"
    Kindly suggest !
    Regards,
    Hemanthika

    Hi,
    Check it - File adapter is active ? try to Re-activate the same.
    Also do CPACache Refresh.
    Still problem, tyr out by restarting the Adapter Engine.
      I guess you're just trying to send all the data in your file record to a <data> element as a whole. If so, this blog will help you:
    Configuring Generic Sender File CC Adapter
    Under certain operating system platforms, such as Solaris, the APIs used by the Java Runtime (JRE) are not Unicode-aware. Consequently, the JRE needs to be configured to correctly interpret the character set it receives from the operating system.
    This is configured through the "file.encoding" system property as well as the "LANG" environment variable.
    Make sure you set "file.encoding" to a character set (such as ISO-8859-1) that supports the special characters you would like to process. This system property can be configured by appending "-Dfile.encoding=<encoding>" to the Java VM parameters section of the SAP J2EE Config Tool.
    Additionally, you need to set the "LANG" environment variable to a locale that supports more than 7 bits, such as "de.ISO8859-1". The encoding you specify in the LANG environment variable needs to match the encoding set via "file.encoding".
    You can persistently configure the environment variable by setting it in the profile $HOME/.sapenv_$HOSTNAME.csh of the <sid>adm user: setenv LANG de.ISO8859-1
    Refer this article
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/10dd67dd-a42b-2a10-2785-91c40ee56c0b
    See below link
    http://help.sap.com/saphelp_nw04/helpdata/en/bc/bb79d6061007419a081e58cbeaaf28/content.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/d2/bab440c97f3716e10000000a155106/content.htm
    Please refer this thread .
    File Adapter Not Initialized Error
    Cheers,
    Regards,
    Suryanarayana

Maybe you are looking for