Fixed width field format in txt file

I want to create text file for sending to bank. Every row in the text file is of variable length. For Ex: 1st row contains name and a fixed length of 33 char. 2nd row contains company and fixed length of 12 char.
Howewer when i download the data using GUI_DOWNLOAD it is taking the row with full length i.e. 256 char that of the internal table line.
If I use the truncate trailing blanks parameter, it removes all the spaces that are on the right of the name. what is our requirement is that irrespective of whatever is the actual length of the name it should take only 33 characters in first row. (ie If i place cursor on first character and press END button on keypad the cursor must move to 34 char).
But at present what is happening is that it is either moving to the actual end of the name or column 256 ie the end of line.
Any help to this will be highly appreciated.

You have to move the contents to a string variable. Put the Line feed(cl_abap_char_utilities=>newline) or CR_LF (cl_abap_char_utilities=>dr_lf) at the offset as required by you.
Download the file as 'BIN' using GUI_DOWNLOAD. You have to pass the length as the length of the string variable.
Try this & come back if you have any doubts.
BR,
Suhas

Similar Messages

  • Importing fixed width text from a .txt file

    I am really struggling to do in Numbers '09 something which I can do easily in Excel.
    I have a txt file containing plain text in fixed-width columns which I would like to import into numbers.
    I just cannot find a way to do it.
    I have tried using the Insert/choose menu item - but it won't take .txt files.
    I have tried to copy/paste the data, but it get's pasted into a single column.
    The data consists of many lines like this:
    Part Value Device Package Library Sheet
    A-IN JST-2.0-4 JST-2.0-4 JST-20M KMILLAR 1
    A-IN JST-2.5-4 JST-2.5-4 JST-25M KMILLAR 1
    A-IN JST-2.8-4 JST-2.8-4 JST-28M KMILLAR 1
    (and so on....)
    (Each column is an exact number of characters wide, but these forums make that hard to see due to the variable spaced fonts).
    How can I import this data into numbers?
    (Sorry, but I cannot get the data in any other format, such as CSV, the application which exports it only support fixed width colums with spaces for padding).
    Many thanks in advance,
    Kenny

    Here is a script treating the case of fixed widths values.
    --[SCRIPT fixedwidth_values_toTSV.scpt]
    Enregistrer le script en tant que Script : fixedwidth_values_toTSV.scpt
    déplacer le fichier ainsi créé dans le dossier
    <VolumeDeDémarrage>:Users:<votreCompte>:Library:Scripts:Applications:Numbers:
    Il vous faudra peut-être créer le dossier Numbers et peut-être même le dossier Applications.
    aller au menu Scripts , choisir Numbers puis choisir fixedwidth_values_toTSV
    Choisir un fichier texte.
    Le script détermine la largeur des différentes colonnes puis remplace les groupes séparateurs par des caractères TAB.
    Le résultat est passé dans le presse-paiers et est enregistré à la place du contenu initial.
    Vous pouvez alors
    (1) coller dans le document de votre choix
    (2) ouvrir le fichier texte modifié dans Numbers qui accepte sans broncher les ficiers .txt.
    Utilisation alternative : enregistrer le script en tant que Progiciel (Application sous 10.6.x)
    Glisser-déposer l'icône d'un fichier texte sur celle de l'application lancera le traitement voulu.
    --=====
    L'aide du Finder explique:
    L'Utilitaire AppleScript permet d'activer le Menu des scripts :
    Ouvrez l'Utilitaire AppleScript situé dans le dossier Applications/AppleScript.
    Cochez la case "Afficher le menu des scripts dans la barre de menus".
    Sous 10.6.x,
    aller dans le panneau "Général" du dialogue Préférences de l'Éditeur Applescript
    puis cocher la case "Afficher le menu des scripts dans la barre des menus".
    --=====
    Save the script as a Script: fixedwidth_values_toTSV.scpt
    Move the newly created file into the folder:
    <startup Volume>:Users:<yourAccount>:Library:Scripts:Applications:Numbers:
    Maybe you would have to create the folder Numbers and even the folder Applications by yourself.
    go to the Scripts Menu, choose Numbers, then choose "fixedwidth_values_toTSV"
    Choose a text file.
    The script scan the file's contents to extract the width of every column then it replace the separator groups by TAB characters.
    The result is passed to the clipboard and is written in the original file.
    So you may :
    (1) paste in the document of your choice
    (2) open the modified text file with Numbers which is fair enough to do that.
    An alternate track is to save the script as an Application Package (Application under 10.6.x)
    Drag and drop the icon of a text file on the application's one will do the job.
    --=====
    The Finder's Help explains:
    To make the Script menu appear:
    Open the AppleScript utility located in Applications/AppleScript.
    Select the "Show Script Menu in menu bar" checkbox.
    Under 10.6.x,
    go to the General panel of AppleScript Editor’s Preferences dialog box
    and check the “Show Script menu in menu bar” option.
    --=====
    Yvan KOENIG (VALLAURIS, France)
    2010/08/19
    --=====
    on run
    set un_fichier to choose file with prompt "Choose e text file…" of type {"public.plain-text"} without invisibles
    my commun(un_fichier)
    end run
    --=====
    on open (sel)
    set un_fichier to item 1 of sel
    tell application "System Events" to set type_ID to type identifier of disk item ("" & un_fichier)
    if type_ID is "public.plain-text" then my commun(un_fichier as alias)
    error "The file “" & un_fichier & "” isn’t a text file !"
    end open
    --=====
    on commun(le_fichier)
    set le_contenu to read le_fichier
    set le_contenu to "azer ertyuio wxcv dfghj
    qszaed dc fghj mlkjhgf nbvcxw
    aqwzsx edcrfv tg byhn aaaaaaa "
    set listedelistes to {}
    set plusgrandelongueur to 0
    set pluspetitelongueur to 999999
    set listelignesbrutes to paragraphs of le_contenu
    repeat with refd_uneligne in listelignesbrutes
    set maybe to contents of refd_uneligne
    set maybe2 to count of maybe
    if maybe2 > plusgrandelongueur then set plusgrandelongueur to maybe2
    if maybe2 < pluspetitelongueur then set pluspetitelongueur to maybe2
    copy my decoupe(maybe, space) to end of listedelistes
    end repeat
    set differencedelongueur to plusgrandelongueur - pluspetitelongueur
    set des_espaces to space
    repeat differencedelongueur times
    set des_espaces to des_espaces & space
    end repeat
    set largeur1 to 0
    repeat with refd_uneligne in listedelistes
    set maybe to length of first item of refd_uneligne
    if maybe > largeur1 then set largeur1 to maybe
    end repeat
    set liste_finale to {}
    repeat with refd_uneligne in listelignesbrutes
    set maybe to contents of refd_uneligne
    set maybe2 to text 1 thru largeur1 of maybe
    repeat while maybe2 ends with space
    set maybe2 to text 1 thru -2 of maybe2
    end repeat
    copy maybe2 to end of liste_finale
    copy text (largeur1 + 2) thru plusgrandelongueur of (maybe & des_espaces) to contents of refd_uneligne
    end repeat
    Enter the bigger loop *)
    set cest_Lafin to false
    repeat
    Deprieve the stored rows of the treated column's items *)
    set flag to 0
    repeat
    set flag to flag + 1
    set flag2 to 0
    repeat with refd_uneligne in listelignesbrutes
    if "" & character flag of contents of refd_uneligne is space then set flag2 to flag2 + 1
    end repeat
    if flag2 < (count of listelignesbrutes) then exit repeat
    end repeat
    repeat with refd_uneligne in listelignesbrutes
    copy text flag thru -1 of contents of refd_uneligne to contents of refd_uneligne
    end repeat
    Prepare the extraction of next column *)
    repeat with refd_uneligne in listelignesbrutes
    copy my decoupe(contents of refd_uneligne, space) to end of listedelistes
    end repeat
    Extract the width of the column to treat *)
    set largeur1 to 0
    repeat with refd_uneligne in listedelistes
    set maybe to length of first item of refd_uneligne
    if maybe > largeur1 then set largeur1 to maybe
    end repeat
    Extract the column's values *)
    repeat with i from 1 to count of listelignesbrutes
    set maybe to contents of item i of listelignesbrutes
    set maybe2 to text 1 thru largeur1 of maybe
    repeat while maybe2 ends with space
    set maybe2 to text 1 thru -2 of maybe2
    end repeat
    copy (contents of item i of liste_finale) & tab & maybe2 to item i of liste_finale
    try
    copy text (largeur1 + 2) thru -1 of maybe to item i of listelignesbrutes
    on error
    set cest_Lafin to true
    end try
    end repeat -- i
    if cest_Lafin then exit repeat
    end repeat -- bigger loop
    set le_contenu to my recolle(liste_finale, return)
    set the clipboard to le_contenu
    set eof of le_fichier to 0
    write le_contenu to le_fichier
    end commun
    --=====
    on decoupe(t, d)
    local oTIDs, l
    set oTIDs to AppleScript's text item delimiters
    set AppleScript's text item delimiters to d
    set l to text items of t
    set AppleScript's text item delimiters to oTIDs
    return l
    end decoupe
    --=====
    on recolle(l, d)
    local oTIDs, t
    set oTIDs to AppleScript's text item delimiters
    set AppleScript's text item delimiters to d
    set t to l as text
    set AppleScript's text item delimiters to oTIDs
    return t
    end recolle
    --=====
    --[/SCRIPT]
    Yvan KOENIG (VALLAURIS, France) vendredi 20 août 2010 12:44:33

  • FDM Fixed-Width Import Format & Multiple Accounts/Periods Issue

    Hi FDM experts,
    I have an issue that I wanted to reach out to you on regarding fixed-width import formats and how to cater for my current scenario for export to Hyperion Planning.
    I am working with a flat file (.txt) I need to import to FDM with the current format;
    A
    B
    C
    D
    E
    F
    G
    Z
    Year
    Channel
    Product
    Jan-MTD-Account 1
    Jan-MTD-Account 2
    Jan-YTD-Account1
    Jan-YTD-Account2
    Dec-YTD-Account2
    2013
    Channel_1
    Product_1
    1000
    2000
    1000
    2000
    10000
    These are all fixed in width so the field lengths will need to be defined in the import format. The requirement for loading to the system is only a speciifc Month YTD value for both Account1 and Account 2.
    If my chosen Month is 2013 Jan, I will only require columns F and G to be loaded. These are the issues I have identified;
    Can a fixed width import format cater for loading to multiple accounts in the same file? Or would I need a separate import format per account?
    Can a fixed width import format cater for loading to a variable Actual Month period? Or do I need 12 import formats/locations per month?
    Your help is much appreciated!
    Many thanks
    Aaron

    Hi Aaron,
    the solution you are looking for needs pivoting your source file.
    Think that FDM, by default, only accepts files with one single column for amount. You have to pivot your file based on your logic and import the pivoted file.
    For example:
    Year     Channel     Product     ... Jan-YTD-Acc1     Jan-YTD-Acc2 ...
    2013     CH1          PR1               1000                    2000
    If your POV is Jan-2013, your data imported will look like:
    Year     Channel     Produc     Account     Amount
    2013     CH1          PR1          ACC1          1000
    2013     CH1          PR1          ACC2          2000
    All this process can be automated by playing with Import Scripts.
    HTH

  • Export to fixed length field format

    Sometimes we need to export records from our student system as fixed length text file to integrate with other software.
    Basically the report will only contains  rows of records, But we want to export it to fixed length field text file.
    And then automate the process.
    We also have Crystal enterprise server.  What is the easy and best way to accomplish this?
    Thanks

    Sorry.  Please ignore my last message.  It went into the wrong thread. 
    There is one huge problem with exporting to Fixed Length in 8.5.  The Fixed Length will truncate any trailing white space.  So if you have a could that's 5 characters long but the current value is only 3, it will only be 3 characters long. 
    To get around this, I've had to create a formula for each column in the report and check the lenght of the field and pad or truncated accordingly. 
    For example:
    If Length ({Table.FIELD1}) > 10 Then
         {Table.FIELD1} [1 to 10]
    Else {Table.FIELD1} & ReplicateString ("*", (10 - Length ({Table.FIELD1}));
    So this column should be 10 characters long.  If the field is longer than 10 characters it will truncate it to 10, otherwise it will pad the extra spaces with *.  You can't use spaces to pad because the export driver will truncate them so I decided * were the best choice because for my purposes I knew that character would never be used. 
    Good luck,
    Brian

  • How to convert .trc into a readable format or txt file

    Hi,
    I tried using tkprof but it output similar to this :
    TKPROF: Release 10.2.0.1.0 - Production on Sun Dec 28 13:42:39 2008
    Copyright (c) 1982, 2005, Oracle. All rights reserved.
    Trace file: C:\ababil_cjq0_1044568.trc
    Sort options: default
    count = number of times OCI procedure was executed
    cpu = cpu time in seconds executing
    elapsed = elapsed time in seconds executing
    disk = number of physical reads of buffers from disk
    query = number of buffers gotten for consistent read
    current = number of buffers gotten in current mode (usually for update)
    rows = number of rows processed by the fetch or execute call
    Trace file: C:\ababil_cjq0_1044568.trc
    Trace file compatibility: 10.01.00
    Sort options: default
    1 session in tracefile.
    0 user SQL statements in trace file.
    0 internal SQL statements in trace file.
    0 SQL statements in trace file.
    0 unique SQL statements in trace file.
    238 lines in trace file.
    0 elapsed seconds in trace file
    Is this the correct output?
    Cheers,
    Sach

    Output would very based on which file you are trying to convert.
    TKProf can be run from anywhere, even from the client (for administrator type installation AFAIK) of preferably the same Oracle version.
    Best would be to run the same from the database server itself, as there would be no conflicts about versions and interpretation of trace data by the tkprof utility. F.ex. prior to 10g, all timings in trace files were in milliseconds whereas in 10g, it is saved in microseconds.

  • Importing txt file and placing in set up autoflow text

    Hi there
    I'm not really an indesign user so I am extremely new to the product.
    I am wanting to place a text file into a (now) indesign template (was pagemaker) and into an autoflow text area where the text flows from one page to another.  I want to overwrite what is in the current document with this new text but wanting the new text to fill the correct pages of the template.
    My question is what is the fastest way to make this happen?
    The auto flow is already set from the pagemaker template;
    The txt file has separated the text by tabs across the page.
    Your assistance would greatly be appreciated.
    Cheers

    Without giving you a full lesson on how to format text in InDesign, I'm hoping the template contains, Text Frame placeholders (it sounds from your description that it does) Paragraph and Character styles at least to format the .txt file once the new text is in the document?
    Use your Type tool, click in the existing text and Ctrl/Cmd+A (Edit > Select All). Then choose File > Place and navigate to your .txt file to replace currently selected text.  Then format the text with appropriate paragraph styles etc.
    If particular text must start on a new page, in a different frame or column, then you could insert break characters where needed (Type > Insert Break Character). I'd generally advice that the break information -- where linked to a particular paragraph style -- is set as part of the paragraph style itself.
    You might also want to consult the InDesign Help to learn a bit more about all of this.
    Good luck,
    Cari
    Cari Jansen - Adobe Certified Instructor
    www.carijansen.com
    www.twitter.com/carijansen

  • BPC 7.5 NW -- Data Manager Export:  Fixed-Length Fields?

    Hi Experts,
    Client has a requirement that we export a batch of transaction data from BPC, which is generally no problem, but in this case they want to do it with Fixed-Length fields in the Export file.
    I've done a lot of BPC Data Manager Imports with Fixed-Length fields, and that function really works well.  But, has anyone tried to use the Export package with this option?  It doesn't seem to be working in my case yet.
    Any tips?
    Thanks so much, as always,
    Garrett
    =======================
    Update -- After going back to review documentation, it looks like the the *PAD() function is actually intended for export not really importing, which makes sense.  ...The SAP online help library says that it's meant for import, but I now believe that is a typo.
    Also, I've added the line "OUTPUTFORMAT = NORMAL" in my *OPTIONS section.  Anyone else manage to get export working on BPC 7.5 NW
    Edited by: Garrett Tedeman on Mar 3, 2011 1:37 PM

    Update -- This problem may now be resolved.
    I have been able to conduct test IMPORTs of 48,000, then 96,000 and then 1.7 million records.  All were fine.
    It turns out that that difference is that the text files were sorted by amount in the ones that failed.  They were sorted by GLAccount in column A for the ones that succeeded.
    Edit:  Yep, all files loaded normally when re-sorted by GLACCOUNT, etc. on the left-hand side.  Apparently, when you're doing a lot of records that might confuse the system or something
    Edited by: Garrett Tedeman on Nov 18, 2010 11:41 AM

  • Out of memory error - from parsing a "fixed width file"

    This may be fairly simple for someone out there but I am trying to write a simple program that can go through a "fixed width" flat txt file and parse it to be comma dilmeted.
    I use a xml file with data dictionary specifications to do the work. I do this because there are over 430 fields that need to be parsed from a fixed width with close to 250,000 lines I can read the xml file fine to get the width dimensions but when I try to apply the parsing instructions, I get an out of memory error.
    I am hoping it is an error with code and not the large files. If it is the latter, does anyone out there know some techniques for getting at this data?
    Here is the code
       import java.io.*;
       import org.w3c.dom.Document;
       import org.w3c.dom.*;
       import javax.xml.parsers.DocumentBuilderFactory;
       import javax.xml.parsers.DocumentBuilder;
       import org.xml.sax.SAXException;
       import org.xml.sax.SAXParseException;
        public class FixedWidthConverter{
          String[] fieldNameArray;
          String[] fieldTypeArray;
          String[] fieldSizeArray;      
           public static void main(String args []){
             FixedWidthConverter fwc = new FixedWidthConverter();
             fwc.go();
             fwc.loadFixedWidthFile();
            //System.exit (0);
          }//end of main
           public void go(){
             try {
                DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance();
                DocumentBuilder docBuilder = docBuilderFactory.newDocumentBuilder();
                Document doc = docBuilder.parse (new File("files/dic.xml"));
                // normalize text representation            doc.getDocumentElement ().normalize ();
                System.out.println ("Root element of the doc is " +
                     doc.getDocumentElement().getNodeName());
                NodeList listOfFields = doc.getElementsByTagName("FIELD");
                int totalFields = listOfFields.getLength();
                System.out.println("Total no of fields : " + totalFields);
                String[] fldNameArray = new String[totalFields];
                String[] fldTypeArray = new String[totalFields];
                String[] fldSizeArray = new String[totalFields];
                for(int s=0; s<listOfFields.getLength() ; s++){
                   Node firstFieldNode = listOfFields.item(s);
                   if(firstFieldNode.getNodeType() == Node.ELEMENT_NODE){
                      Element firstFieldElement = (Element)firstFieldNode;
                      NodeList firstFieldNMList = firstFieldElement.getElementsByTagName("FIELD_NM");
                      Element firstFieldNMElement = (Element)firstFieldNMList.item(0);
                      NodeList textFNList = firstFieldNMElement.getChildNodes();
                      //System.out.println("Field Name : " +
                               //((Node)textFNList.item(0)).getNodeValue().trim());
                      //loads values into an array
                      //fldNameArray[s] = ((Node)textFNList.item(0)).getNodeValue().trim();
                      NodeList typeList = firstFieldElement.getElementsByTagName("TYPE");
                      Element typeElement = (Element)typeList.item(0);
                      NodeList textTypList = typeElement.getChildNodes();
                      //System.out.println("Field Type : " +
                               //((Node)textTypList.item(0)).getNodeValue().trim());
                      //loads values into an array
                      //fldTypeArray[s] = ((Node)textTypList.item(0)).getNodeValue().trim(); 
                      NodeList sizeList = firstFieldElement.getElementsByTagName("SIZE");
                      Element sizeElement = (Element)sizeList.item(0);
                      NodeList textSizeList = sizeElement.getChildNodes();
                      //System.out.println("Field Size : " +
                               //((Node)textSizeList.item(0)).getNodeValue().trim());
                      //loads values into an array
                      fldSizeArray[s] = ((Node)textSizeList.item(0)).getNodeValue().trim();   
                   }//end of if clause
                }//end of for loop with s var
                //setFldNameArray(fldNameArray);
                //setFldTypeArray(fldTypeArray);
                setFldSizeArray(fldSizeArray);
                 catch (SAXParseException err) {
                   System.out.println ("** Parsing error" + ", line "
                      + err.getLineNumber () + ", uri " + err.getSystemId ());
                   System.out.println(" " + err.getMessage ());
                 catch (SAXException e) {
                   Exception x = e.getException ();
                   ((x == null) ? e : x).printStackTrace ();
                 catch (Throwable t) {
                   t.printStackTrace ();
          }//end go();
           public void setFldNameArray(String[] s){
             fieldNameArray = s;
          }//end setFldNameArray
           public void setFldTypeArray(String[] s){
             fieldTypeArray = s;
          }//end setFldTypeArray
           public void setFldSizeArray(String[] s){
             fieldSizeArray = s;
          }//end setFldSizeArray
           public String[] getFldNameArray(){
             return fieldNameArray;
          }//end setFldNameArray
           public String[] getFldTypeArray(){
             return fieldTypeArray;
          }//end setFldTypeArray
           public String[] getFldSizeArray(){
             return fieldSizeArray;
          }//end setFldSizeArray 
           public int getNumLines(){
             int countLines = 0;
             try {
                    //File must be in same director and be the name of the string below
                BufferedReader in = new BufferedReader(new FileReader("files/FLAT.txt"));
                String str;
                while ((str = in.readLine()) != null) {
                   countLines++;
                in.close();
                 catch (IOException e) {}    
             return countLines;
          }//end of getNumLines
           public void loadFixedWidthFile(){
             int c = getNumLines();
             int i = 0;
             String[] lineProcessed = new String[c];
             String chars;
             try {
                    //File must be in same director and be the name of the string below
                BufferedReader in = new BufferedReader(new FileReader("files/FLAT.txt"));
                String str;
                while ((str = in.readLine()) != null) {
                   //System.out.println(str.length());
                   lineProcessed[i] = parseThatLine(str);
                   i++;
                in.close();
                 catch (IOException e) {}     
                //write out the lineProcess[] array to another file
             writeThatFile(lineProcessed);
          }//end loadFixedWidthFile()
           public void writeThatFile(String[] s){
             try {
                BufferedWriter out = new BufferedWriter(new FileWriter("files/outfilename.txt"));
                for(int i = 0; i < s.length -1; i++){
                   out.write(s);
    }//end for loop
    out.close();
    catch (IOException e) {}
    }//end writeThatFile
    public String parseThatLine(String s){
    int start = 0;
    int end = 0;
    String parsedLine = "";
    int numChars = getFldSizeArray().length;
    //Print number of lines for testing
    //System.out.println(numChars);
    String[] oArray = getFldSizeArray();
    //String chars = oArray[0];
    //System.out.println(chars.length());
    //oArray
    for(int i = 0; i < numChars -1; i++ ){
    if(i == 0){
    start = 0;
    end = end + Integer.parseInt(oArray[i])-1;
    else
    start = end;
    end = end + Integer.parseInt(oArray[i]);
    parsedLine = parsedLine + s.substring(start, end) + "~";
    }//end for loop
    return parsedLine;
    }//End of parseThatLine
    I have tried to illeminate as many arrays as I can thinking that was chewing up the memory but to no avail.
    Any thoughts or ideas?
    Message was edited by:
    SaipanMan2005

    You should not keep a String array of all the lines of the file read.
    Instead for each line read, parse it, then write the parsed line in the other file:      public void loadFixedWidthFile() {
             BufferedReader in = null;
             BufferedWriter out = null;
             try {
                //File must be in same director and be the name of the string below
                in = new BufferedReader(new FileReader("files/FLAT.txt"));
                out = new BufferedWriter(new FileWriter("files/outfilename.txt"));
                String str;
                while ((str = in.readLine()) != null) {
                   //System.out.println(str.length());
                   str = parseThatLine(str);
                   //write out the parsed str to another file
                   out.write(str);
             catch (IOException e) {
                e.printStackTrace(); // At least print the exception - never swallow an exception
             finally { // Use a finally block to be sure of closing the files even when exception occurs
                try { in.close(); }
                catch (Exception e) {}
                try { out.close(); }
                catch (Exception e) {}
          }//end loadFixedWidthFile()Regards

  • Output file as a text file with tab delimited and fixed length fields

    Hi all,
    I have developed a custom report which outputs an excel file on the user desktop who executes that report.Now i need to create an additional (second) excel file with almost the same data as the first file.
    Im using the FM GUI_DOWNLOAD to create the file.i need have the 2nd file as txt file(seperated by space/tab delimited) and also i want the fields to have fixed length.For this format of the file,what parameters do I need to pass to the FM ?
    BR,
    SRM Tech.

    Thanks for the prompt reply.
    Also in the sel screen,Im entering the path where  the o/p file needs to be downloadede.g. C:/Output_folder/Output.xls...Now if I need a text file,do I need to give the fielname as C:/Output_folder/Output.txt.?

  • How to write to file using fixed width columns

    I need to write some data to a text file such that it is formatted in columns of fixed width. Each column can have different width. eg if i have to write 5 fields in each record the first field would be of 5 characters, second field of 3 characters and so on.
    Can u please suggest how I can do it. Its urgent.

    Can't you search? Now you know what to google on: java 5 printf
    Kaj

  • External table: How to load data from a fixed format UTF8 external file

    Hi Experts,
    I am trying to read data from a fixed format UTF8 external file in to a external table. The file has non-ascii characters, and the presence of the non-ascii characters causes the data to be positioned incorrectly in the external table.
    The following is the content's of the file:
    20100423094529000000I1 ABÄCDE 1 000004
    20100423094529000000I2 OMS Crew 2 2 000004
    20100423094529000000I3 OMS Crew 3 3 000004
    20100423094529000000I4 OMS Crew 4 4 000004
    20100423094529000000I5 OMS Crew 5 5 000004
    20100423094529000000I6 OMS Crew 6 6 000004
    20100423094529000000I7 Mobile Crew 7 7 000004
    20100423094529000000I8 Mobile Crew 8 8 000004
    The structure of the data is as follows:
    Name Type Start End Length
    UPDATE_DTTM CHAR 1 20 20
    CHANGE_TYPE_CD CHAR 21 21 1
    CREW_CD CHAR 22 37 16
    CREW_DESCR CHAR 38 97 60
    CREW_ID CHAR 98 113 16
    UDF1_CD CHAR 114 143 30
    UDF1_DESCR CHAR 144 203 60
    UDF2_CD CHAR 204 233 30
    DATA_SOURCE_IND CHAR 294 299 6
    UDF2_DESCR CHAR 234 293 60
    I create the external table as follows:
    CREATE TABLE "D_CREW_EXT"
    "UPDATE_DTTM" CHAR(20 BYTE),
    "CHANGE_TYPE_CD" CHAR(1 BYTE),
    "CREW_CD" CHAR(16 BYTE),
    "CREW_DESCR" CHAR(60 BYTE),
    "CREW_ID" CHAR(16 BYTE),
    "UDF1_CD" CHAR(30 BYTE),
    "UDF1_DESCR" CHAR(60 BYTE),
    "UDF2_CD" CHAR(30 BYTE),
    "DATA_SOURCE_IND" CHAR(6 BYTE),
    "UDF2_DESCR" CHAR(60 BYTE)
    ORGANIZATION EXTERNAL
    TYPE ORACLE_LOADER DEFAULT DIRECTORY "TMP"
    ACCESS PARAMETERS ( RECORDS DELIMITED BY NEWLINE
    CHARACTERSET UTF8
    STRING SIZES ARE IN BYTES
    NOBADFILE NODISCARDFILE NOLOGFILE FIELDS NOTRIM
    ( "UPDATE_DTTM" POSITION (1:20) CHAR(20),
    "CHANGE_TYPE_CD" POSITION (21:21) CHAR(1),
    "CREW_CD" POSITION (22:37) CHAR(16),
    "CREW_DESCR" POSITION (38:97) CHAR(60),
    "CREW_ID" POSITION (98:113) CHAR(16),
    "UDF1_CD" POSITION (114:143) CHAR(30),
    "UDF1_DESCR" POSITION (144:203) CHAR(60),
    "UDF2_CD" POSITION (204:233) CHAR(30),
    "DATA_SOURCE_IND" POSITION (294:299) CHAR(6),
    "UDF2_DESCR" POSITION (234:293) CHAR(60) )
    ) LOCATION ( 'D_CREW_EXT.DAT' )
    REJECT LIMIT UNLIMITED;
    Check the result in database:
    select * from D_CREW_EXT;
    I found the first row is incorrect. For each non-ascii character,the fields to the right of the non-ascii character are off by 1 character,meaning that the data is moved 1 character to the right.
    Then I tried to use the option STRING SIZES ARE IN CHARACTERS instead of STRING SIZES ARE IN BYTES, it doesn't work either.
    The database version is 11.1.0.6.
    Edited by: yuan on May 21, 2010 2:43 AM

    Hi,
    I changed the BYTE in the create table part to CHAR, it still doesn't work. The result is the same. I think the problem is in ACCESS PARAMETERS.
    Any other suggestion?

  • How to add line breaks to output fixed width flat file

    0
    I need to create a Flat file without column headers, no comma separated values but each column will have a fixed starting position and a fixed length in the text file. For example, below is the text file to be created with six columns
    Column1  Column2   Column3     Column4  Column5      Column6
    abc          1             New emp      xxxx         xxxx           
    xxx
    Fixed starting position and a fixed lenth values for these columns as are below;
    Column1 : Starting Position -1, Fixed Length -4
    Column2 : Starting Position - 8, Fixed Length - 2
    Column3 : Starting Postion - 11, Fixed Length - 10
    Column4 : Starting Position -1, Fixed Length -5
    Column5 : Starting Position - 10, Fixed Length - 2
    Column6 : Starting Postion - 15, Fixed Length - 5
    The out put file each line have only 20 characters length.First 3 columns comes in first line and 4-6 columns comes in 2nd line.
    OUTPUT FILE:
    1234   89  11121314151617181920
    12345    1011          151617181920

    BOL says that:
    The Fixed width with row delimiters option is not available in the Flat File Connection Manager Editor.
    If necessary, you can emulate this option in the editor. To emulate this option, on the General page of the Flat File Connection Manager
    Editor, for Format, select Ragged right. Then on the Advanced page
    of the editor, add a new dummy column as the final column of data.
    More details steps:
    http://www.coderewind.com/2012/08/ssis-how-to-include-rowdelimiter-with-destination-flat-files/
    Below blog should make things clear:
    SSIS Flat File Export - "Fixed Width" vs "Ragged Right"
    -Vaibhav Chaudhari

  • The .txt file has formatting issues that need to be resolved

    Transaction ZEHS20 runs a program that assigns a CCL Group to a specification header, based on its Active Ingredients. The transaction can be run in the background if desired with output being emailed to the user.The .txt file has formatting issues that need to be resolved. can u  pls Help me to resolve this issue.
    Thanks

    What is the formatting issue like? Could you please elaborate a bit more.
    If it is because of varying lengths in the data then it can be handled by utilising a CONCATENATE RESPECTING blanks.

  • Txt format in a file created by the Payment Medium Program

    Hi,
    I need some help with a query from Payroll France.
    They use the transaction PC00_M06_FFOT (program RFFOF_V) to transfer payment data to banks.
    This program creates a txt file that is accessible to the payroll and accounting teams. This file is stored on local discs and as txt format it can be modified.
    The last audit pointed to this as a potential issue. The data in this file is very sensitive and shoud be secured against any modification.
    The program is SAP standard and the txt format is compliant with the system used by banks. That is why I am not sure if the file format can be modified. We were thinking perhaps a PDF fike would be an option. However, our Development do not want to touch at the change before we know if this will not be a problem for the banks' system.
    I've created a note for SAP about already but they say it is not really an error and in fact beyond their scope.
    Would appreciate some advice from you.
    Thanks,
    Monika.

    Monika :
    When running payment transfer to the bank (i.e. RFFOT or RFFOV), you have an option to either have the output file created (at application server) or a temse file created (which you would go to DME management to process downloading to a file (e.g. in your local PC machine).
    Having the ACH file created on application server site usually should be quite secure in my opition (first of, not many ee should have access to application servers; second, you can control not to allow non-authorized personnel to access to certain directories in application server; third, usually, when ACH file is created, it usually will be picked up by an automate process to send the file to the bank (rather than manual process)) .  Just my thought on your audit issue .
    Rgds.

  • Error with the data format in the TXT file, sending as an Email attachment

    Hi all,
    I have an problem in the data formating in the TXT file while sending as an attachment via an email by using the FM "SO_DOCUMENT_SEND_API1".
    For eg:
    The data in the TXT file is looking like as follows:
    0 0 0 0 2        L O U D S P E A K R   O T H E R   3 8 W h i t e                  0 0
    0031  L O U D S P E A K R   O T H E R   3 8 Black                               0 000
    38    L O U D S P E A K R   O T H E R   3 8 Brown                                  0 00040
    L O U D S P E A K R   O T H E R   3 8 Brown                                         0 00042
    and so on
    But it should come as :
    0 0 0 0 2  L O U D S P E A K R   O T H E R   3 8 W h i t e
    0 0 0031   L O U D S P E A K R   O T H E R   3 8 Black
    0 00038    L O U D S P E A K R   O T H E R   3 8 Brown
    0 00040    L O U D S P E A K R   O T H E R   3 8 Brown
    All the internal tables are correctly filled.
    The code is as follows:
    gwa_objtxt = 'Please find attached DATA EXTRACT Sheet'.
      append gwa_objtxt to git_objtxt.
    describe table git_objtxt lines gv_cnt.
      clear git_doc_data.
      read table git_objtxt index gv_cnt.
      git_doc_data-doc_size = ( gv_cnt - 1 ) * 255 + strlen( gwa_objtxt ).
      git_doc_data-obj_langu = sy-langu.
      git_doc_data-obj_descr = lv_mtitle.
      append git_doc_data.
      clear git_packing_list.
      refresh git_packing_list.
    git_packing_list-transf_bin = space.
      git_packing_list-head_start = 1.
      git_packing_list-head_num = 0.
      git_packing_list-body_start = 1.
      git_packing_list-body_num   = gv_cnt.
      git_packing_list-doc_type = 'RAW'.
      append git_packing_list.
      Clear : gv_cnt.
      Describe table git_objbin lines gv_cnt.
      git_packing_list-transf_bin = 'X'.
      git_packing_list-head_start = 1.
      git_packing_list-head_num = 1.
      git_packing_list-body_start = 1.
      git_packing_list-body_num = gv_cnt.
      git_packing_list-doc_type = 'TXT'.
      git_packing_list-obj_descr = 'ATTACH.TXT'.
      git_packing_list-obj_name = 'book'.
      git_packing_list-doc_size = gv_cnt * 255.
      APPEND git_packing_list.
      clear git_receivers.
      refresh git_receivers.
      git_receivers-receiver = gv_eid.
      git_receivers-rec_type = 'U'.
      append git_receivers.
    CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
        EXPORTING
          DOCUMENT_DATA              = git_doc_data
          PUT_IN_OUTBOX              = 'X'
          COMMIT_WORK                = 'X'
        TABLES
          PACKING_LIST               = git_packing_list
          CONTENTS_BIN               = git_objbin
          CONTENTS_TXT               = git_objtxt
          RECEIVERS                  = git_receivers
        EXCEPTIONS
          TOO_MANY_RECEIVERS              = 1
          DOCUMENT_NOT_SENT                = 2
          DOCUMENT_TYPE_NOT_EXIST      = 3
          OPERATION_NO_AUTHORIZATION = 4
          PARAMETER_ERROR                    = 5
          X_ERROR                                      = 6
          ENQUEUE_ERROR                        = 7
          OTHERS                                        = 8.

    please give the code of
    contents bin =  git_objbin " how  this is getting populated.
    0 0 0 0 2 L O U D S P E A K R O T H E R 3 8 W h i t e <b>0 0</b>
    0031 L O U D S P E A K R O T H E R 3 8 Black
    0 000
    38
    from this im not able to understand is this over population or concatenation problem
    y dont u make a append to the final table
    like
    data : begin of itxt occurs 0, ,
    s1(132) type c ,
    end of itxt.
    loop at itab.
    itxt-s1+0(4) = itab-f1.
    itxt-s1+4(6) = itab-f2.
    itxt-s1+10(8) = itab-f3.
    itxts1+18(4) = itab-f4.
    append itxt.
    clear itxt.
    endloop.
    exchange this to the contents bin of hte Fm .
    regards,
    vijay.
    can u please mail the text file and the expected o/p to my mail id [email protected]  so that i can see the same from the data provided i m not able to check the result properly .

Maybe you are looking for