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

Similar Messages

  • Junk Characters in the output XML file after Parsing

    Hi
    I am using DOM parser to parse an XML file.
    After parsing the input XML file, i am fetching some contents
    from the same and also putting the same contents in the parsed output file which is also an XML file.
    The problem here is that the after putting the contents to the output XML file from the input XML file,
    some junk character appears at the end of each and every tag in the outputfile.
    The junk character is some thing like this : " ampersand hash thirteen and a semicolon "
    (*THE MESSAGE DID NOT ACCEPT THE SYMBOLS KINDLY TRANSLATE THE ABOVE WORDINGS*
    INTO SYMBOLS)
    This character gets appended at the end of each and every tag in the output file due to which the output file
    is not recognised as an XML file.
    Please let me know as to why is this character appearing and also please suggest some solution
    for the same.
    -Thanks in Advance.
    Edited by: itskarthik on Oct 10, 2008 7:16 AM
    Edited by: itskarthik on Oct 10, 2008 7:18 AM
    Edited by: itskarthik on Oct 10, 2008 7:19 AM
    Edited by: itskarthik on Oct 10, 2008 7:19 AM
    Edited by: itskarthik on Oct 10, 2008 7:23 AM
    Edited by: itskarthik on Oct 10, 2008 7:23 AM

    Wierd.
    Try this piece of code. (You can always change it to use input file and output file instead of string if you want)
    What is your output?
    import java.io.ByteArrayInputStream;
    import java.io.ByteArrayOutputStream;
    import java.io.IOException;
    import java.io.OutputStream;
    import javax.xml.parsers.DocumentBuilderFactory;
    import javax.xml.transform.Result;
    import javax.xml.transform.Source;
    import javax.xml.transform.Transformer;
    import javax.xml.transform.TransformerFactory;
    import javax.xml.transform.dom.DOMSource;
    import javax.xml.transform.stream.StreamResult;
    import org.w3c.dom.Document;
    public class XMLTest {
         public static void main(String[] args) throws Exception {
              String input = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n" +
                                  "<test>\r\n" +
                                  "</test>";
              System.out.println("Input:");
              lookForCR(input);
              DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
              Document doc = factory.newDocumentBuilder().parse( new ByteArrayInputStream(input.getBytes()) );
              Source source = new DOMSource(doc);
              ByteArrayOutputStream bArrOut = new ByteArrayOutputStream();
              Result result = new StreamResult( new StripOutputStream( bArrOut ) );
              Transformer xformer = TransformerFactory.newInstance().newTransformer();
              xformer.transform(source, result);     
              System.out.println("\nResult:");
              lookForCR(bArrOut.toString());
              System.out.println("\nDone");
         public static void lookForCR(String input) throws Exception {
              char[] chars =input.toCharArray();
              for ( char chr : chars ) {
                   if (chr == 13 ) {
                        System.out.println("Has 0x0D character!!");
    class StripOutputStream extends OutputStream {
         OutputStream out = null;
         public StripOutputStream(OutputStream out) {
              this.out = out;
         @Override
         public void write(int b) throws IOException {
              if ( b != 13 )
                   out.write(b);
    }- Roy

  • Not receiving the output xml file from BPM

    Hello
    I am doing a scenario where I'd be sending two files in text format to the BPM workflow which would be using Fork and Correlation to merge these two files into one file and send the output xml file as receiver. Problem is that the two files are successfully converted into the xml messages and are displayed in SXMB_MONI but the output file which would be received from BPM engine as receiver is not being generated and displayed in SXMB_MONI as well as RWB. Please suggest any probable solution.
    Thanks.

    I don't think you can manipulate .ai files in Flex /
    AIR.

  • Sqlplus set statement:format the output without specifying every col length

    Hi ppl,
    i am writing below query inside a shell script. Is there any way to format the output of sqlplus without providing the name of all the columns that we are going to output. for example, in below code i have specified the column width of the columns i want to output. but if the number of columns is large (or when we want to do a select * from...) then it becomes tedious to write all of them. Is there any way i can define display length all the columns to be of same size.. or at least all the number columns of one size, char columns of one size etc...
    sqlplus -sa/passwd@db_name << EOF
    SET ECHO ON;
    SET HEADING ON;
    COLUMN USERNAME FORMAT A20;
    COLUMN USER_ID FORMAT A20;
    COLUMN PASSWORD FORMAT A20;
    spool filename.txt
    some qry... ;
    exit
    EOFThanks
    Edited by: KnockTurnAll on 25 Oct, 2010 10:41 PM
    Edited by: KnockTurnAll on 26-Oct-2010 04:25

    My SQL*Plus is a bit rusty, but I don't think you can for characters. You can set NUMWIDTH for a default size for numeric columns.
    You could write a small bit of SQL to generate the required column definitions. You could even hit ALL_TAB_COLUMNS to generate a generic 'set every column width' file and run it as a separate sql script in your main script. Not sure if there is an upper limit on the number of Columns you can define.
    Back in the day when we did everything with SQL*Plus scripts, we had a standard columns file that we called in all our scripts, just for this purpose.
    Carl

  • How to remove the extra space in the output pdf file?

    Hi All
    In our RTF layout template we have both static content and dynamic content.
    In RTF template we have used many if-else,choose,For each loops.
    On the account of that,In the output pdf file, we are getting lot of empty space in the place of that coding(if-else,choose,For each loops).
    Is there anyway to reduce the space in the output pdf file?
    Please suggest some ideas.
    Thanks in Advance.

    White space is NOT your friend!
    Make sure you don't have any unwanted whitespace between commands and especially tagged on the end of lines. Chain your commands together with no whitespace and let them wrap, do not enter carriage returns.
    Cheers,
    Dave

  • How to change the output executable file name(a.prj:(output)--- b.exe)

    LabWindows / CVI: how to change the output executable file name
                For example, I have an A project a.prj, I do not want to compile the output file is a.exe, but b.exe.
    I will try to save as a.prj b.prj, a.cws save as b.cws
    eg:a.prj  ---->(output)--->b.exe
    Solved!
    Go to Solution.

    You can go to Build >> Target Settings menu item, select Release (or Release 64) in the Configuration filed and set the name of the executable to create in Application FIle field, withouyt need to change the prj or cws filename.
    See the complete description of available options here.
    Proud to use LW/CVI from 3.1 on.
    My contributions to the Developer Zone Community
    If I have helped you, why not giving me a kudos?

  • Want to display a space after last field in the output txt file

    hi
    I want to display a space after last field in the output txt file which is generaed by my program on utility server the last field lengyt we have defined is four and in database it is of three characters and requirement is to disppaly the last fourth field as space in the output file w hich is not shown as the txt file automatically gets closed at the third place as it is the last field in the record and ind atabase records are of therss char only but user wants to display this fourth position in the notepad output file as space ( which is last field in the output file)
    eg
    name house  street country
    record output coming in file
    ram   h3      street3  thn      now this thn which is last field the notepad get closed at thn only
    i want to display one space in last field for the whole of output file
    ie ram      h3   street3  thn(space)
        sham   h4  street4   sgp(space)  so on......
    we need to show this space in the output file as blank
    regards
    Arora

    hi Atish
    i am using
    loop at gt_sagadr_outtab into wa_sagadr_outtab
    move wa_sagadr_outtab-country to wa_sagadr_text+223(226).
    endloop
    in this last field ie country i need to display the last 226 as blank as only country key is two char in database so the last space is not shown
    i am not unsing the fM as tolb by  you
    and afterwards
    i am usning
    Concatenate 'Sagadr_' sy-datum sy-uzeit '.dat' into gv_filename_sagadr.
    CALL FUNCTION 'FILE_GET_NAME'
      EXPORTING
      CLIENT                        = SY-MANDT
        LOGICAL_FILENAME              = gc_lfile
        OPERATING_SYSTEM              = SY-OPSYS
        PARAMETER_1                   = gc_param1
        PARAMETER_2                   = gc_send
        PARAMETER_3                   = gv_filename_sagadr
      USE_PRESENTATION_SERVER       = ' '
      WITH_FILE_EXTENSION           = ' '
      USE_BUFFER                    = ' '
      ELEMINATE_BLANKS              = 'X'
      IMPORTING
      EMERGENCY_FLAG                =
      FILE_FORMAT                   =
        FILE_NAME                     =  gv_filepath_sagadr
    EXCEPTIONS
      FILE_NOT_FOUND                = 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.
    and lastly
    open dataset gv_filepath_sagadr for output in text mode encoding default.
        if sy-subrc eq 0.
         loop at gt_sagadr_text into wa_sagadr_text.
         transfer wa_sagadr_text to gv_filepath_sagadr.
         endloop.
        endif.
       close dataset gv_filepath_sagadr.
        if sy-subrc = 0.
        message S002 with gv_filepath_sagadr. "Files & created on Application server
        endif.
    SO NOT SURE WHERE TO USE THE CODE AND HOW

  • DIO Pass or Fail Tests: LabVIEW would have to determine the expected result or results (1 or 2 of a possible 25) based on the output pattern send out (1 of 65K).

    I am trying to come up with a plan to write a LabVIEW VI to do the following test. Can you give me a few ideas how to do this in LabVIEW. I am a new to LabView. I think I how to read and write I/O ports and do comparisons. I need a little guidance on the error checking. In simple terms the test will go like this:
    I have 16 digital inputs and 16 outputs.
    The 16 outputs are turned on in a specific pattern (i.e. 1001000101011101) and then the 16 inputs (i.e. 1000101111111111) are read in after a time delay. The inputs are checked to see if they match the expected results. If they do it's a pass if not it's a f
    ailure. This seems pretty straightforward. And I think I have an idea how to do it. Here's the problem. The inputs are changed sequentially so that all possible combinations are tried. The test needs to determine if the resulting input pattern is correct based on the outputs that were sent out. 16 outputs give 65K possible tests. For each tests there would be 1 or 2 possible results with a total of 25 results for the entire 65K possible tests. LabVIEW would have to determine the expected result or results (1 or 2 of the 25) based on the output pattern send out (1 of 65K). Then it would have to compare the actual input pattern received to see if it's a pass or fail?
    Any ideas how I can approach this?

    The 16 outputs are simulating inputs to the device under test, (simulating remote switches and contacts). The object of the test is to test every possible combination to ensure that nothing unexpected happens at the output. The device under test is a logic motor control system and we want to make sure (among other things) that we don’t start or stop the motor when its not suppose to. How can only two tests do that?
    I think you are describing how to create an array with the results. But I still don’t know how to determine what the result should be and if it is correct.
    I’ve identified 25 possible valid states the motor controller can be in.
    I’ve also identified the correct outputs that determine each of the 25 states.
    I’ve also
    identified the possible valid states you can go to from each (previous) state, You can only get to a valid new state from a previous state if the right combination of inputs is applied (we hope).
    If you know what state you are in when start and you know the valid states you can go to and the inputs required to get there, you should be able test the system against that. You verify this by checking the outputs against what they should be. With 65K possible inputs combination, checking them all manually would be quite is a task. Putting this into LabView is my task.

  • Formatting the output (currency with decimals)

    hi all,
          i want to format the output of the currency field. Right now it displays the exact value like say 23 or 43.5 etc. But my requirement is i need it to display in a standard format as 23.00 , 43.50 , 565.00 etc. i,e if there is no decimals then it should be filled with zero's.
    I have gone through some of the threads which speaks of formatting the output if it is a value node. But here i have directly bounded the table to a model node.
    Domian level datatype of the field is Currency in R/3. After model import in dictionary it is showing as decimal.
    How can i achieve this?I Appreciate if someone can help me on this.
    Regards,
    G Nid

    hi,
    Go thru this link it might helps you.
    column heading -refer to the webdynpro tutorial 34
    Change the currency data type char and specify the length.
    Thanks,
    Lohi.

  • Formatting the output

    Hi everyone in the forum,
    I do not know if i should post this question here, but i think is the best place. Sorry if i were wrong.
    just a question because i have no idea how to format the output i need.
    I have a REAL or FLOAT and the output restrictions shows that it should be:
    1.0000 D-08 if the value is less than 1
    1.0000 if the value is [1,9]
    1.0000 D+03 is value bigger than 9
    and the other problem is whith other variable (type String) which represents integers, e.g, 0.000000 1.0000000 2.000000; and i have to return only 0 1 2 .
    Any suggestion about how to format the output?
    Thanks

    DecimalFormat

  • Where does the output of  System.out.write go??

    My question might be silly... but i couldn't find out the exact answer anywhere..
    Where does the output of System.out.write go??!! I am not getting anything in the console.. below is the snippet!
    public class TestWriteApp {
    public static void main(String[] args) {
         char a = 'c';
         System.out.write((byte)a);
    PEACE,
    Sandeep

    Is goes to the console. But a write of a byte isn't the way to see it.
    Try something that will show up easier like
    System.out.println("Hello World");What OS are you using? Are you using a command window? Or a GUI like Netbeans?

  • How to get the output .pdf file of a quiz to report to the quiz results analyzer on my internal server (mamp)

    I created a quiz.
    Created an internal server on my compute rising a MAMP.
    When I publish my quiz using the multi-file publishing options...
    I am able to use both the "HTML" and the "swf" output files to complete a quiz and reporting the results to the quiz results analyzer.
    However, I am unable to get the output .pdf field to reporting to the quiz results analyzer.
    Any help? Would this issue have to do with the Acrobat Professional setting? Captivate setting? My internal server setting? or output fuel placement?
    I tired to put the .pdf file in the same MAMP root folder location as my "internalserverreporting.php and internalserverread.php files.
    Thanks for the help.

    Hello Varun,
    You cqan submit the report as a JOB and export the out put to memory, once the job is complete you can read the list to display the output.
    Cheers,
    Mano
    Cut & Paste form SAP help.
    Submit report ....
    EXPORTING LIST TO MEMORY
    Does not display the output list of the called report, but saves it in ABAP memory and leaves the called report immediately. Since the calling program can read the list from memory and process it further, you need to use the addition ... AND RETURN . Also, since the called report cannot be requested for printing, the addition ... TO SAP-SPOOL is not allowed here. In addition, you must not assign a function code to the ENTER key in the current GUI status. The saved list is read from the SAP memory using the function module 'LIST_FROM_MEMORY' and can then be saved to the database using EXPORT, for example. You can process this list further with the function modules 'WRITE_LIST', 'DISPLAY_LIST' ... of the function group "SLST".

  • Why when I open the output.txt file, is strange code there, not 3.1

    i almost copy the example from "think in java book" chapter 11
    however, the result "output.txt file" when opened by notepad of windows xp, always only very strange code inside, not what i want
    do i need open the file, before i want to write?
    or i use a wrong api again?
    or the java code norm is very difference from ms windows?
    thanks
    import java.util.Random;
    import java.io.*;
    class CreatRandomFile
         public static void main(String args[])throws IOException
              File fileOutput=new File("output.txt");
              DataOutputStream out2=
                   new DataOutputStream(
                        new BufferedOutputStream(
                             new FileOutputStream(fileOutput)));
              out2.writeDouble(3.1);
              out2.close();
         }//end main
    }//end class

    There are basically two ways of IO:
    a) human readable format;
    b) machine readable format;
    What you've just done is writing a double value in machine readable
    format to a file. Some folks call it 'binary format'. I bet your file is eight
    byes long. A DataOutputStream writes data in machine readable
    format. You need a PrintStream instead if you (a being human I suppose)
    want to be able to read the contents of that file.
    kind regards,
    Jos

  • Need to split the output into files

    Hi,
    I have a query regarding splitting the output into different files. Please help to resolve that.
    I have have select query query...
    SELECT INDEX_NAME FROM DBA_INDEXES WHERE TABLE_NAME=<Table Name>;
    If it returns less than 4 indexes then we have create one table and have to move those into the files.
    For example...
    File_1.sql
    ====
    index1
    index2
    index3
    If select statement returns more than 4 indexes then we have create 4 files and have to splict those indexes and has to move to those 4 files.
    For example....
    If select statement returns 13 records then...
    File_1.sql File_2.sql File_3.sql File_4.sql
    ===== ====== ======= =======
    index1 index4 index7 index10
    index2 index5 index8 index11
    index3 index6 index9 index12
    index13
    Index no need to be in order in any file and any file can I extra index in it.
    Can be ok if we have any procedure or shell script. Please help me on this?
    We are using 10.2.0.1 oracle db. Please let me know if you need any thing else?
    Thanks
    Pathan

    Are you trying to put the output from SQL reports in different files?
    Some reporting tools can do this.
    You have a couple of options to do this.
    Some reporting tools support the functinality to write to different files.
    Another way is to write a PL/SQL procedure using UTL_FILE, which can open multiple files based on your conditions and to write to them as you need to.
    An older, less elegant solution is to write nested SQL*PLUS scripts spooling to different files with the queries you need. A top level script would invoke the others, something like (untested)
    --in first script
    @subscript1
    @subscript2
    --in subscript1.sql
    spool whatever.lst
    select *
       from dual;
    ...

  • Validating against schema file for the output XML file

    Hi,
      I am using XSLT for mapping. The output message is generated according to the mappings but it is not validate aganist schema of target . I am using xsd file from external defination section as target. Can any body help me in this regard.
    Thanks,
    Mallikarjun.M

    hi,
    if you talk about the schema of a target message type
    than validation only works if you use graphical
    message mapping
    not with: xslt,java, abap
    Regards,
    michal
    <a href="/people/michal.krawczyk2/blog/2005/06/28/xipi-faq-frequently-asked-questions">XI FAQ - Frequently Asked Questions</a>

Maybe you are looking for