Inserting new line in an array

I need to insert a line of data into a file
These are the steps I am taking
1)read the old file
2)put each line of old file into a single demention array element (248 lines)
3)add one more empty element to array (one more line)
4)shift the last four elements "down" one element <---THIS IS WHERE I AM HAVING PROBLEMS
5)insert new data into element at element 244
6)convert string array in to string
7)write the file
I am having trouble juggling the array to insert the new line.
Attachments:
lineinsert.jpg ‏54 KB

Thanks, but I guess I forgot to mention I am using Labview 5.11 and do not have the Insert into array function.
I ditched shifting and inserting into an array all together and went a completly different route.
Convert file to array
Split array at element 244 (location where new line is to be added)
Write first half of file to disk
Append the new line to the file
Append the remaining lines to the file
Message Edited by RTSLVU on 04-25-2007 11:04 AM
Message Edited by RTSLVU on 04-25-2007 11:07 AM
Attachments:
LineInsert2.jpg ‏39 KB

Similar Messages

  • Inserting new line to a text file at position #

    Hi,.
    Is it possible to do this in java?
    1. Open a new text File (woutFile)
    2. woutFile.write(" line #1\r\n"); // write new line
    3. woutFile.write(" line #2\r\n"); // write new line
    4.woutFile.write(" line #3\r\n"); // write new line
    5. Go to line #2 position on a text file
    6. Insert NEW LINE between line #2 and Line #3
    7. move to the end-of-file
    8.Close the file
    Please help

    Is it possible to do this? please look at question
    inside comments.Your question has already been answered. Beyond that,
    if you have some code and you want to know if it will
    work, then run it and see.The answer was no. It's one of the fundamental properties of files that you cannot insert content in the middle, just at the end. To insert content you first have to make room for it. In this respect a file works like an array and not like a linked list.

  • How to insert new line in the copied schema with transaction code PE01?

    Dear Experts,
             I have copied HKT0 to ZKT0 , i want to insert new line between  line 150 and line 160 in ZKT0, I don't know how to insert new line 160, who can tell me ?
             Looking forward to your reply.
    Best Regards,
    Merry

    Hi,
    1. Open your schema,
    2. In first colume "Line" select line where you want to add new line,
    3. Replace first value in the column field (that indicates number of line) with character I (means insert),
    4. Press enter
    The line will be added. The same way you can add lines to PCR.
    To delete use character D.
    Cheers

  • Insert new line item in va01&va02 - urgent

    Hi frndz,
    At the time of creation standard sales order using va01.
    When user enters the sold to party in header and then
    material & quantity in line item reocrds. After user enters the details in first line. I have some checks to be executed and on the basis of that customer will get the free material that should come on second line item.
    I am getting the details which i will be inserting on new line item but the problem is that in which exit i should write the code for the same.
    So frndz could you please let me know, in which userexit I should insert this new line item. There can be more than one free material.
    If anyone has done this already, please let me know.
    I know one exit i.e.MV45AFZB but in that there are many forms. so exactly which form i should where i will write the code to insert new line item???
    Points will be awarded surely.
    Regards,
    Prashant

    HI Stephen,
    I have the same prolem. I modified the 5 global tables, but I don't see the new line in the screen.
    Can you help me with some details?
    Thx!
    Mihaela

  • How to insert new line break in XSLT mapping

    Hi experts,
    I am doing file to mail scenario, i am sending the text file as an attachment using reciever mail adapter.
    I did everything, i can able to send the mail with text file attachment, but with in the file i got multiple rows, i need to put line break in XSLT mapping.
    I did use following statement but it is inserting small rectangle between the records, the records are not separating with new lines, all are in one line.
    <xsl:text>*#xA;</xsl:text>   
    note: in real coding replace * with &
    Can anyone suggest me how to insert new line in XSLT mapping.
    My XSLT mapping as look like:
    <?xml version='1.0'?>
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:ns0="http://www.Coj.co.za/SapIsuToABSA/DirectDebitFile">
    <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
    <xsl:variable name="break">&lt;br/&gt;</xsl:variable>
    <xsl:variable name="space"> </xsl:variable>
    <xsl:variable name="newline"><xsl:text></xsl:text></xsl:variable>
    <xsl:template match="/">
    <ns1:Mail xmlns:ns1="http://sap.com/xi/XI/Mail/30">
    <Subject>Please Check Attached Direct Debit File</Subject>
    <From>S@za</From>
    <To>P@za</To>
    <Content_Type>text/plain</Content_Type>
    <Content>
    <xsl:for-each select="MT_SapIsuToABSA_DirectDebitFile/DirectDebitRec/Body">
    <xsl:value-of select="Space1"/>
    <xsl:value-of select="Cust_AccNo"/>
    <xsl:value-of select="Reserve_1"/>
    <xsl:value-of select="Cust_Name"/>
    <xsl:value-of select="Cust_Name1"/>
    <xsl:value-of select="Cust_Bank_AccNo"/>
    <xsl:value-of select="Space2"/>
    <xsl:value-of select="Cust_Bank_BranchNo"/>
    <xsl:value-of select="Reserve_2"/>
    <xsl:value-of select="Space3"/>
    <xsl:value-of select="Cust_AccNo_1"/>
    <xsl:value-of select="Space4"/>
    <xsl:value-of select="Reserve_3"/>
    <xsl:value-of select="Deduction_Amnt"/>
    <xsl:value-of select="Space5"/>
    <xsl:value-of select="Reserve_4"/>
    <xsl:value-of select="Space6"/>
    <xsl:value-of select="Action_Date"/>
    <xsl:value-of select="Space7"/>
    <xsl:value-of select="Reserve_5"/>
    <xsl:text>*#xA;</xsl:text>   
    note: in real coding replace * with &
    </xsl:for-each>
    </Content>
      </ns1:Mail>
      </xsl:template>
      </xsl:stylesheet>
    Kind regards,
    Praveen

    Hi,
    I think <xsl:text>#xa;</xsl:text> should do the trick, but depending on which OS (ux or win), the "new line" chars sequence is different (win would require a CRLF like <xsl:text>#xd;*#xa;</xsl:text>)
    Chris
    -> &
    Edited by: Christophe PFERTZEL on Apr 14, 2010 2:16 PM

  • How to insert new line character?

    Hi all,
    I have two lines to print.
    out.println("Available number of columns="+cols);
    out.println("Number of columns must be present=10");My problem is:
    i want both the lines to be printed one below the other. But, it is displayed in one single line.....
    Can anyone please tell me how to insert new line character?
    I tried with \n, '\n' and \r\n but, in vain......
    Thanks for your time.
    Regards,
    Ashvini

    You should never use "\n" directly.
    The line separator character is different on different operating systems.
    And putting quotes around it in your string will make absolutely no difference in the JSP.
    To find out what the line separator is you should use System.getProperty("line.separator");
    The JSPWriter and PrintWriter classes will automatically use this property with a println statement, so a println will always finish with a line separator.
    The issue here was that HTML by default ignores all whitespace.
    The solutions provided
    - use a <br> tag instead of a carriage return
    - use <pre> tags, which tells the browser not to ignore whitespace. That can be troublesome in JSP which generates a lot of extraneous carriage returns into the code.
    Cheers,
    evnafets

  • Inserting new line item into existing delivery using BAPI

    Hi
    can you send me the code for inserting new line item into existing delivery either using BAPI or
    Function module.
    We are using SAP 4.7 version

    Hi Sreekanth,
    Refer to this links
    New item for outbound delivery via FM/BAPI?
    /message/3976349#3976349 [original link is broken]
    BAPI_OUTB_DELIVERY_CHANGE Help - Add new line item
    hope it is useful to you.
    Regards!

  • Inserting New Line item in PO

    Hi,
    I need to insert new line item into PO if the material entered is BOM material.  My requirement is like this, If the user creates the PO with BOM material then i need to insert all the inside components as line item in that PO. Please suggest me any user exits avaiable or any way to achieve this( It's not a subcontracting PO).
    Thanks,
    Ganga.

    hi
    PCSD0001  Applications development R/3 BOMS
    PCSD0002  BOMs: Customer fields in item
    PCSD0003  BOMs: Customer fields in header
    PCSD0004  BOM comparison
    PCSD0005  BOMs: component check for material items
    PCSD0006  Mass changes user exit
    PCSD0007  Check changes in STKO
    PCSD0008  WBS BOM: Customer-specific explosion for creating
    PCSD0009  Order/WBS BOM, determine URL page
    PCSD0010  Order/WBS BOM, determine explosion date
    PCSD0011  Knowledge-based order BOM, parallel update
    PCSD0012  Customer - Mat. number/mat. number during material exch
    PCSD0013  Customer-specific processing of an explosion for BOM br
    **Please reward suitable points***
    With Regards
    Navin Khedikar

  • BOM Change - Delete an item(s) and insert new line items

    Hi,
    We need to mass update BOMs like for some of the existing BOM's we need to delete some line items and insert new line items. We want to use the BOMMAT04 IDOC in LSMW but I'd like to know couple of things before I go ahead with that approach
    For instance, I've a finished good material 12345678 and it has three components
                          a) Item 0010 Material 30101010 of quantity 10
                          b) Item 0020 Material 30101011 of quantity 11
                          C) Item 0030 Material 30101012 of quantity 12
    Now, I'd like delete Item 0010 and add a new item 0040 Material 30101013 of quantity 13. 
    In the segment E1STKOM, there is LOEKZ (Deletion Flag) but I dont want to flag for deletion but instead delete the whole line item and add a new line item.
    Is there any way to achieve this using BOMMAT04 IDOC? If not, can you please suggest me a better way to do it
    Any help is greatly appreciated
    Thanks,
    Srinivas

    Dear Srinivas,
    1.IF you want to change for an individual BOM,use CS02,select the item which you want to delete,select the entire and click on
    delete button and then add new line items and save.
    2.For Mass changes of BOM you can use CS20.
    3.Check these functional module's also if you want to change using a report,
    CS_BI_BOM_CHANGE_BATCH_INPUT   Change bill of material via batch input    
    CSEP_MAT_BOM_SELECT_CHANGE     API Bills of Material: Select BOM(s)    
    CS_CL_P_BOM_MASS_CHANGE     
    CS_CL_S_BOM_CHANGE_COMPLETE 
    Check and revert back,.
    Regards
    Mangalraj.S

  • Insert new line items in Delivery

    Hello All,
    Is there any BAPI or FM in which i can add new line item in SD delivery vl01n? The new line item will not be there in SO , but i want it in delivery. Manually i can insert new line item using VL01n , but i need FM to do the same.
    Thanks

    Hello,
    I need a Bapi or FM through which i can add new line item in delivery , maybe while creation of delivery or changing the delivery i.e. via VL01n or Vl02n. The new item will not be there in SO. It is a non valuated material.
    Helpful answers will be rewarded.
    Thank you

  • Insert new line using rule in InfoPath 2010

    Hi All,
    How to insert new line on the multiline textbox using rules. I followed the below article. But it didnt help to resolve the issue.
    http://blogs.msdn.com/b/infopath/archive/2005/03/04/385577.aspx
    Any help would be appreciated.
    Rajasekar A.C

    Hi,
    I followed the above link and it worked for me. Can you please make sure if the formulae is verified by clicking on "Verify" after entering following lines?
    concat(field1, @crlf,
    "Hello, world!")
    You can even try this link
    http://www.sharepointmaestra.com/Blog/Post/4/InfoPath---Appending-Text-in-Multiline-Field-with-Line-Feed
    Thanks,
    Avni Bhatt 
    If this helped you resolve your issue, please mark it Answered

  • CLIENT_TEXT_IO : cannot insert new line into a text file

    Facts:
    Developer 10g
    AS 10g
    Web utility
    Problem:
    i am traying to
    Open a text file. using CLIENT_TEXT_IO.FOPEN
    insert a record in to a text file using CLIENT_TEXT_IO.PUTF
    insert a new line using chr(10) or CLIENT_TEXT_IO.NEW_LINE
    or CLIENT_TEXT_IO.put_line
    insert the next record
    Close the file.
    all work except insert a new line
    Why !!!
    it was Working fine in 6i, but now in 10g and Webutil is not working
    plz help

    Hi you can put a new line in a text file using System.getProperty("line.separator"). This implementation will work for every OS.
    import java.io.*;
    class Demo{
    public static void main(String args[]) throws Exception {
    FileWriter fr = new FileWriter("FileDemo.txt");
         fr.write("AAAAAAAAAA");
    fr.write(System.getProperty("line.separator"));
    fr.write("AAAAAAAAAAA");
    fr.close();
    }

  • How to insert new line in a text file

    hi all,
    i wnat to know how can i insert a new line in a text file using java.
    for example i want the formate of the text like this
    1 2 3
    4 5 6
    until now i know only how to insert data but not new line.
    Thanks in advandce

    Hi you can put a new line in a text file using System.getProperty("line.separator"). This implementation will work for every OS.
    import java.io.*;
    class Demo{
    public static void main(String args[]) throws Exception {
    FileWriter fr = new FileWriter("FileDemo.txt");
         fr.write("AAAAAAAAAA");
    fr.write(System.getProperty("line.separator"));
    fr.write("AAAAAAAAAAA");
    fr.close();
    }

  • XSLT - inserting new line character

    Hi, hoping somebody could help me please.
    I'm attempting in 10g to convert a XML purchase-order with multiple detail lines to a CSV delimited output using an XSLT to undertake the transformation. Each line of the purchase-order, namely the header and each detail line must go on separate lines within the CSV file. This means each line must be clearly terminated with a CR-LF.
    While I can happily convert the XML purchase-order to CSV format, my experiments in inserting a CR-LF have failed, resulting in all lines collapsed onto one large line.
    According to various sources on the Net, inserting the following entry in my XSLT file should generate the new line that I'm looking for:
    <xsl:text>ampersand#xa;</xsl:text>(In the above code replace the text "ampersand" with an actual & - I'm unable to display the proper ampersand hash value xa as this HTML page renders it as newline character)
    However with no success.
    The sample program below shows the conversion process. Anybody any idea on why I'm not seeing the output with new lines?
    Your help appreciated.
    CM.
    DECLARE
    v_xml XMLType;
    v_xml2 XMLTYPe;
    v_xslt XMLType;
    BEGIN
    v_xml := XMLType(
    '<?xml version="1.0" encoding="UTF-8"?>
    <PurchaseOrder xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.xxxx.com.au/schemas/gatewayPurchaseOrder.xsd gatewayPurchaseOrder.xsd"
    xmlns="http://www.xxxx.com.au/schemas/gatewayPurchaseOrder.xsd">
    <Header>
    <GatewayPurchaseOrderNo>1234</GatewayPurchaseOrderNo>
    <PharmacyReference>2345</PharmacyReference>
    </Header>
    <Detail>
    <ProductNo>9876</ProductNo>
    <APNNo>7654</APNNo>
    </Detail>
    <Detail>
    <ProductNo>8888</ProductNo>
    <APNNo>7777</APNNo>
    </Detail>
    </PurchaseOrder>');
    v_xslt := XMLType(
    '<xsl:stylesheet version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:xs="http://www.w3.org/2001/XMLSchema"
    xmlns="http://www.xxxx.com.au/schemas/gatewayPurchaseOrder.xsd">
    <xsl:output method="text"/>
    <xsl:template match="/PurchaseOrder/Header">
    <xsl:value-of select="normalize-space(GatewayPurchaseOrderNo)"/>,<xsl:value-of select="normalize-space(PharmacyReference)"/>
    <xsl:text>ampersand #xa;</xsl:text>
    </xsl:template>
    <xsl:template match="/PurchaseOrder/Detail">
    <xsl:value-of select="normalize-space(ProductNo)"/>,<xsl:value-of select="normalize-space(APNNo)"/>
    <xsl:text>ampersand#xa;</xsl:text>
    </xsl:template>
    </xsl:stylesheet>');
    v_xml2 := v_xml.transform(v_xslt);
    dbms_output.put_line(v_xml2.getclobval);
    END;(In the above code replace the text "ampersand" with an actual & - I'm unable to display the proper ampersand hash value xa as this HTML page renders it as newline character)

    I don't know much about XSLT yet, but tickeled by the problem, after wandering over the internet and found stuff like this - http://forums.devshed.com/xml-programming-19/cannot-output-crlf-xslt-348042.html - I constructed the following...
    SQL> set serveroutput on size 50000
    SQL> DECLARE
       v_xml XMLType;
       v_xml2 XMLTYPe;
       v_xslt XMLType;
    BEGIN
       v_xml := XMLType(
          '<?xml version="1.0" encoding="UTF-8"?>
          <PurchaseOrder xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xsi:schemaLocation="http://www.xxxx.com.au/schemas/gatewayPurchaseOrder.xsd gatewayPurchaseOrder.xsd"
             xmlns="http://www.xxxx.com.au/schemas/gatewayPurchaseOrder.xsd">
             <Header>
                <GatewayPurchaseOrderNo>1234</GatewayPurchaseOrderNo>
                <PharmacyReference>2345</PharmacyReference>
             </Header>
             <Detail>
                <ProductNo>9876</ProductNo>
                <APNNo>7654</APNNo>
             </Detail>
             <Detail>
                <ProductNo>8888</ProductNo>
                <APNNo>7777</APNNo>
             </Detail>
          </PurchaseOrder>');
          v_xslt := XMLType(
             '<xsl:stylesheet version="1.0"
                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                xmlns:xs="http://www.w3.org/2001/XMLSchema"
                xmlns="http://www.xxxx.com.au/schemas/gatewayPurchaseOrder.xsd">
             <xsl:output method="text"/>
             <xsl:template match="/PurchaseOrder/Header">
                <xsl:value-of select="normalize-space(GatewayPurchaseOrderNo)"/>,<xsl:value-of select="normalize-space(PharmacyReference)"/>
                <xsl:text>AMPERSAND#xa0;AMPERSAND#xa;</xsl:text>
             </xsl:template>
             <xsl:template match="/PurchaseOrder/Detail">
                <xsl:value-of select="normalize-space(ProductNo)"/>,<xsl:value-of select="normalize-space(APNNo)"/>
                <xsl:text>AMPERSAND#xa0;AMPERSAND#xa;</xsl:text>
             </xsl:template>
             </xsl:stylesheet>');
       v_xml2 := v_xml.transform(v_xslt);
       dbms_output.put_line(v_xml2.getclobval);
    END;
    SQL>
    1234,2345
    9876,7654
    8888,7777
    PL/SQL procedure successfully completed.So first one space and then the CR-LF.
    Hope this helps?
    Message was edited by:
    mgralike

  • af:validateLongRange displaying message: How to insert 'new line' ?

    Hello,
    While using <af:validateLongRange> tag we need to display message in a well formatted way, we have to display each statement in a new line.For eg. : message as displayed by property 'messageDetailNotInRange' must come in three different new lines not as a continuous statement.I tried inserting '\n' escape sequence for new line, but it dint work.I tried spacing the statements but that also is not working out.
    Any idea how can we get this message displayed separately in three rows rather than in a continuous statement ?
    ++messageDetailNotInRange="You have entered a value more than is available. Value entered must be in the range of {2} to {3}.To delete this line, clear the value and click Delete"++
    +<af:validateLongRange id="xyz_VC1" minimum="1"+
    maximum="100"
    messageDetailNotInRange="You have entered a value more than is available. Value entered must be in the range of {2} to {3}.To delete this line, clear the value and click Delete"
    messageDetailMinimum="Minimum {0} allowed is {2}"
    messageDetailMaximum="Maximum {0} allowed is {2}"
    hintNotInRange="#{'xyz'}"/>

    Thx..Done that!! but dint get the desired result ,I put it as :-
    messageDetailNotInRange="You have entered a value more than is available.&lt;br&gt; Quantity entered must be in the range of {2} to {3}.&lt;br&gt; To delete this order line, clear the quantity and click DELETE."
    On corresponding page this message was displayed as :
    You have entered a value more than is available.<br> Quantity entered must be in the range of 1 to 100.<br> To delete this order line, clear the quantity and click DELETE.
    It dint insert line breaks in the message.Do i need to write it differently?
    Above html code is modified once i posted it, it has inserted line breaks here for the br tag i added , but in my actual .jsff page it did not . I can only see br tag displayed as part of message and no new line got inserted.
    I dont see an option to attach a file with the post so that I can show the code to you.
    Edited by: user13439821 on Aug 15, 2011 2:58 PM

Maybe you are looking for