TEXT_IO ...  replace first line

Hello,
i have a small Problem with the TEXT_IO.PUT_LINE builtin
I want to write and read a .txt file with TEXT_IO
It workes fine but if i use put_line to write something in, it replace all inside my .txt file
My Question: Is it possible to replace only the first line inside my txt file
Example Forms:
Declare
     filename           varchar2(30) := 't:\test\Laufzettel.txt';
     file_handle TEXT_IO.FILE_TYPE;
     umrechnung number;
BEGIN
If :parameter.intervall is not null then
     file_handle := TEXT_IO.FOPEN(filename, 'W');
     umrechnung := :button.intervall;
     umrechnung := round(((umrechnung*60)*1000));
     TEXT_IO.PUT_LINE(file_handle,umrechnung);     
     TEXT_IO.FCLOSE(file_handle);
end if;
END;
and the .txt file looks like this:
6000
CT
CT2
Mammo
MR
US
Bestrahlung
MRT
NUK
SD
i want to replace the 6000 with another number without rewriting all the other entrys?!
Sorry for my bad English :)
Message was edited by:
user628271

If you are unix use grep command to replace the string. And this grep command can be called using host.
If you are in Windows , create a new file from the original and while creating you
can replace which ever line you needed.
Once you create the new file , delete the original file using host command.
Once you delete the old file, copy the new file to the original file name using host command.
Rajesh Alex

