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

Similar Messages

  • Creating a file in append mode

    Hi All,
    I have a requirement where in i need to create a flat file in append mode . The requirement is as follows :
    - In a week , SAP sends certain number of IDOCs to XI . For the first IDOC that comes in ,XI has create a file and later for the rest of the IDOCs ,XI just has to append the file contents .
    - During the End of the week , the target system picks this file for processing.
    My file structure is as follows:
    Header
    seg1
    seg2
    seg2
    seg3
    seg3
    seg1
    seg2
    seg2
    seg3
    seg3
    Trailer.
    So ,while creating a file in append mode , is there any way apart from creating one more interface to pick the finally created file , i can make sure that the file gets written in the above format without header and trailer getting repeated.
    Regards
    Vinay P.

    Hi, Vinay
    If you don't want to use a new interface, you can use a operating system command in your target communication channel..
    The OS script must:
    pick up only one header line and move it to a temporal file. For example, with UNIX command you can do that with
            grep "criteria" file | head -1 > temporal_file
    pick up each detail line and move it to the temporal file.
    pick up only  the last trailer line and move it to the temporal file
    Rename temporal file to final flat file.
    Regards,
    Carme.

  • Open file in append mode

    I am using JSR-75 for file IO. How can i open a file for writing in append mode?

    Don't create multple threads on the same topic:
    http://forum.java.sun.com/thread.jsp?forum=31&thread=505132&tstart=0&trange=30
    Now people don't know which thread is the active thread or which one they should respond to.

  • File in appending mode

    hi all
    when i try to write to a file i just have the last line added and the pervoiuse ones are overwritten
    how can i keep everything added to the file appear??
    what is the appending mode for the file to keep accumelating things rather than overwrite them??

    ok here you are
         PrintWriter outT=
                        new PrintWriter(     
                          new BufferedWriter(
                                  new OutputStreamWriter(
                                          new FileOutputStream("D:/eng.txt"),
                                          enc)) );
               outT.close();
    //These   appending mode
               outT = new PrintWriter(     
                          new BufferedWriter(
                                  new OutputStreamWriter(
                                          new FileOutputStream("D:/eng.txt",true),
                                          enc)) );maybe the problem is with the menu?? cos each time i use getSelectedText() and then i add the selected text to the file and after another select also i want to keep it in the same file
    so select add then select add and so on but each time i just have the last choosen text
    what is your suggestion now????

  • Open file in append mode in JSP

    Hi;
    I am using the java.io.* import attribute in my jsp page and I can write to a txt file, bvut it overwrites on the older file. How do I append to the file, here is my code
    import="java.io.*" %>
    <%
    File fileObject = new File("C:/db/data.txt");
    fileObject.createNewFile();
    FileOutputStream fileStream = new FileOutputStream(fileObject);
    DataOutputStream dataStream = new DataOutputStream(fileStream);
    dataStream.writeChars("Line one\n\r");
    dataStream.writeChars("Line two\n\r");
    dataStream.close();
    out.print("The new file has been created <br>");
    %>
    </body>
    Appreciate help!!! Thanks
    lakshmi

    Go and read the API for java.io
    Use the alternate constructor, which takes a boolean parameter, saying whether to append to the file.
    ie
    new FileOutputStream(fileObject, true);
    If you are writing a text file, you might consider using a FileWriter rather than a FileOutputStream.
    Cheers,
    evnafets

  • 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

  • Corrupt file error while writting a file in compress mode

    Hello,
    I have a scenario where i am writting data in a file in appending mode with filter 'compress' addition using open dataset, on Al11 for the first set of records it works fine but if this file is accessed again for writting data in next select statement ( its between select endselect),the file is getting corrupted, if i try to open this file corrupt file error come. can someone help.
    Thanks and Regards,
    Gunjan

    Hi Gunjan,
    Unfortunately, you can't do in that way. The behaviour of that OPEN and FILTER 'compress' clause is to create a compacted file, to be read later, but it can be appended... all your writes go to a pipe and when you close the file this is sent to 'compress' program or other filter and than a compacted file is created.
    You can't go back and start inserting again after close it.
    Follow documentation:
    http://help.sap.com/abapdocu_70/en/ABAPOPEN_DATASET_OS_ADDITION.htm
    The addition FILTER must not be used together with the addition AT POSITION or for the access type FOR UPDATE.
    Regards, Fernando Da Ró

  • File Adapter Append issue

    Hi Iam trying to write a write a file in append mode using a file adapter(on a file which already exits)...but it says...file already exists...What might be the issue...?
    Thanks in advance!
    Larry

    Hi Guys,
    I shall explain the issue Iam having...Iam using the File Content Parameters..and the output is a plaint text file(Flat File).We are using Dynamic file configuration to populate the file name as per our requirements.When I dont use the dynamic config...(giving the name in the communication channel) the file is created @ the first time and its getting appended the next time..But when I use the Dynamic Configuration the file is not getting appended and it leaves an error saying the file is already there and cannot be overwritten...
    Please advise!
    Thanks in advance!

  • How to append in an encoder created file

    I'm using XMLEncoders and XMLDecoders for storage of java objects. Currently I've tried on simple data types only. But the problem is if I want to operate on the XMLEncoder created file from two different programs, then it is giving errors. In one program I'm executing
    XMLEncoder e = new XMLEncoder(new BufferedOutputStream
    (new FileOutputStream("polledobjects.xml")));
    e.writeObject(...);
    e.writeObject(...);
    e.close();
    and in another program I want to append to append a few more objects in the same polledobjects.xml, so I created another XML encoder object and opened the polledobjects.xml in append mode.
    XMLEncoder e1 = new XMLEncoder(new BufferedOutputStream(new
    FileOutputStream("polledobjects.xml",true)));
    e1.writeObject(...);
    e1.writeObject(...);
    e1.close();
    Now, Decoder works fine till the point it goes thru xml portion created by the first program, but as soon as it reached xml portion created by the second program, it gives the error->
    java.lang.ArrayIndexOutOfBoundsException: 2
    at java.beans.ObjectHandler.dequeueResult(XMLDecoder.java:272)
    at java.beans.XMLDecoder.readObject(XMLDecoder.java:150)
    at Convert.main(Convert.java:57)
    XML file created is :-
    <?xml version="1.0" encoding="UTF-8"?>
    <java version="1.4.2" class="java.beans.XMLDecoder">
    <object class="Data_to_Poll">
    <void property="active">
    <boolean>true</boolean>
    </void>
    <void property="agent">
    <string>192.9.200.151</string>
    </void>
    </object>
    </java>
    <?xml version="1.0" encoding="UTF-8"?>
    <java version="1.4.2" class="java.beans.XMLDecoder">
    <object class="Data_to_Poll">
    <void property="active">
    <boolean>true</boolean>
    </void>
    <void property="agent">
    <string>192.9.200.151</string>
    </void>
    </object>
    </java>
    I know it is giving problems b'cos it is encountering <?xml tag 2 times in the same xml document, but what should I do if I want to append in the same xml file and in the second program nothing more than filename is known...
    plz. help me out....

    Well, Instead of writing different objects in the same stream.
    e.writeObject(obj1);
    e.writeObject(obj2);
    First put them in some collection. for eg. a List or Set
    Set set = new HashSet();
    set.add(obj1);
    set.add(obj2);
    and then serialize the set e.writeObject(set);
    Does this sound like a solution ?

  • Problem with Append mode in File Receiver

    Hello,
    I am facing some problem with Append Mode in File Receiver.
    In channel config, i have given :
    Construction Mode : Append
    File Type : Text
    Message Protocol : File Content Conversion
    The size of the file which i am trying to send is about 9.5MB.
    I got this error,
    "Recovering from loss of connection to database; message
    loaded into queue by recover job: System Job (Failover Recovery)".
    So, it would seem that there was a loss of connnection to the database    
    while the file was being written.
    Note -  XI successfully recovered from the connection loss and   
    successfully wrote the file, however since the communication channel  
    was set to append, it appended to the partial file that was written   
    before the database connection loss. This is not correct. The file    
    should have been overwritten after the recovery even though the communication
    channel was configured to append.                                     
    Can anyone help me on this regard.
    Thanks,
    Soorya.

    Hi Venkat,
    I would suggest u to split the file in to chunks if u face any problem in processing at a time in append mode and also
    Memory Requirements are must 4 processing huge files:
    Q: Which memory requirements does the File Adapter have? Is there a restriction on the maximum file size it can process?
    A: The maximum file size that can be processed by the File Adapter depends on a number of factors:
    o The most important one is the size of the Java heap, which is shared among all messages processed at a certain point in time. In order to be able to process larger messages without an out of memory error (OOM), it is recommended to increase the size of the available Java heap and/or to reduce the concurrency in the system so that fewer messages are processed in parallel.
    o Another factor negatively influencing the maximum message size in releases up to and including XI 3.0 SP 13 is an enabled charcter set (encoding) conversion if the message type is set to "Text".
    o Using the transport protocol "File Transfer Protocol (FTP)" also uses more memory for processing than the transport protocol "File System (NFS)" (up to and including XI 3.0 SP 13).
    o If the Message Protocol "File Content Conversion" is used in a File Sender channel, consider that not only the size of the input file affects the File Adapter's memory usage, but even more the size of the XML resulting from the conversion, which is usually a few factors larger than the original plain text file.
    To reduce the memory consumption in this scenario, consider configuring the setting "Maximum Recordsets per Message" for the sender channel. This will cause the input file to be split into multiple smaller mesages.
    Plz do refer the following links:
    U may plan the availability of ur communication channel using "Planning Availability Times" feature
    http://help.sap.com/saphelp_nw04/helpdata/en/45/06bd029da31122e10000000a11466f/frameset.htm
    /people/sravya.talanki2/blog/2005/11/29/night-mare-processing-huge-files-in-sap-xi
    hi check the below links for reference
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/10748ef7-b2f0-2910-7cb8-c81e7f284af5
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/7086f109-aaa7-2a10-0cb5-f69bd2affd2b
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/2498bf90-0201-0010-4884-83568752a857
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/cc1ec146-0a01-0010-90a9-b1df1d2f346f
    Regards,
    Vinod.

  • Write to text file. Append to existing file. Create file if file doesn't exist.

    Hi folks,
    up to LabVIEW 7 there was a wonderful "Write to Text File" vi which allowed the option "Append to File". Now, in LabVIEW 8, this old vi is not longer supported anymore. Instead, I am suggested to use a new "Write to Text File" vi. This vi does not offer the option "Append to File" anymore. Rather it is proposed in the online help that one should use the "Set File Position" in order to append text to the file. This much less straightforward than the old solution. Furthermore, I miss an option which would create the complete path if it doesn't exist yet.
    To summarize: Isn't there really any smart "Write to Text File" vi available which offers both the options "Append" and "Create path if file does not yet exist". Of course, I could write such a file on my own but I am sure that it is of such general interest that it already exist. In any situation, when a log file shall be written, the wanted vi would be ideal.
    Thanks a lot,
    Peter

    Ray,
    I know that the old vi is still available. See the screenshot which I attach to this message. What I am missing is an option "Create file or even complete path if file or path do not yet exist.". Is there any reason why NI doesn't provide neither this option nor a simple "Append to file" functionality in the new "Write to Text File" vi?
    Regards,
    Peter
    Attachments:
    Clipboard01.png ‏7 KB

  • Error when creating Oracle12c PDB using DBCA response file in silent mode

    I am getting an Oracle dbca NullPointerException when trying to create a PDB (Pluggable Database) usingdbca response file in silent mode.
    I have a Oracle 12c CDB up and running, listener is also up, $ORACLE_HOME and $ORACLE_SID are also set correctly.
    After database install and creating CDB using response files, I am now trying to create a PDB using dbca response file. Contents of dbca.rsp -
    [GENERAL]
    RESPONSEFILE_VERSION = "12.1.0"
    OPERATION_TYPE = "createPluggableDatabase"
    [CREATEPLUGGABLEDATABASE]
    SOURCEDB = "orcl"
    PDBNAME = "dev"
    CREATEPDBFROM = "DEFAULT"
    PDBADMINUSERNAME = "oracle"
    PDBADMINPASSWORD = "oracle"
    CREATEUSERTABLESPACE = "true" 
    I tried following commands:
    dbca -silent -responseFile /<file path>/dbca.rsp dbca -silent -createPluggableDatabase -responseFile /<file path>/dbca.rsp
    Both give same error:
    ---- Begin output of /u01/app/oracle/product/12c/db_1/bin/dbca -silent -responseFile /<file path>/dbca.rsp
    STDOUT:
    STDERR: Exception in thread "main" java.lang.NullPointerException
    at oracle.sysman.assistants.dbca.backend.CommandLineArguments.processResponseFile(CommandLineArguments.java:6885)
    at oracle.sysman.assistants.dbca.backend.CommandLineArguments.process(CommandLineArguments.java:4544)
    at oracle.sysman.assistants.dbca.Dbca.execute(Dbca.java:110) at oracle.sysman.assistants.dbca.Dbca.main(Dbca.java:184)
    However when I pass exact same parameters as command line arguments, dbca works absolutely fine and PDB is created: Following command runs succefully.
    dbca -silent -createPluggableDatabase -sourceDB orcl -pdbName dev -createPDBFrom default -pdbAdminUserName oracle -pdbAdminPassword oracle -createUserTableSpace true
    My environment need installation using response files only. I had used a dbca response file with "createDatabase" option for CDB and it worked fine. Error is observed only when I run it with OPERATION_TYPE as "createPluggableDatabase".
    There is an option to create PDBs along with CDB creation when OPERATION_TYPE is "createDatabase". But Oracle does not give flexibility to name PDBs in this option. If I ask Oracle to create 3 PDBs, it will name them itself like PDB01, PDB02, PDB03 and so on. This doesn't work in my deployment because of applications compile time dependencies on specific PDB names.

    Yes, I am pointing to correct response file. I have two of these. One for "createDatabase" and another one for "createPluggableDatabase".
    While the first one works absolutely fine, the one which creates PDBs always gives error.
    I tried renaming the response file like dbca_dev.rsp for PDB install but same error message. I read in another forum that rename dbca.rsp is not a good idea.
    So I kept it as dbca.rsp but built it using PDB template.
    When I try after removing -silent, it tries to launch a UI installer. Since I am in Amazon AWS platform, my instance is CentOS based which doesn't support Xwindows display.
    I am stuck with -silent install only. When I try with -progressOnly, I get exactly same error.
    Also tried removing some parameters but still get exact same error message.
    Tried same trick with "createDatabase" response file, now I see parameters missing error message.
    It seems like Oracle doesn't like response file install for "createPluggableDatabase".

  • I have nine, 1-page PDF files that are accessible and need to combine into 1 PDF file.  I have tried appending, adding and the combine PDFs process. The file created is not keeping my changes. The created file is partially accessible but I have to re-fix

    I have nine, 1-page PDF files that are accessible and need to combine into 1 PDF file.  I have tried appending, adding and the combine PDFs process. The file created is not keeping my changes. The created file is partially accessible but I have to re-fix issues I had fixed in the single files. I need suggestions on what else can be done if any. Using Acrobat pro XI.

    Out of habit, I tend to combine PDF files in the Page Thumbnails pane by right-click then "Insert Pages" -> "From File". For me, this preserves the tags from both documents, although the tags may have to be moved into the right location (if I recall correctly the tags for the inserted pages get put at the end of the tag structure, regardless of where the pages are inserted), If I first put the tags for the document to be inserted inside a container tag like Section, it makes the process easier. Moving that set of tags to the right place is the only re-fixing that I recall having to do. What behavior are you experiencing?
    a 'C' student

  • About  "Append mode" of cs6, cc & cc2014 project file in order to insert xml sequence which is sent from 3rd-party tool

    let me ask you all something about  “Append mode” of cs6, cc & cc2014 project file in order to insert multiple xml sequence  which is sent from 3rd-party tool  into specific project file .
    Finalcut pro 7 & x  was supported this , but i am not sure will support this on cs6, cc & cc2014 .
    is this possible ??
    could someone  let me know about this - append mode possible or not ?? 

    let me ask you all something about  “Append mode” of cs6, cc & cc2014 project file in order to insert multiple xml sequence  which is sent from 3rd-party tool  into specific project file .
    Finalcut pro 7 & x  was supported this , but i am not sure will support this on cs6, cc & cc2014 .
    is this possible ??
    could someone  let me know about this - append mode possible or not ?? 

  • How to create file on application server?

    how to create file on application server?

    Hi,
    The following program illustrates the creation of ifle in app server and reading the file from appli server:
    DATA: ITAB LIKE vbakOCCURS 0 WITH HEADER LINE.
    PARAMETERS: P_VBELN LIKE VBAP-VBELN.
    START-OF-SELECTION.
      SELECT *
        FROM VBAP
        INTO TABLE ITAB
    WHERE VBELN = P_VBELN
        PERFORM WRITE_DATA.
        PERFORM READ_DATA.
    *&      Form  WRITE_DATA
          text
    -->  p1        text
    <--  p2        text
    FORM WRITE_DATA.
    OPEN DATASET 'VBAP_DATA' FOR OUTPUT IN TEXT MODE.
    LOOP AT ITAB.
    TRANSFER ITAB TO 'VBAP_DATA'.
    ENDLOOP.
    CLOSE DATASET 'VBAP_DATA'.
    CLEAR: ITAB, ITAB[].
    ENDFORM.                    " WRITE_DATA
    *&      Form  READ_DATA
          text
    -->  p1        text
    <--  p2        text
    FORM READ_DATA.
    OPEN DATASET 'VBAP_DATA' FOR INPUT IN TEXT MODE.
    DO.
    READ DATASET 'VBAP_DATA' INTO ITAB.
    IF SY-SUBRC <> 0.
    EXIT.
    ENDIF.
    APPEND ITAB.
    ENDDO.
    CLOSE DATASET 'VBAP_DATA'.
    LOOP AT ITAB.
    WRITE:/ ITAB-VBELN,
            ITAB-POSNR.
    ENDLOOP.
    ENDFORM.                    " READ_DATA
    If it is helpful rewards points
    Regards
    Pratap.M

Maybe you are looking for