Formatting of output text file.

I am writing values of variables to a text file.  I also have column headings.  Some of the column headings are long, perhaps 14 characters.  The field for my variable values is only 8 characters long.  Thus I would like to install a tab or two between my column headings so that they line up w my values.  How may I do that? 

You can specify a length with the format string. 
So, if the longest string is 14 characters, specify %14s as the format string. Your text will be right justified. If you want the text to appear at the left, use a format specifier of %-14s.
Don't play around with multiple TABs, it will make the file difficult to read in other apps like Excel.
Now is the right time to use %^<%Y-%m-%dT%H:%M:%S%3uZ>T
If you don't hate time zones, you're not a real programmer.
"You are what you don't automate"
Inplaceness is synonymous with insidiousness

Similar Messages

  • Regarding Date format in output text file

    Hi Frnds,
    i am taking the data from vbak table into one internal table T_vbak, in that i am having vdatu field also, and after that using GUI_Download function module i am downloading that internal table data to one text file into presentation server.
    But the date format is displaying in yyyymmdd format in the text file, but i want the format like mm/dd/yyyy in the text file, can anybody plz help me....

    Hey Bala,
    You can use the following conversion routine for converting the date from yyyymmdd format into mm/dd/yyyy.
    data: l_date(10) type c.
    Loop at t_vbak into wa_vbak.
    CONCATENATE wa_vbak-vdatu4(2) wa_vbak-vdatu6(2) wa_vbak-vdatu(4) INTO l_date SEPARATED BY '/'.
    wa_vbak-vdatu = l_date.
    modify t_vbak from wa_vbak.
    Endloop.
    Regards,
    Chetan.
    PS: Reward points if this helps.

  • Convert created idoc to an output text file

    Hi,
    How can i convert an idoc to an output text file? is there a standard program in SAP that does this?
    Thanks,
    Tots

    Hi,
    We can do it.
    The steps are
    1. Create a xml file port (we21)
      2. Create a partner profile point to the file port.
      3. Make sure the idocs are genereated.
    4  . Run the staandard program (RSEOUT001) with the port and required details in teh selection screen.
    The idocs will be generated to a xml file .
    Regards

  • Formatting console output text

    Is it possible to align output text to the console?
    I'm printing a UI to the console which gives users the ability to select an option
    System.out.printf("*********************%n");
    System.out.printf("Welcome to the system%n");
    System.out.printf("Please select an select an option%n");
    System.out.printf("1 - Login with username and password%n");
    System.out.printf("2 - Create an account%n");
    System.out.printf("3 - Options%n");
    System.out.printf("4 - Exit%n");
    System.out.printf("*********************%n");
    I was wondering if I can format this text to be aligned to a certain side. Or columns if not, but I prefer alignment. Also is there a more efficient way to write a large paragraph to be output(like above)?
    Thank you!

    To the plain-jane console? If that's what you're asking, then you should really be creating a GUI app, not a console-based one.

  • Output text files

    Hi,
    I have 2 text file  that should be statically outputted  with specific parameters ,
    what is the best way to do that?
    Regards

    To get all the files present in a specific directory on the application server
    REPORT  ZSRK_045                                .
    TABLES EPSF.
    PARAMETERS DIR  LIKE EPSF-EPSDIRNAM DEFAULT 'D:\usr\sap\ERP\DVEBMGS00\work'.
    "Give the app server directory name where u have stored the files
    " go to AL11 tcode to check the directory name
    DATA : FILECOUNTER LIKE EPSF-EPSFILSIZ,
           ERRORCOUNTER LIKE EPSF-EPSFILSIZ,
           DIRLIST TYPE TABLE OF EPSFILI WITH HEADER LINE.
    CALL FUNCTION 'EPS_GET_DIRECTORY_LISTING'
      EXPORTING
        DIR_NAME               = DIR
        FILE_MASK              = ' '
      IMPORTING
        DIR_NAME               = DIR
        FILE_COUNTER           = FILECOUNTER
        ERROR_COUNTER          = ERRORCOUNTER
      TABLES
        DIR_LIST               = DIRLIST
      EXCEPTIONS
        INVALID_EPS_SUBDIR     = 1
        SAPGPARAM_FAILED       = 2
        BUILD_DIRECTORY_FAILED = 3
        NO_AUTHORIZATION       = 4
        READ_DIRECTORY_FAILED  = 5
        TOO_MANY_READ_ERRORS   = 6
        EMPTY_DIRECTORY_LIST   = 7
        OTHERS                 = 8.
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    LOOP AT DIRLIST.
      WRITE : / DIRLIST-NAME, DIRLIST-SIZE.
    ENDLOOP.

  • Output text file in fpga mode

    Hi. I tried to get data from my crio. I started my project with fpga wizard on the getting started window. I created target vi and host vi. In the host vi, I put "file dialog" function to create text data file but it doesn't pop up in the start-up. Can anyone tell me what's wrong with my vi's? I just want to get position and time data.
    untitled 47 is my host vi
    Attachments:
    Quad Ctr.vi ‏1069 KB
    Untitled 47.vi ‏366 KB

    Stick to one thread for the same question.
    http://forums.ni.com/t5/LabVIEW/can-not-create-text-file-in-fpga-mode/td-p/1406470

  • Formatting the output in file out

    Hi,
    I have 5 fields in the internal table. I have used GUI_DOWNLOAD for downloading the file.
    The down loaded file looks like this.
    Field1      Field2  field3                      filed4              field5
    ABC     1234     20080131/405FED     161.65          161.65
    ABC     1234     20080131/560          7883.76          7883.76
    ABC     1234     20080131/701FED     6184.77          6184.77
    But I want the output like this:
    1. Spacing between columns 1 and 2 should be 3 spaces from after the last digit in column 1 to the first digit in column 2.
    2. Spacing between columns 2 and 3 should be 5 spaces from after the last digit in column 2 to the first digit in column 3.
    3. Spacing between columns 3 and 4 should be 8 spaces from after the last digit in column 3 to directly after the last digit in column 4.
    4. Spacing between columns 4 and 5 should be 10 spaces from after the last digit in column 4 to directly after the last digit in column 5.
    Please help how to procedure.
    Thanks,
    Sham.

    I just tried this piece of code and it seems to work fine:-
    TYPES : BEGIN OF ty_1,
            f1 TYPE char15,
            f2 TYPE char15,
            f3 TYPE char15,
           END OF ty_1,
           BEGIN OF ty_2,
             text TYPE char100,
           END OF ty_2.
    DATA : lt_1 TYPE TABLE OF ty_1, lt_2 TYPE TABLE OF ty_2,lc_ct TYPE i,lc_star TYPE char10,
           ls_1 TYPE ty_1,ls_2 TYPE ty_2,ls_3 TYPE ty_2.
    FIELD-SYMBOLS <fs> TYPE ANY.
    ls_1-f1 = 'A'.ls_1-f2 = 'AA'.ls_1-f3 = 'AAA'.APPEND ls_1 TO lt_1.
    ls_1-f1 = 'B'.ls_1-f2 = 'BB'.ls_1-f3 = 'BBB'.APPEND ls_1 TO lt_1.
    ls_1-f1 = 'C'.ls_1-f2 = 'CC'.ls_1-f3 = 'CCC'.APPEND ls_1 TO lt_1.
    ls_1-f1 = 'D'.ls_1-f2 = 'DD'.ls_1-f3 = 'DDD'.APPEND ls_1 TO lt_1.
    ls_1-f1 = 'E'.ls_1-f2 = 'EE'.ls_1-f3 = 'EEE'.APPEND ls_1 TO lt_1.
    LOOP AT lt_1 INTO ls_1.
      DO.
        ASSIGN COMPONENT sy-index OF STRUCTURE ls_1 TO <fs>.
        IF sy-subrc <> 0.
          EXIT.
        ENDIF.
        CASE sy-index.
          WHEN 1.
            DO.
              lc_ct = lc_ct + 1.
              IF lc_ct > 3.
                CONCATENATE <fs> lc_star INTO ls_2.
                EXIT.
              ENDIF.
              CONCATENATE lc_star '*' INTO lc_star.
            ENDDO.
          WHEN 2.
            DO.
              lc_ct = lc_ct + 1.
              IF lc_ct > 5.
                CONCATENATE <fs> lc_star INTO ls_2.
                EXIT.
              ENDIF.
              CONCATENATE lc_star '*' INTO lc_star.
            ENDDO.
          WHEN 3.
            DO.
              lc_ct = lc_ct + 1.
              IF lc_ct > 8.
                CONCATENATE <fs> lc_star INTO ls_2.
                EXIT.
              ENDIF.
              CONCATENATE lc_star '*' INTO lc_star.
            ENDDO.
        ENDCASE.
        CONCATENATE ls_3 ls_2 INTO ls_3.
        CLEAR: ls_2, lc_star,lc_ct.
      ENDDO.
      TRANSLATE ls_3 USING '* '.
      APPEND ls_3 TO lt_2.
      CLEAR : ls_3,ls_1.
    ENDLOOP.
    Result:-
    A   AA     AAA
    B   BB     BBB
    C   CC     CCC
    D   DD     DDD
    -- Dedeepya

  • How to align output formatted and output text in the same line?

    Hi All,
    I want an output formatted label and a text on the same line,. I've surrounded these components wth a panel form layout and they automatically align one below the other. how do I kepe them in the same line?
    Thanks.

    Try as per the code snippet below:
    <af:document title="TestPage.jspx" id="d1">
    <af:messages id="m1" inline="true"/>
    <af:form id="f1">
    *<af:panelGroupLayout id="pgl1" layout="horizontal">*
    *<af:outputFormatted value="outputFormatted1" id="of1"/>*
    *<h:outputText value="outputText1" id="ot1"/>*
    *</af:panelGroupLayout>*
    </af:form>
    </af:document>
    Thanks,
    Navaneeth

  • How to format a text file

    Hello I'm generating a text file in tab delimited format of frequency vs intensity. I wish to format it and save it in another text file. I'm getting my data in this format in the text file...
    1312500000.00    -6.69
    1375000000.00    -6.25
    1437500000.00    -5.94
    1500000000.00    -5.66
    1562500000.00    -5.89
    1625000000.00    -6.29
    1687500000.00    -6.45
    1750000000.00    -6.28
    1812500000.00    -5.59
    Now I'm trying to format this data into different coloums...like after every 201,401,601 or 1601(a control which tells this to vi)...I should jump to new set of coloumns, like:
    Frequency             Int.       Frequency             int.
    1312500000.00    -6.69    1312500000.00     -7.71        ...                ...               ...             ...   
    1375000000.00    -6.25
        1375000000.00    -6.55        ...               ...                ...           ...
    1437500000.00    -5.94
        1437500000.00    -7.94
    1500000000.00    -5.66
        1500000000.00    -7.66
    1562500000.00    -5.89
        1562500000.00    -4.89
    1625000000.00    -6.29     625000000.00      -9.09
    1687500000.00    -6.45
        1687500000.00    -6.40
    1750000000.00    -6.28
        1750000000.00    -6.88
    1812500000.00    -5.59
        1812500000.00    -5.89
    1375000000.00    -6.25
        1375000000.00    -5.25
    1437500000.00    -5.94     12500000.00        -5.59
    ...till 201 rows(If I input 201 in a control)
    I'm facing some problems with editing can anyone help me around.
    Attached my text file for reference
    Looking for help,
    Regards
    Attachments:
    Rohit.txt ‏2821 KB

    I don't think you need any loops and there is certainly no need o convert to numbers and back!
    (scanning and formatting operations are expensive!)
    Read the file as a plain string, then convert it to a 1D array of strings, one line per array element.
    Reshape to a 2D array of proper dimensions and transpose to fill columns first.
    Use spreadsheet string to array (now with tab as delimiter) to generate the desired string.
    Write the string to a new file.
    Here's a simple draft (LabVIEW 8.0). Look ma, no loops!
    Modify as needed.
    Message Edited by altenbach on 06-15-2007 03:29 PM
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    columnwrapper.png ‏10 KB
    ColumnWrapper.vi ‏13 KB

  • HELP ON HOW TO STORE OUTPUT IN TEXT FILE

    Hello,
    I am trying to output the results from queties into an output text file does anyone knows how to do that please?
    For example i want to do :
    Select SYSDATE from dual;
    and output the result of it in a text file called output.txt does anyone knows how to do that please?
    THanks a lot and every help is appreciated.
    Regards,
    giannis

    Can i set the path of the output file Yes, you can :
    TEST@db102 SQL> spool /tmp/output.txt
    TEST@db102 SQL> select sysdate from dual;
    SYSDATE
    14-JUN-06
    TEST@db102 SQL> spool off
    TEST@db102 SQL> !ls -ltr /tmp | tail -n 1
    -rw-r--r--   1 ora102 dba       313 Jun 14 01:52 output.txt
    TEST@db102 SQL> !cat /tmp/output.txt
    TEST@db102 SQL> select sysdate from dual;
    SYSDATE
    14-JUN-06
    TEST@db102 SQL> spool off
    TEST@db102 SQL>                                                             

  • How to prepare the Format of Flat file(Excel or Text file) for sales order

    Hi All,
    My requirement is to prepare the Flat File formats(Excel or Text file) for sales order Conversion using BAPI by COB.
    Needed Sample Excel or Text flat file .
    Thanks for all.
    Regards,
    Chowdary
    Moderator message : Search for available information. Thread locked. 
    Your similiar question [Flat files formats|Flat files formats] has been already locked for similiar reason.  Read forum rules before posting.
    Edited by: Vinod Kumar on Jul 8, 2011 9:36 AM

    Hi,
    You can use something like this:
    switch(cell.getCellType()) {
      case Cell.CELL_TYPE_STRING:
        System.out.println(cell.getRichStringCellValue().getString());
        break;
      case Cell.CELL_TYPE_NUMERIC:
        if(DateUtil.isCellDateFormatted(cell)) {
          System.out.println(cell.getDateCellValue());
        else {
          System.out.println(cell.getNumericCellValue());
        break;
        case Cell.CELL_TYPE_BOOLEAN:
          System.out.println(cell.getBooleanCellValue());
          break;
        case Cell.CELL_TYPE_FORMULA:
          System.out.println(cell.getCellFormula());
          break;
        default:
          System.out.println();
    Hope it helps,
    Daniel

  • Exporting text files in earlier editions of Oracle

    I'm not familiar with Oracle, but hope someone might be able to help me out. I have filed an access to information request with a public agency for data that I'm told is in an Oracle database.
    I have asked for the information to be released in flat text files but was told by the agency that they have an old edition (I'm not sure which one) and cannot export the information in that format as a result. As part of conditions for releasing any data to me, certain fields in their database will have to be severed to strip out personal information etc.
    The agency says it can only provide the data in pdf, which I don't believe I will be able to use.
    I'm wondering if this sounds like a valid argument - if there are earlier versions of Oracle that cannot export raw data in the format I requested. Or are there add-ons or aspects of each edition of Oracle that should make the severing and export possible?
    Thanks for any help you're able to provide...

    Any version of Oracle going back at least into the 1980s has the ability to output text files while simultaneously stripping out confidential/personal data.
    Not one of them is capable of producing that output as a .PDF file.
    Keep in mind that the people you are talking to may not know enough about Oracle to spell it correctly. If they need help they can contact me.
    Refer them to:
    SPOOL and UTL_FILE.

  • Fail to write the text file

    hi,
    I met a problem when I try to store data to text file. That's the description:
    - To read some objects from the binary file
    - To update object state, do some operations
    - To output some properties of the object to text format file.
    That's a part of my code:
    {color:#0000ff}
    //------ begin ---------//
    // ".cluto" is a binary file where store the number of objects as the first object and a set of docVector object
    File cluto = new File (config3.getOutputPath (), config3.getOutputFileType () + ".cluto");
    ObjectInputStream reader1 = new ObjectInputStream (new BufferedInputStream (new FileInputStream (cluto), BUFFERSIZE));
    // output text file definition
    File rlabel = new File (config3.getOutputPath (), config3.getOutputFileType () + ".rlabel");
    BufferedWriter rlabelWriter = new BufferedWriter (new FileWriter (rlabel), BUFFERSIZE);
    // get the first object in ".cluto", the number of objects in the input binary file
    Integer vectorNumber = (Integer)reader1.readObject ();
    // temporal variable
    docVector tVector;
    for(int i=0; i<vectorNumber.intValue (); i++) {
    tVector = (docVector)reader1.readObject ();
    tVector.dimsPruning ();
    tVector.updateDimsWeight (config1.getWEIGHT_TYPE ());
    rlabelWriter.write (tVector.vectorLableToString ()); // tVector.vectorLabelToString() return a string!
    reader1.close ();
    rlabelWriter.flush ();
    rlabelWriter.close ();
    //------ end --------//
    {color}
    The program works and creates the file ".rlabel", but a binary file instead of text file! Anyone have ideas about this problem?
    Thanks

    Sorry, I means ".rlabel".
    Good news, I fix the problem. In my old code, the I/O stream keeps always opened when I write huge data to the file (See "for" loop). And after the loop, I close the stream.
    Now, I open and close the stream in each loop. The problem is resolved.
    that's the new code:
    // this function is used to write a string to a file
    /* write a string to a file */
    public void writeStringToFile (String content, String fileName) {       
    BufferedWriter writer = null;
    try {
    writer = new BufferedWriter (new FileWriter (fileName, true));
    writer.write (content);
    writer.close ();
    } catch (IOException ex) {
    ex.printStackTrace ();
    String rlabel = "test.rlabel";
    for(int i=0; i<vectorNumber.intValue (); i++) {
    tVector = (docVector)reader1.readObject ();
    tVector.dimsPruning (prunedTerm);
    writeStringToFile (tVector.vectorLableToString (), rlabel);
    //------- end ----------//
    I don't know whether the open/close operations in a large loop cost a lot.
    Thanks

  • Optimize way to manipulate Big text file ?

    Hi all,
    Here I start my story .. 
    Long long time ago, Mr.A has a big text file (let say 120 columns X 840k rows) , around 100MB. He wanted to swap the text column according to the input number, let say,
    if input are 1,2,3,10,20,30, 
    output = a file with 6 columns, taken from column 1,2,3,10,20,30 of the big text file.
    Then he found that the VI taking too long time to do the extracting. (the subVI consists of the normal array function, let say index array, insert array to create a new array, then save to a text file).
    Hence, he chops the big text file to smaller text files (65k rows each text file), and he found that it's still taking a lot of time although the extracting time has improved a lot. Then he chops the files to 1024 rows each text file. And he end up with taking a few minutes too, to get the output file produced. (since smaller files = more files = more time consumed to open and close the file).
    So, here I m asking help from expertss here.. Any idea to optimizes the way shown above ? Any ideal number of rows (120columns) to shorten the extracting time for the situation above ? 
    please advise. Thank you very much..

    Hi,
    Thanks for you guys' replies ..
    What is the format of the text file?
    .txt 
    Fixed column widths, or delimited?
    ya the number of columns is fixed for whole file. Delimiter = <space>
    How are you reading the file ?
    by using "read from spreadsheet file" ..
    Here I explain more on my purpose.
    Another purpose I chop the big file to 65k rows perfile is because the VI after this section (spreadsheet string to digital) cannot process huge data at once. So, the 65k of rows is the maximum row allowed for my case.
    Then I chop it to smaller to observe if it will improve the performance....My VI is somesort like
    spreadsheet string to array => index the column => append all the columns => array to spreadsheet string
    I believe this is no good for big file ..
    Here I attached a text file sample .. Thanks for the advices. 
    Attachments:
    wf241basicreadwrite1to1patternstdwavesq0.txt ‏211 KB

  • Parsing a Text file with nulls in records

    Hello All,
    I am relatively new to Java programming and I have been given a task that requires me to parse a CSV text file. I have to group the records based on a particular column and then do some math (add columns that have same keys). My problem is that the input file can have nulls and non numeric chars. I am confused how I can proceed in this situation, since I have to add these records, when I do a parseDouble it might fail. OK. I can get around it by assigning a zero in case there is a NumberFormatException but the result of my task is to render an output text file that from the input file. Here comes the catch, the requirement has it, that if the input file had a null or a non numeric char then while rendering the output, I have to populate a code as a place holder for that location where a null or non numeric char was found. I'd like to know if there is any trivial way of getting around this problem without using a Map to remember the location where the null was found. Any help is greatly appreciated. Thanks all in advance.

    maybemedic wrote:
    Mogalr,
    The non numeric chars could be any random chars like aabb,null strings etc.In the past I've made small methods that would just check to see if the string was all characters and decimal point... and check formatting... check that it doesn't have 2 decimal points and after it's trimmed that there aren't any spaces and the length is >0.
    The checking is slower than using like Double.doubleValue(), unless you hit a format exception. So you have to decide what quality of data you have before committing to you're game plan.

Maybe you are looking for

  • I am trying to setup new Apple TV. Apple TV setup showing setting

    Any idea

  • Opening & Closing Stock - Query Correction

    Dear Experts,                          Please find the below query, where I need IN quantity & values , OUT quantity& values should  pick only from  Standard Production Order , whereas  it should not pick from special Production Order. Rest all in th

  • Rocketfish adaptor or Apple TV for steaming videos from Safari to tv?

    I have a mid 2012 Macbook Air and I want to be able to stream what I am watching on Safari (youtube, dishanywhere, amazon instant video, etc) on my tv via my macbook. Will the Rocketfish thunderbolt to HDMI adaptor do the trick or will I need Apple T

  • Adobe flash install help

    i am attempting to install a new version of adobe flash player.  During install I get the message to close "com.apple.webkit.plugin.65"  I don't know how to close this or even where to find it...installation stalls at that point.

  • Is 10.7 a really, really bad OS?

    Ever since we upgraded to 10.7 in February our computers have never run worse in the 15 years we've been on Macs. Is this system know to be pretty shoddy with all sorts of bugs and problems?? I haven't experienced this many problems since we bought t