Similar Messages

  • Replace Mac line breaks with Windows linebreaks?

    Is there a simple AppleScript that could process a plain text file created on a Mac and replace the line breaks with Windows-compatible \r\n line breaks?
    I thought this would be a very simple task but have been searching for quite a while and can't find anything.
    Thanks.
    Paul

    There are several approaches to this. Here's one of them:
    set theFile to (choose file)
    set MacText to paragraphs of (read theFile)
    set {oldDelims, my text item delimiters} to {my text item delimiters, (return & linefeed)}
    set WindowsText to MacText as text
    set my text item delimiters to oldDelims
    set outputFile to (open for access theFile with write permission)
    set eof outputFile to 0
    write WindowsText to outputFile
    close access outputFile
    To explain, the first line asks you to choose the file in question - you could use any technique to identify the file, including hard-coding the path or using a drag-and-drop handler.
    The second line gets the current paragraphs and calls them 'MacText'
    The third line saves the current text item delimiters in oldDelims and sets the new text item delimiters to the CR+LF combination.
    The fourth line performs the magic of transforming the file. It does this by coercing the list of paragraphs (obtained in line 2) into a single text block, and it inserts the current text item delimiters between each text item, miraculously giving you CRLF-terminated paragraphs.
    The fifth line restores the text item delimiters to whatever they were before (you don't know what they were, but don't need to know what they were, as long as you restore the previous setting - it's unlikely you want CRLF moving forwards).
    The rest of the script (lines 6 through 9) reopen the file you originally selected, sets the EOF to 0 (effectively wiping the file contents), then writes the CRLF-terminated text to the file and finally closes the file.
    Note that some people might suggest using text item delimiters to break up the original text file on CRs but that would be wrong IMHO. The reason is that 'paragraphs of' can detect and handle both CR and CRLF-terminated paragraphs, leaving you with clean paragraphs into which you insert CRLFs.
    This means that if the file originally had CRLF-terminated paragraphs you'd end up with the same data, but at least there was no harm done.
    In contrast, if you simply searched for CRs and replaced them with CRLFs you could have the situation where you selected a CRLF-terminated file (maybe you didn't realize it was already in the Windows format) and your script would blindly replace each CR with CRLF, meaning you'd end up with CRLFLF combinations, which is very wrong.

  • Deleting first line off file

    Hello,
    I want to remove the first line of a file. Is there any way to do that
    without reading the whole file and putting it in a huge string?
    Something like setting the "begining of file marker" (does that
    exist?). I've looked in the "advanced file function" and can't find a
    way to do it.
    Any suggestion?
    Thanks a lot!!
    Vincent

    I don't see any Read File by Lines vi in LV7.1.  Maybe it exists in LV 8.  However there is a Read Lines from File vi but it does not produce an array of lines (at least not in LV 7.1).  You can use the Read Lines from File vi and set the number of lines to 1.  The output mark after read is now set to point to the second line.  You can use this as an input to start of read offset on your next read call.  This vi will open the file, read, then close the file.  Calling it a second time will open the file again, read, then close again.
    Another way is to open the file using Open/Create/Replace File.  Then use Read File and set the Line Mode input to True.  This will read the first line.  A second Read File call will then begin reading at the second line without having to wire any offsets.  After reading all that you want, you close the file.  One open, several reads, one close.  This is more efficient.
    Message Edited by tbob on 03-06-2007 03:03 PM
    - tbob
    Inventor of the WORM Global
    Attachments:
    ReadLines.png ‏4 KB

  • Renaming PDFs by first line in pdftotext output

    Dear Arch community,
    I would like to rename PDFs with cryptic names into their titles, which are in the first line of the files
    pdftotext sw-b-13-0094.pdf
    head -n 1 sw-b-13-0094.txt > title
    mv sw-b-13-0094.pdf $(title)
    But I can't figure out how to do this exactly.

    You're just about there.  The problem is your second line creates a file called title, then the third line tries to execute that file to get the new name.  You could add "cat" to the third line as follows.  This should work, but it would not be my recommended approach:
    pdftotext sw-b-13-0094.pdf
    head -n 1 sw-b-13-0094.txt > title
    mv sw-b-13-0094.pdf $(cat title)
    Instead, it'd be much cleaner to just use a shell variable:
    pdftotext sw-b-13-0094.pdf
    title=$(head -n 1 sw-b-13-0094.txt)
    mv sw-b-13-0094.pdf $title
    But this can be further improved by not littering all these text files all over - instead use a pipeline rather than actually creating a txt file:
    mv sw-b-13-0094.pdf "$(pdftotext sw-b-13-0094.pdf | head -n 1).pdf"
    Now, hopefully it should be clear how you can even replace the current pdf filename (sw-b-13...) with a parameter ($1) for a script or shell function - or have this loop through all pdf files in a directory.  If you want help with that too, let us know.
    EDIT: be careful to ensure that the first line of pdftotext actually has something meaningful.  If all the pdfs were created in the same way, this might be known.  But it is common for some whitespace or formatting character to be the first line.

  • Function: Return First Line of Another Cell (before line break)

    Howdy all!
    I have a bunch of cells that have multiple lines (line breaks created by pressing option-return). I want to create a function that will return the first line of a cell (IE: the text before the first line break). Any thoughts on how to do this?
    IE, if A1=
    Test 1
    Test 2
    Test 3
    Then I want to point the function from another cell to A1 and have it return Test 1.
    The code would look like this:
    =REPLACE(A1,SEARCH([line break],A1),LEN(A1)−SEARCH([line break],A1)+1,"")
    (IE: It searches for the line break, then replaces everything from that part on with nothing.)
    The problem is that I don't know how to get Numbers to think about [line break]. Thought that =char() would work but I don't know the unicode to put in (85, 2028, and 2029 didn't work).
    Thoughts?
    Matthew

    Thanks, I thought that I had tried that at some point, but I guess I hadn't done it correctly!
    I made one adjustment, I subtracted one from the SEARCH. The formula as you have it actually returns the line break along with the first line (you can't see it in your example because your rows are taller). (I also removed the third peramiter from the SEARCH, but that is a personal preference.) Outside of that this works perfectly. Thanks!
    B1=LEFT(A1,SEARCH("
    ",A1)−1)
    Matthew

  • RFFOCA_T: DME with file descriptor in first line (RBC)

    Hi All,
    I've customized the automatic payment run for a company located at Canada - including generated DME- file by the report RFFOCA_T. The DME file looks good - but sadly the house bank (RBC, Royal Bank of Scotland) is expecting two things different:
    "Different formats now exist for the Royal Bank and CIBC from the default CPA-005 specification.
    u2022 Type 'A' and 'Cu2019 records have been modified to handle RBC and CIBC
    u2022 A parameter was added to job submission to request the bank type
    This process has been revised to include two headers as part of the tape_header code segment.
    u2022 The first header must be the first line in the file and appear in the following format: $$AAPDCPA1464[PROD]NL$$
    u2022 The second header (positions 36 to 1464) must be filled with blanks, not zeros"
    (taken from "SCT Banner, Finance, Release Guide - January 2005, Release 7.0")
    In our DME-file the second header (position 36 to 1464) is correct, but the first header is completely missing.
    RBC wrote me in an email:: "The first line of the file needs the file descriptor ($$AAPDCPA1464[PROD]NL$$). The date format and the client number is correct. When the $$ file descriptor has been added please upload the TEST file":
    I could not find any solution at SAP/ OSS - can anybody help, please?
    Thanks a lot!
    Sandra.

    Hi Revi,
    I'm not sure if I understand you in the right way.
    I do not have a problem only with the $$ at the beginning. The whole first expected line as the file descriptor is missing. As we saw in the report code, it's not considered. At least I hope, there is a simple solution - like an update or else - but maybe we need to enlarge the report itself by a programmer?
    Thanks,
    Sandra

  • Arraylist only reading first line of file

    I am reading a text file using an arraylist. my file has a single value on each line e.g.
    2
    3
    4
    5
    however this method is only reading only the first line of each file. is it because of this statement:
    String s1[] = number.split("\\s");
    I would like to change the method so its not expecting numbers in a single line.. but reads each line and adds it to the collection... how can I do that?
    here is getData method that gets the file and processes it.
         public static List<Integer> getData(String Filename) {
              List<Integer> array1 = null;
              // BufferedReader for file reverse.txt
              try {
                   array1 = new ArrayList<Integer>();
                   BufferedReader bf = new BufferedReader(new FileReader(Filename));
                   String number = bf.readLine();
                   String s1[] = number.split("\\s");
                   for (int i = 0; i < s1.length; i++)
                        array1.add(Integer.parseInt(s1));
              } catch (Exception e) {
                   e.printStackTrace();
              return array1;

    Faissal wrote:
    while(bf .ready()){
    readline() will return null if the end of the stream has been reached. ([http://java.sun.com/javase/6/docs/api/java/io/BufferedReader.html]). This condition can be used to determine when to stop reading thereby ensuring that all lines have been read.
    EDIT:
    Here's a code snippet from [Java Developers Almanac|http://www.exampledepot.com/egs/java.io/ReadLinesFromFile.html]: notice how they close() the stream when they're finished with it.

  • Text node not showing first line?

    I'm trying to figure out some unexpected behavior with the layout of Text. If I create an example program based on the API documentation
    http://java.sun.com/javafx/1.2/docs/api/javafx.scene.text/javafx.scene.text.Text.html
    Like so:
    Stage
        title: "Application title"
        width: 500
        height: 500
        scene: Scene
            content: [ Text {font: Font { size: 20 } content: "First row\nSecond row" }  ]
    }The resulting screen only shows "Second row", the first line is moved out of the screen above. I need to set y to 20 to show the first line.
    Is that normal?

    Right, Text nodes have an textOrigin, which is default set to the base line. That means that y=0 is just below the letters.
    But the behavior is unexpected when simply adding a Text node and nothing is visible.

  • Anchored objects and first line in InDesign CS3

    Hi, thanks for reading. I know that when you want an achored object at the beginning of a text block to all push away ("wrap around") the text, including the first line, you have to put it into a line before that.
    What I don't like about it, is that I then have an empty first line and everything else is pushed one line down. Now I could move the whole textbox up, to fit to the rest of my layout, but that's not the way one should work in InDesign. Is there a way to get around the first line?

    T-
    Select the anchored object and put text wrap on it. Then select the anchored object and go to Object/Anchored Object/Options. Select Position: Inline and set the Y Offset to the negative number that aligns your text where you want it.

  • Excel upload with header in the first line

    Hi ,
    I have to upload a Excel sheet with data where the first line will be the Header .
    I am using the FM
    CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'
        EXPORTING
          I_LINE_HEADER        = 'X'
          I_TAB_RAW_DATA       = IT_TAB_RAW_DATA
          I_FILENAME           = P_FILE
        TABLES
          I_TAB_CONVERTED_DATA = IT_FS00_C
        EXCEPTIONS
          CONVERSION_FAILED    = 1
          OTHERS               = 2.
    But the data is not getting uploaded in the IT_FS00_c table.
    is there any other way to do it.
    thanks and regards,
    Vikki.

    Use the folllowing coding.....
        CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
             EXPORTING
                  filename                = p_file
                  i_begin_col             = 1
                  i_begin_row             = 2
                  i_end_col               = 7
                  i_end_row               = 9999
             TABLES
                  intern                  = t_alsm_tab
             EXCEPTIONS
                  inconsistent_parameters = 1
                  upload_ole              = 2
                  OTHERS                  = 3.
        IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        ENDIF.
        SORT t_alsm_tab BY row col.
        LOOP AT t_alsm_tab INTO r_alsm_tab.
          AT END OF row.
            l_append = 'X'.
          ENDAT.
          IF r_alsm_tab-col = 1.
            r_input_tab-kokrs = r_alsm_tab-value.
          ELSEIF r_alsm_tab-col = 2.
            r_input_tab-bukrs = r_alsm_tab-value.
          ELSEIF r_alsm_tab-col = 3.
            r_input_tab-rprctr = r_alsm_tab-value.
          ELSEIF r_alsm_tab-col = 4.
            r_input_tab-pline = r_alsm_tab-value.
          ELSEIF r_alsm_tab-col = 5.
            r_input_tab-sdatst = r_alsm_tab-value.
          ELSEIF r_alsm_tab-col = 6.
            r_input_tab-sdated = r_alsm_tab-value.
          ELSEIF r_alsm_tab-col = 7.
            r_input_tab-kostl = r_alsm_tab-value.
          ENDIF.
          IF l_append = 'X'.
            APPEND r_input_tab TO t_input_tab.
            CLEAR : l_append , r_input_tab.
          ENDIF.
        ENDLOOP.
      ENDIF.

  • ALV-Need to display total in top/first line!!!

    Hi,
      i have 3 numerical fields in my ALV output. I need to display the total in top/first line in output and download the same in excel into local system.if possible send me the sample code to how to do it.
    Regards,
    Nandha.

    TABLES : BSEG , BKPF.
    TABLES: SSCRFIELDS.
    TABLES: ITCPO.
    DATA :FLAG TYPE I, MAINTAIN TYPE I,
          FLAG1 TYPE I,
          FLAG2 TYPE I,
          FLAG3 TYPE I.
    DATA :BEGIN OF ITAB_BKPF OCCURS 0,
          BUKRS LIKE BKPF-BUKRS,
          GJAHR LIKE BKPF-GJAHR,
          BELNR LIKE BKPF-BELNR,
          BLART LIKE BKPF-BLART,
          BUDAT LIKE BKPF-BUDAT,
    END OF ITAB_BKPF.
    DATA :BEGIN OF ITAB_BSEG OCCURS 0,
          BUKRS LIKE BSEG-BUKRS,
          GJAHR LIKE BSEG-GJAHR,
          BELNR LIKE BSEG-BELNR,
          BUZEI LIKE BSEG-BUZEI,
          BSCHL LIKE BSEG-BSCHL,
          HKONT LIKE BSEG-HKONT,
          DMBTR LIKE BSEG-DMBTR,
          MWSKZ LIKE BSEG-MWSKZ,
          ZUONR LIKE BSEG-ZUONR,
          KOSTL LIKE BSEG-KOSTL,
          FISTL LIKE BSEG-FISTL,
          FIPOS LIKE BSEG-FIPOS,
          SGTXT LIKE BSEG-SGTXT,
    END OF ITAB_BSEG.
    DATA BEGIN OF ITAB_BKPF_BSEG OCCURS 0.
      INCLUDE STRUCTURE ZBKPF_BSEG.
    DATA END OF ITAB_BKPF_BSEG.
    *DATA ITAB_BKPF_BSEG LIKE TABLE OF ZITAB_BKPF_BSEG WITH HEADER LINE.
    DATA i_print LIKE TABLE OF ITCPO WITH HEADER LINE.
    TYPE-POOLS : SLIS , kkblo.
    DATA:TEXT2(30) VALUE 'Voucher Print',
         GS_LAYOUT TYPE SLIS_LAYOUT_ALV,
         CT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
         IT_SORT TYPE SLIS_T_SORTINFO_ALV,
         WA_SORT TYPE SLIS_SORTINFO_ALV,
         WA_SUBT LIKE SLIS_EV_SUBTOTAL_TEXT,
         WA_I_EVENT TYPE SLIS_ALV_EVENT,
         TEMP_CAT TYPE SLIS_FIELDCAT_ALV
    DATA : TEXT2538(16) VALUE 'Voucher Printing'.
    SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
    PARAMETERS : P_BUKRS LIKE BKPF-BUKRS OBLIGATORY.
    "Company code
    SELECT-OPTIONS : S_BELNR FOR BKPF-BELNR MODIF ID M01.
    "Accounting Doc No
    PARAMETERS: P_GJAHR LIKE BKPF-GJAHR MODIF ID M02.
    "Fiscal year
    SELECT-OPTIONS:  S_BLART FOR BKPF-BLART MODIF ID M03,
                                              "Document type
                     S_BUDAT FOR BKPF-BUDAT MODIF ID M04.
    "Posting date
    SELECTION-SCREEN END OF BLOCK B1.
    START-OF-SELECTION.
      IF S_BELNR IS NOT INITIAL.
        FLAG = 1.
      ENDIF.
      IF S_BLART IS NOT INITIAL.
        FLAG1 = 1.
      ENDIF.
      IF P_GJAHR IS NOT INITIAL.
        FLAG2 = 1.
      ENDIF.
      IF S_BUDAT IS NOT INITIAL.
        FLAG3 = 1.
      ENDIF.
      SELECT
          BUKRS
          GJAHR
          BELNR
        INTO CORRESPONDING FIELDS OF TABLE ITAB_BKPF
        FROM BKPF
        WHERE BUKRS EQ P_BUKRS
      IF SY-SUBRC NE 0.
        MESSAGE E000(ZPROJ).
      ENDIF.
      IF FLAG NE 0.
        DELETE ITAB_BKPF WHERE
        NOT ( BELNR IN S_BELNR AND GJAHR EQ P_GJAHR )
      ENDIF.
      IF FLAG1 NE 0.
        DELETE ITAB_BKPF WHERE
        NOT ( BLART IN S_BLART AND BUDAT IN S_BUDAT )
      ENDIF.
      IF FLAG2 NE 0.
        DELETE ITAB_BKPF WHERE
        NOT ( GJAHR EQ P_GJAHR )
      ENDIF.
      IF FLAG3 NE 0.
        DELETE ITAB_BKPF WHERE
        NOT ( BUDAT IN S_BUDAT )
      ENDIF.
      SELECT
            BUKRS
            GJAHR
            BELNR
            BUZEI
            BSCHL
            HKONT
            DMBTR
            MWSKZ
            ZUONR
            KOSTL
            FISTL
            FIPOS
            SGTXT
         FROM BSEG
         INTO TABLE ITAB_BSEG
         FOR ALL ENTRIES IN ITAB_BKPF
           WHERE
              BUKRS EQ P_BUKRS AND
              BELNR EQ ITAB_BKPF-BELNR AND
              GJAHR EQ ITAB_BKPF-GJAHR
      LOOP AT ITAB_BKPF.
        LOOP AT ITAB_BSEG WHERE BUKRS EQ ITAB_BKPF-BUKRS AND
                              BELNR EQ ITAB_BKPF-BELNR AND
                              GJAHR EQ ITAB_BKPF-GJAHR.
          MOVE-CORRESPONDING ITAB_BSEG TO ITAB_BKPF_BSEG.
    *    MOVE-CORRESPONDING ITAB_BKPF TO ITAB_BKPF_BSEG.
          APPEND ITAB_BKPF_BSEG.
        ENDLOOP.
      ENDLOOP.
    LOOP AT ITAB_BKPF_BSEG.
      ITAB_BKPF_BSEG-ZMENG = ITAB_BKPF_BSEG-DMBTR.
      MODIFY ITAB_BKPF_BSEG TRANSPORTING zmeng.
    ENDLOOP.
      PERFORM CHANGE_CATALOG.
      PERFORM ALV_DISPLAY.
    FORM CHANGE_CATALOG .
      CLEAR TEMP_CAT.
      TEMP_CAT-FIELDNAME  = 'BUKRS'.
      TEMP_CAT-SELTEXT_L = 'Company Code'.
      TEMP_CAT-TABNAME = 'ITAB_BKPF_BSEG'.
      TEMP_CAT-DDICTXT = 'L'.
      TEMP_CAT-OUTPUTLEN = 30.
      TEMP_CAT-HOTSPOT = 'X'.
      APPEND TEMP_CAT TO CT_FIELDCAT.
      CLEAR TEMP_CAT.
      TEMP_CAT-FIELDNAME  = 'BELNR'.
      TEMP_CAT-SELTEXT_L = 'Document No.'.
      TEMP_CAT-TABNAME = 'ITAB_BKPF_BSEG'.
      TEMP_CAT-DDICTXT = 'L'.
      TEMP_CAT-HOTSPOT = 'X'.
      APPEND TEMP_CAT TO CT_FIELDCAT.
      CLEAR TEMP_CAT.
      TEMP_CAT-FIELDNAME  = 'GJAHR'.
      TEMP_CAT-SELTEXT_L = 'Fiscal Year'.
      TEMP_CAT-TABNAME = 'ITAB_BKPF_BSEG'.
      TEMP_CAT-DDICTXT = 'L'.
      TEMP_CAT-OUTPUTLEN = 15.
      TEMP_CAT-HOTSPOT = 'X'.
      APPEND TEMP_CAT TO CT_FIELDCAT.
      CLEAR TEMP_CAT.
      TEMP_CAT-FIELDNAME  = 'BUZEI'.
      TEMP_CAT-SELTEXT_L = 'Item'.
      TEMP_CAT-TABNAME = 'ITAB_BKPF_BSEG'.
      TEMP_CAT-DDICTXT = 'L'.
      TEMP_CAT-OUTPUTLEN = 5.
      APPEND TEMP_CAT TO CT_FIELDCAT.
      CLEAR TEMP_CAT.
      TEMP_CAT-FIELDNAME  = 'BSCHL'.
      TEMP_CAT-SELTEXT_L = 'Posting Key'.
      TEMP_CAT-TABNAME = 'ITAB_BKPF_BSEG'.
      TEMP_CAT-DDICTXT = 'L'.
      TEMP_CAT-OUTPUTLEN = 15.
      APPEND TEMP_CAT TO CT_FIELDCAT.
      CLEAR TEMP_CAT.
      TEMP_CAT-FIELDNAME  = 'HKONT'.
      TEMP_CAT-SELTEXT_L = 'Account'.
      TEMP_CAT-TABNAME = 'ITAB_BKPF_BSEG'.
      TEMP_CAT-DDICTXT = 'L'.
      TEMP_CAT-OUTPUTLEN = 15.
      APPEND TEMP_CAT TO CT_FIELDCAT.
      CLEAR TEMP_CAT.
      TEMP_CAT-FIELDNAME  = 'DMBTR'.
      TEMP_CAT-SELTEXT_L = 'Amount'.
      TEMP_CAT-TABNAME = 'ITAB_BKPF_BSEG'.
      TEMP_CAT-DDICTXT = 'L'.
      TEMP_CAT-OUTPUTLEN = 15.
      TEMP_CAT-DO_SUM = 'X'.
      APPEND TEMP_CAT TO CT_FIELDCAT.
      CLEAR TEMP_CAT.
      TEMP_CAT-FIELDNAME  = 'MWSKZ'.
      TEMP_CAT-SELTEXT_L = 'Tax'.
      TEMP_CAT-TABNAME = 'ITAB_BKPF_BSEG'.
      TEMP_CAT-DDICTXT = 'L'.
      TEMP_CAT-OUTPUTLEN = 15.
      APPEND TEMP_CAT TO CT_FIELDCAT.
      CLEAR TEMP_CAT.
      TEMP_CAT-FIELDNAME  = 'ZUONR'.
      TEMP_CAT-SELTEXT_L = 'Assignment'.
      TEMP_CAT-TABNAME = 'ITAB_BKPF_BSEG'.
      TEMP_CAT-DDICTXT = 'L'.
      TEMP_CAT-OUTPUTLEN = 15.
      APPEND TEMP_CAT TO CT_FIELDCAT.
      CLEAR TEMP_CAT.
      TEMP_CAT-FIELDNAME  = 'KOSTL'.
      TEMP_CAT-SELTEXT_L = 'Cost Center'.
      TEMP_CAT-TABNAME = 'ITAB_BKPF_BSEG'.
      TEMP_CAT-DDICTXT = 'L'.
      TEMP_CAT-OUTPUTLEN = 15.
      APPEND TEMP_CAT TO CT_FIELDCAT.
      CLEAR TEMP_CAT.
      TEMP_CAT-FIELDNAME  = 'FISTL'.
      TEMP_CAT-SELTEXT_L = 'Fund Center'.
      TEMP_CAT-TABNAME = 'ITAB_BKPF_BSEG'.
      TEMP_CAT-DDICTXT = 'L'.
      TEMP_CAT-OUTPUTLEN = 15.
      APPEND TEMP_CAT TO CT_FIELDCAT.
      CLEAR TEMP_CAT.
      TEMP_CAT-FIELDNAME  = 'FIPOS'.
      TEMP_CAT-SELTEXT_L = 'Commitment Item'.
      TEMP_CAT-TABNAME = 'ITAB_BKPF_BSEG'.
      TEMP_CAT-DDICTXT = 'L'.
      TEMP_CAT-OUTPUTLEN = 15.
      APPEND TEMP_CAT TO CT_FIELDCAT.
      CLEAR TEMP_CAT.
      TEMP_CAT-FIELDNAME  = 'SGTXT'.
      TEMP_CAT-SELTEXT_L = 'Text'.
      TEMP_CAT-TABNAME = 'ITAB_BKPF_BSEG'.
      TEMP_CAT-DDICTXT = 'L'.
      TEMP_CAT-OUTPUTLEN = 15.
      APPEND TEMP_CAT TO CT_FIELDCAT.
      GS_LAYOUT-ZEBRA = 'X'.
    <b>GS_LAYOUT-TOTALS_BEFORE_ITEMS = 'X'.</b>
    data : text like slis_ev_subtotal_text value 'total'.
    gs_layout-subtotals_text = text.
    *gs_layout-totals_only = 'X'.
      CLEAR WA_SORT.
      WA_SORT-FIELDNAME = 'BUKRS'.
      WA_SORT-SPOS      = 1.
      WA_SORT-UP = 'X'.
    *wa_sort-group = '*'.
      APPEND WA_SORT TO IT_SORT.
      CLEAR WA_SORT.
      WA_SORT-FIELDNAME = 'BELNR'.
      WA_SORT-SPOS      = 2.
      WA_SORT-SUBTOT = 'X'.
      WA_SORT-UP = 'X'.
      APPEND WA_SORT TO IT_SORT.
      CLEAR WA_SORT.
      WA_SORT-FIELDNAME = 'GJAHR'.
      WA_SORT-SPOS      = 3.
      WA_SORT-SUBTOT = 'X'.
      WA_SORT-UP = 'X'.
      APPEND WA_SORT TO IT_SORT.
      CLEAR WA_SORT.
      WA_SORT-FIELDNAME = 'DMBTR'.
      WA_SORT-SPOS      = 4.
      APPEND WA_SORT TO IT_SORT.
      gs_layout-subtotals_text = 'total'.
    ENDFORM.
    FORM ALV_DISPLAY.
      CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
       EXPORTING
    *   I_INTERFACE_CHECK              = ' '
    *   I_BYPASSING_BUFFER             =
    *   I_BUFFER_ACTIVE                = ' '
         I_CALLBACK_PROGRAM             = SY-REPID
    *   I_CALLBACK_PF_STATUS_SET       = ' '
        I_CALLBACK_USER_COMMAND        = 'USER_COMMAND'
    *   I_STRUCTURE_NAME               =
         IS_LAYOUT                      = GS_LAYOUT
         IT_FIELDCAT                    = CT_FIELDCAT
    *   IT_EXCLUDING                   =
    *   IT_SPECIAL_GROUPS              =
         IT_SORT                        = IT_SORT[]
    *   IT_FILTER                      =
    *   IS_SEL_HIDE                    =
    *   I_DEFAULT                      = 'X'
         I_SAVE                         = 'A'
    *   IS_VARIANT                     =
    *   IT_EVENTS                      =
    *   IT_EVENT_EXIT                  =
    *   IS_PRINT                       =
    *   IS_REPREP_ID                   =
    *   I_SCREEN_START_COLUMN          = 0
    *   I_SCREEN_START_LINE         0   = 0
    *   I_SCREEN_END_COLUMN            = 0
    *   I_SCREEN_END_LINE              = 0
    *   IR_SALV_LIST_ADAPTER           =
    *   IT_EXCEPT_QINFO                =
    *   I_SUPPRESS_EMPTY_DATA          = ABAP_FALSE
    * IMPORTING
    *   E_EXIT_CAUSED_BY_CALLER        =
    *   ES_EXIT_CAUSED_BY_USER         =
        TABLES
          T_OUTTAB                       = ITAB_BKPF_BSEG
    * EXCEPTIONS
    *   PROGRAM_ERROR                  = 1
    *   OTHERS                         = 2
      IF SY-SUBRC <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    ENDFORM.                    "ALV_DISPLAY
    *i_calLback_user_command = 'USER_COMMAND'.
    FORM USER_COMMAND
      USING UCOMM LIKE SY-UCOMM
      SELFIELD TYPE SLIS_SELFIELD.
      DATA wa LIKE LINE OF ITAB_BKPF_BSEG.
      DATA itab LIKE TABLE OF ITAB_BKPF_BSEG WITH HEADER LINE.
      READ TABLE ITAB_BKPF_BSEG index SELFIELD-TABINDEX INTO wa.
      APPEND ITAB_BKPF_BSEG TO ITAB.
        ENDLOOP.
    CALL FUNCTION '/1BCDWB/SF00000204'
    * EXPORTING
    *   ARCHIVE_INDEX              =
    *   ARCHIVE_INDEX_TAB          =
    *   ARCHIVE_PARAMETERS         =
    *   CONTROL_PARAMETERS         = i_ctrl
    *   MAIL_APPL_OBJ              =
    *   MAIL_RECIPIENT             =
    *   MAIL_SENDER                =
    *   OUTPUT_OPTIONS             = i_print
    *   USER_SETTINGS              = 'X'
    * IMPORTING
    *   DOCUMENT_OUTPUT_INFO       =
    *   JOB_OUTPUT_INFO            =
    *   JOB_OUTPUT_OPTIONS         =
      TABLES
        ITAB_BKPF_BSEG             = ITAB
    * EXCEPTIONS
    *   FORMATTING_ERROR           = 1
    *   INTERNAL_ERROR             = 2
    *   SEND_ERROR                 = 3
    *   USER_CANCELED              = 4
    *   OTHERS                     = 5
    IF SY-SUBRC <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    ENDFORM.                    "user_command

  • Removing first line in text file... Memory and HD concern

    Hello all,
    I want to remove the first line of a text file. This is easy... One way
    to do it, is to find the first "end of line" caracter, strip the string
    and re-write the sting in file with the "strip to sreadsheet" VI.
    Since the file can be quite large (about 120000 lines), is this a good
    way to do it. Will it re-write all the line or just moving the "begin
    of file" pointer to the second line? If it re-write the whole file,
    this option is not very good since I could have to do this operation
    quite often. (I want the file to be a kind of circular buffer / backup).
    What do you think is the best way to do this?
    Thanks!
    Vincent

    I think you would have to read in all the data and write it to a new file, you could either keep the data in RAM or simply write to another file then delete the original, and then rename the temp one.  So obviously that is a lot of data and memory.
    My main question is are you trying to use a text file as a circular buffer?  If so can you tell us more about the data, ie is it strings of a constant length?  Does a user ever need to read the file or could we head binary?
    A solution would be to truly make the file a binary file, so you could actually seek through the file easier, and maybe make the first data chunk the location of the most recent write.  The obvious danger is then writing over existing data.  This solution is still risky because of the data writes.
    You may want to look at some of the other file formats like HWS which maintains a hierarchy of data for you so you can simply add and remove data from it.  However, a user will not be able to easily read it.

  • How to get First line item in Table control for BDC.

    Hi,
    I have a requirement while creating the return order from the reference Sales order for BOM.
    Once I compare the line items and delete the items not to be returned, I want to read the first line item which in fact is header, to make some changes.
    How to read  this as cursor points to the last line item.
    -B S B

    Hi Bsb,
    What is exactly unclear to you? =POPO will give a popup screen in which you can enter the order position number. This number will then be on the top of the table which means you can refer to it in BDC with "(01)".
    Regards,
    John.

  • Copy the data from first line while dynamically adding a new line in table

    Hi,
    1. There is a table
    2. An add button adds a new line to the table using 'AddInstance'
    3. A record is entered in the first line
    4. When the add button is clicked it adds a new line and along with it copies the data entered in the first line
    My question is how to copy the data from the first line and show it in the new line added. This is required so that user can use most of the common values in the first line.
    Thanks,
    Nikhil

    You can use the following Java Script in the Click event of the button.
    // Get the number of rows in the table
    var nrows = xfa.resolveNodes("page.table.DATA[*]").length;
    // Add a new instance(row) to the table
    page.table.addInstance.instanceManager(1);
    xfa.form.recalculate(1);
    // Copy the values from the first line to the newly created row
    page.table.DATA\[ nrows \].field1.rawValue = page.table.DATA\[ 0 \].field1.rawValue;
    ..........field2
    ..........field3
    Thanks,
    Chandra Indukuri

  • FB05 - trans to be processed and first line item PK for doc type

    Hi all,
    Me quite confused of the entry for the following document type in FB05
    DG - cust credit memo
    DR - cust invoice
    SA- gl acc doc
    SB - gl acc posting
    KG - vdr credit memo
    DZ - customer payment
    Need the help to let me know for document type above, what radio button to choose in transaction to be processed and also what posting key use at first line item.
    Also if i choose the wrong transaction to be processed radio button, any impact?
    thanks
    rgds

    Document type is primarily used to distinguish different various types of transactions. Ultimately, there are only two effects in accouting - debit and credit. Thus, doc type helps distinguish btw various types of accounting entries. It also controls certain field status while document posting and also drives the number range for the accounting document.
    Posting keys determine whether a transaction will be a credit or a debit. They also have an influence over the field status of the document entry screen. Posting keys are broadly divided into those belonging to
    Customer                             - Acct type C
    Vendors                               - Acct type V
    GL                                       - Acct type G
    Fixed Assets                        - Acct type A and
    Material Mgmt. transactions   - Acct type M
    For each account type there are both debit and credit posting keys. You can clik on F4 on the posting key field and see the various entries. You will understand.
    Thus, which posting key to enter depends on the transaction you want to enter.
    Regards,

Maybe you are looking for