Help needed saving text members to TAB delimited txt file

I have 7 text memebrs each containing several lines of text
that were pulled in and sorted from a TAB delimited text file.
What I'd like to know is, is there any way to convert those
text members back into the TAB delimited format from which they
came? I'd like to be able to pull in the data, let it be edited to
some extent, then saved back out..... and I'm not too sure how to
go about it.
Example of txt file:
ID_No Name Age
1 Phil 26
2 Sam 34
3 Mary 21
They're then sorted in to text files of ID_No, Name, and Age,
with the lists of the relevent items in each.
Like.....
ID_No
1
2
3
Name
Phil
Sam
Mary
Age
26
34
21
Certain lines of these text members change, depending on what
the user selects. I'd like to put these sections back in their
original TAB delimited format, but with any changed data replacing
the old, so next ime the app is opened the new data is pulled in
from the txt file.
I know I'm probably going about this the wrong way, but it's
the only way I know so far lol
Any ideas?

global filex, idlst, namelst, agelst
on readtabline (str)
tmpstr = ""
y = 1
repeat with x = 1 to the number of chars in str do
if str.char[x] = tab then
case y of
1 : idlst.add (tmpstr)
2 : namelst.add (tmpstr)
3 : agelst.add (tmpstr)
end case
tmpstr = ""
y = y + 1
else
tmpstr = tmpstr & str.char[x]
end if
end repeat
agelst.add (tmpstr)
end
on exitFrame me
idlst = [] --set up some lists to hold that data we read in
namelst = []
agelst = []
filex = new (xtra "fileio")
filex.openfile ("t.txt", 1)
indata = filex.readfile() -- read the data in
filex.closefile()
filex = void
repeat with x = 1 to the number of lines in indata do
readtabline(indata.line[x]) --seprate it into its diffrent
elements
end repeat
-- you now have your data sorted in to three list of id, age
and name
-- so you would now do what ever editing you wanted to do
--now to write it out to a new file
filex = new (xtra "fileio")
filex.createfile (the moviepath & "tout.txt")
filex.openfile (the moviepath & "tout.txt", 2)
repeat with x = 1 to idlst.count() do
filex.writestring (idlst[x] & tab & namelst[x] &
tab & agelst[x] & return)
end repeat
filex.closefile()
end
I tested this on your exact scenario and it worked a brezze
hope it helps
Regards
David

Similar Messages

  • Upload/Download from unix - give easy exammple for tab delimited .TXT file

    Hello experts,
    I have 2 requirements.
    1. I want to upload a tab delimited .txt file from local PC to UNIX server.
    2. I want to Read same file, then some process and get result to the same location. (output file name should be diffrent)
    How i can fulfill these two requirements?
    Regards,
    RH

    Hi,
    upload a tab delimited .txt file from local PC to UNIX server
    Please go through the below logic this will help you,
    *& Report  Z10_SHAD_V_UPLD_PR_APP_SERV
    report  z10_shad_v_upld_pr_app_serv message-id zmessage.
    *&--INCLUDE FOR DECLARATION
    include z10_upld_top.
    *&--INCLUDE FOR ALL FORMS
    include z10_upld_forms.
    start-of-selection.
    *&--PERFORM FOR UPLOADING LOGIC.
    perform z10_upld.
    end-of-selection.
    *&  Include           Z10_UPLD_TOP
    *&--STRUCTURE FOR INTERNAL TABLE.
    *&--THAT IS GOING TO HOLD PRESENTATION SERVER FILE DATA.
    data:begin of wa,
    name(40) ,
    end of wa.
    *&--INTERNAL TABLE THAT IS GOING TO HOLD PRESENTATION SERVER DATA.
    data: it_tab like wa occurs 0 with header line.
    *&--SELECTION-SCREEN FOR GETTING THE PATH OF PRESENTATION LAYER
    selection-screen begin of block abc with frame title text-001.
    parameters: p_string(128) type c,
                      p_st(128) type c,
    selection-screen end of block abc.
    data: file_path type rlgrap-filename.
    data: p_path type rlgrap-filename,
          filename1 type string,
          file_name like ibipparms-path,
          v_path like dxfields-longpath,
          l_path type string.
    *&--PROVIDING F4 KEY FOR THE SCREEN FIELD THAT IS GOING TO
    *&--HAVE THE PRESENTATION SERVER FILE PATH
    at selection-screen on value-request for p_string.
      call function 'F4_FILENAME'
       exporting
         program_name        = syst-cprog
         dynpro_number       = syst-dynnr
      FIELD_NAME          = ' '
       importing
         file_name           = file_name
      p_string = file_name.
    file_path = p_string.
    p_path = file_path.
      filename1 = file_name.
    *&--PROVIDING F4 KEY FOR THE SCREEN FIELD THAT IS GOING TO
    *&--HAVE THE APPLICATION SERVER FILE PATH
    at selection-screen on value-request for p_st.
    call function 'F4_DXFILENAME_TOPRECURSION'
    EXPORTING
      I_LOCATION_FLAG       = ' '
      I_SERVER              = '?'
      I_PATH                =
      FILEMASK              = '.'
      FILEOPERATION         = 'R'
    importing
      O_LOCATION_FLAG       =
      O_SERVER              =
       o_path                = v_path
      ABEND_FLAG            =
    exceptions
       rfc_error             = 1
       error_with_gui        = 2
       others                = 3
    p_st = v_path.
    if sy-subrc <> 0.
    message id sy-msgid type sy-msgty number sy-msgno
             with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    endif.
    *&      Form  Z10_UPLD
          text
    -->  p1        text
    <--  p2        text
    form z10_upld .
    if not p_string is initial.
    *&--FUNCTION MODULE THAT IS GOING TO UPLOAD THE PRESENTATION SERVER FILE TO
    *&--APPLICATION SERVER.
    call function 'GUI_UPLOAD'
      exporting
       filename                      = filename1
       filetype                      = 'ASC'
      HAS_FIELD_SEPARATOR           = ' '
      HEADER_LENGTH                 = 0
      READ_BY_LINE                  = 'X'
      DAT_MODE                      = ' '
      CODEPAGE                      = ' '
      IGNORE_CERR                   = ABAP_TRUE
      REPLACEMENT                   = '#'
      CHECK_BOM                     = ' '
      VIRUS_SCAN_PROFILE            =
      NO_AUTH_CHECK                 = ' '
    IMPORTING
      FILELENGTH                    =
      HEADER                        =
      tables
        data_tab                      = it_tab[]
    exceptions
       file_open_error               = 1
       file_read_error               = 2
       no_batch                      = 3
       gui_refuse_filetransfer       = 4
       invalid_type                  = 5
       no_authority                  = 6
       unknown_error                 = 7
       bad_data_format               = 8
       header_not_allowed            = 9
       separator_not_allowed         = 10
       header_too_long               = 11
       unknown_dp_error              = 12
       access_denied                 = 13
       dp_out_of_memory              = 14
       disk_full                     = 15
       dp_timeout                    = 16
       others                        = 17
    if sy-subrc <> 0.
    message id sy-msgid type sy-msgty number sy-msgno
             with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    endif.
    *path = filename1.
    open dataset p_st in text mode for output encoding default.
      if sy-subrc ne 0.
        close dataset p_st.
        exit.
      endif.
      if sy-subrc eq 0.
      loop at it_tab.
        transfer it_tab to p_st.
      endloop.
      close dataset p_st.
      message i000.
      endif.
    endif.
    endform.                    " Z10_UPLD
    Hope this helps.

  • Dowloading tab delimited .txt file

    Hello friends,
    I am downloading one tab delimited .txt file from internal table using OPEN dataset , READ dataset.
    But output looks like...
    4500603096     20081008[]4500603095     20081003[]4500603087     20080924[]4500603083     20080910[]4500603084     20080910[]
    and I want output as follows in .TXT file
    4500603096     20081008
    4500603095     20081003
    4500603087     20080924
    4500603083     20080910
    4500603084     20080910
    While same file i open with excel it works correctly.
    Why this is happening?
    My code is below...
    OPEN DATASET l_file FOR OUTPUT IN TEXT MODE.
          IF sy-subrc = 0.
            LOOP AT i_po_extarct INTO lw_po_extract.
              CONCATENATE lw_po_extract-ebeln
                          lw_po_extract-aedat
                  INTO l_string
                  SEPARATED BY wc_tab.
    *         Get the logs to the file.
              TRANSFER l_string TO l_file.
            ENDLOOP.
    *       Close the dataset
            CLOSE DATASET l_file.
          ELSE.
            MESSAGE e303(me) WITH 'File not found'.
          ENDIF.
    note : l_string and l_file are type STRING.
    Edited by: Ronny Hanks on Oct 21, 2008 10:39 AM
    Edited by: Ronny Hanks on Oct 21, 2008 10:40 AM

    OPEN DATASET a_plant FOR INPUT IN TEXT MODE ENCODING DEFAULT.
        DO.
          READ DATASET  a_plant INTO w_string.
          IF sy-subrc <> 0.
            EXIT.
          ENDIF.
          SPLIT w_string AT cl_abap_char_utilities=>horizontal_tab
          INTO w_txt1-werks w_txt1-name1 w_txt1-country .
          MOVE w_txt1 TO it_plant.
          APPEND it_plant.
          CLEAR w_txt1.
          CLEAR w_string.
        ENDDO.
        CLOSE DATASET a_plant.
    hope it will useful to you

  • XLS to I delimited txt file

    i created a report to download values from a table into xls file.and when i open the file in txt,its opening in tab delimited format.
    now,instead of that i want the file to be opened in |(pipe) delimited txt file.
    can any one help me in this regard.

    Hi Prashanth,
    First check in ur download FM there is a parameter called has_field_seperator is available r not ,
    if its there just copy that parameter and paste in ur FM where ur using,,
    has_field_seperator = '|'
    just paste like this in ur FM , before pasting check whether this parameter is available r not in ur version..
    Hi Prashanth did ur issue was resolved by this solution,
    if possible try to reward for useful answers
    Thanks
    Naveen khan
    Message was edited by:
            Pattan Naveen

  • 8350I help w/ saved text messages

    Hey everyone,  I was just wondering if anyone could help me out. I have a Nextel 8350i curve.  I have saved text massages that i need to print out to give to the police, the only problem is that i have to email all of the text messages to get them to print out. is there an easier way to get the messages from my phone to my pc so i can print them? I have connected the blackberry to my pc but i can not find my saved messages. can some one please help me?

    i need help with saving a lot of text messages on my blackberry 8330 curve how can i get them on my pc so i can print them

  • Replace the text numbers string in a txt file using C++.. Help Me..

    Read a Document and replace the text numbers in a txt file using c++..
    For ex: 
    Before Document: 
    hai hello my daily salary is two thousand and five and your salary is five billion. my age is 
    twenty-five. 
    After Document: 
    hai hello my daily salary is # and your salary is #. my age is #. 
    All the text numbers and i put the # symbol.. 
    I am trying this code: 
    #include <iostream>
    #include <fstream>
    #include <string>
    using namespace std;
    ifstream myfile_in ("input.txt");
    ofstream myfile_out ("output.txt");
    string line;
    void find_and_replace( string &source, string find, string replace ) {
    size_t j;
    for ( ; (j = source.find( find )) != string::npos ; ) {
    source.replace( j, find.length(), replace );
    myfile_out << source <<endl;
    cout << source << endl;
    int main () {
    if (myfile_in.is_open())
    int i = 0,j;
    //string strcomma ;
    // string strspace ;
    while (! myfile_in.eof() )
    getline (myfile_in,line);
    string strcomma= "two";
    string strspace = "#";
    find_and_replace( line , strcomma , strspace );
    i++;
    myfile_in.close();
    else cout << "Unable to open file(s) ";
    system("PAUSE");
    return 0;
    Please help me.. Give me the correct code..

    Open the file as a RandomAccessFile. Check its length. Declare a byte array as big as its length and do a single read to get the file into RAM.
    Is this a simple text file (bytes)? No problem. If it's really 16-bit chars, use java.nio to first wrap the byte array as a ByteBuffer and then view the ByteBuffer as a CharBuffer.
    Then you're ready for search/replace. Do it as you would in any other language. Be sure to use System.arraycopy() to shove your bytes right (replace bigger than search) or left (replace smaller than search).
    When done, a single write() to the RandomAccessFile will put it all back. As you search/replace, keep track of size. If the final file is smaller than the original, use a setLength() to the new size to avoid extraneous data at the end.

  • Saving a CSV report output as TXT file

    Hi,
    We are generating reports on the web using Intenet Explorer. The report is a CSV report, i.e. the data displayed is comma separated. After generating the report, we need to save it as TXT file.
    If the length of a line is long (let us say more than 80 chars) while saving it as TXT file, it is saving as 2 lines. If the length of a line is less, then it is saving in a single line.
    How can I avoid this 2 line problem?
    I am not facing this problem if I generate report with Netscape browser and save as TXT file.
    We are using Reports 6i.
    Thanks in Advance,
    Srinivas

    Hello,
    I had the same problem. And I think what I did to fix it is I made the mode=charcter, batch=yes, and background=yes. Hope this helps.
    Martin

  • Saving and Loading variables in a .txt file (Offline)

    I'm working a software we've done with Flash, but we'd want
    people to be able to save the variables they selected. We need them
    to be able to save the value of about 10 variables in a file on
    their desktop, and then be able to load that file again.
    Is it possible to do that without having to use php or stuff
    like that (that's why we want to make it an offline applications so
    we don't have to use php to be able to save files).
    I know Actionscript looks a lot like Javascript and with
    Javascript it's really easy to do, but all the saving functions are
    blocked in Flash for security reasons.
    If anyone knows how to do that, to simply save and load a
    .txt file, please let me know. If it would be possible also to
    change the .txt to whatever else it would be even better. The file
    can still be opened in Notepad but at least it looks a bit more
    professionnal to have our own extension. Again in Javascript or
    with a .bat file it's really easy to save variables to whatever
    type of file, even to non existing types, it simply creates a text
    file with an unknown ending.
    Thanks!

    I found a page that explains in a really easy way how to
    communicate with Javascript if the flash object is contained in an
    html page, but I couldn't find any page explaining how it works if
    it's not in an html page. On our side, before using the software
    we're creating we'll convert it to a .exe. How can we call a
    Javascript from that .exe since we can't incorporate the Javascript
    in the container since there isn't really a container... Is there a
    way to link to a Javascript (.js) that would be in the same folder
    as the .exe? Or would there be a way to incorporate the Javascript
    right into the .exe?
    Let me know if any of you have a solution for that.
    Thanks!
    http://livedocs.adobe.com/flash/9.0/main/wwhelp/wwhimpl/common/html/wwhelp.htm?context=Liv eDocs_Parts&file=00000342.html#wp126566

  • Since Lion, text edit can't open txt files

    Since upgrading to Lion on my 2.4 Ghz iMac, TextEdit won't open .txt files (even ones it has just created). I get the following error message: The document “[filename].txt” could not be opened. TextEdit cannot open files of this type.
    When Lion was first installed, it was opening my .txt file with Console, until I told it to use TextEdit. Now I get the error above. The files are fine (they work on other computers, word, console, etc)
    I know I can download a different (and possibly better) text editor, but I like TextEdit and also am worried that this is a symptom of a deeper issue.
    So far, I've restarted and repaired all permissions on My HD. Not sure what could be causing this as reading .txt files is pretty essential to TextEdit.

    I guess my installation got messed up by chance: I reinstalled Lion and things seem to be working well now. Not sure what the problem was.

  • Need help with saving text

    i,ve created frame with a JTable, and add new button.
    every time i run project table gets empty, of course, that is normal, but i would like that when i tipe something in my table and press button, things i wrote in table get saved. lets say that the variable name of JTable is "table" and name of button "save". i'm not expert in java programing but i really need this code. could someone please be so generous and wrote that code for me? i need it till tomorrow :S

    What you need is Serialization.
    I did a quick google search and found this:
    http://java.sun.com/developer/technicalArticles/Programming/serialization/
    It basically allows you to save your object and load it later.
    You could also save your stuff in plain text. Follow this tutorial to learn how, This is maybe a bit easier if you don't know what objects are.
    http://java.sun.com/docs/books/tutorial/essential/io/index.html

  • HELP! Saving text message from original iphone

    I've got the original iphone and I need to know how to save several pages of text for a court hearing. I have tried several suggestions on here to save messages but none are working. I have tried taking a screen shot by holding down the home and power button at the same time, my version of iphone does not allow forwarding messages, so I can't sent it to an email address to print out later. I understand that there are applications that one can purchase, but I'm wondering if they are configured for the original iphone... can anyone help me?

    You can do your backup either to iTunes or to iCloud, which ever way you have been doing them in the past. This support document might make it easier for you to chose if you haven't been backing up in the past. http://support.apple.com/kb/HT5262 Make sure for safety sake that you import the pictures from your camera roll and that you sync contacts and calendar data to a supported application on the computer. Then follow the information in this support document for putting data from old device onto the new device. http://support.apple.com/kb/HT2109

  • Help needed in TEXT determination procedure - Urgent

    Hi Experts,
    I have defined my own text determination procedure for complaints. This procedure is for the item category for the transaction(complaint).
    The following are the Text ID's that I have include in my procedure :
    1. C001
    2. C002
    3. C003
    My requirment is to have logs(history) for each of the text id's(C001, C002, C003).
    i.e. what ever i do in C001, it has to be loogged only in text id let;s say ZC001, same way C002 shld be logged only in ZC002 and C003 in ZC003.
    I have also defined ZC001, ZC002, ZC003 in the text detrmination procedure.
    Please help me in slving this problem. Can i do it in the config itself or shld i go for development?.
    Regards,
    Arul Jothi A.

    hi,
    This is what exactly i am lloking for, but i tried with your proposal. It didint work.
    Please find the detailos below.
    Text Object      CRM_ORDERI
    Text Det.Proc:   ZCOMP001
    Text Type  Description              Seq.        changes     Transfer      Access Seq.
    C001     Complaints Text     0001     P              -                   -
    Z001     complaints1     0002     R     A     ZC01
    C002     Internal note     0003     P              -                   -
    Z002     original text test     0004     R     A     ZC02
    C003     Recomm. Solution     0005     P              -                   -
    Z003     original text 3     0006     R     A     ZC03
    Access Seq :
    ZC01 :
    Ref. Object     CRM_ORDERI
    Ref. Text Type  C001
    continue chcked.
    ZC02.
    Ref. Object     CRM_ORDERI
    Ref. Text Type  C002
    continue chked
    ZC03.
    Ref. Object     CRM_ORDERI
    Ref. Text Type  C003
    continue chked
    I want to log all C001 text into Z001 only, C002 in Z002 only and C003 in Z003 only.
    hope you got it....
    Please help.
    Regrads,
    Arul Jothi A

  • Help needed in text entry box...

    hi,
    I have created one assessment simulation, which has a few text entry boxes. This I have included it in another flash file. Output of that flash file is .exe and not .swf.  But when I play that exe; this simulation doent allow to enter the text, while instead and exe if I play the SWF its working properly.
    I want it to work in .exe as well....
    Plz help....
    Suajg

    Hi,
    We are creating a WBT in flash. Output of this WBT is an exe file. There are some instructions and do's n dont's where we have given this Assessment. This assessment is in swf format created in Captivate 4.
    Regards,
    Suajg

  • Help needed on text variable.

    Hi experts,
    I have to write a report that requires text variable.
    My scenario is as follows:
    1. User have to key in posting period into variable 0P_PER3.
    2. The text variable has to translate posting period into calendar month. However, since I am not using K4 fiscal year variant, this cannot be done directly. I use V3 fiscal year variant, which means:
    Posting Period 01 = April
    Posting Period 02 = May
    Posting Period 03 = June
    Posting Period 04 = July
    Posting Period 05 = August
    Posting Period 06 = September
    Posting Period 07 = October
    Posting Period 12 = March.
    So, let say the user key in posting period 12; in my report, the text variable must displays 'March'.
    Is there any standard variable that I can use to achieve above goal? If not, how can I create such a variable?
    Many thanks!

    Hi,
    first of all you create 12 customer exit text variable.
    then go to SMOD tcode.
    give RSR00001 as project name
    select component and click on display.
    then double click on EXIT_SAPLRRS0_001
    then double click on zxrsru01 include.
    in the code window write down below code for each of your text variable.
    case i_vname.
        when 'YOURFIRSTTEXTVARIABLENAME'.
            if i_step = 2.
              read table i_t_var_range into loc_var_range
              with key vnam = 'YOURPERIODVARIABLENAME'.
              case loc_var_range-low+58(2).
                when '01'.
                  l_s_range-low = 'YOURMONTHNAME'. "e.g. March
                 when '02'.
    like this write for 12 periods.
              endcase.
              l_s_range-sign = 'I'.
              l_s_range-opt = 'EQ'.       
            endif.
    hope this helps.
    Regards,
    Purvang

  • Quick help needed (putting text on a .mov)

    OK, I have never used this program before and I am looking for a quick solution:
    After importing a film in .mov format the text looks fuzzy and awful. The text is simply white on a black background. The whole film has been imported and shows up as one clip.
    Can I make a still picture in Photoshop with the text and put it on top of the part with the fuzzy text in iMovie? How would I go about that? Is there another way to put clean looking text over the old fuzzy one?
    Thanks in advance for any help!

    If the text track was created using QuickTime Pro and then converted to "video" the results will vary greatly and the quality will never be the same as the QuickTime version.
    QuickTime text tracks are vector graphics (scale without distortion) and they look clear, clean and crisp.
    But when you "convert" them to "video" they not only lose the vector graphics but get rendered with some ugly results.
    Many QuickTime users are not aware that text tracks can even be converted to "video" format.
    I started with a Karaoke style QuickTime file with MIDI instruments:
    http://homepage.mac.com/kkirkster/.Public/blackbird_text.qtl
    Then I converted it to "video" and added a varying color background to show the quality degradation:
    http://homepage.mac.com/kkirkster/.Public/blackbird.qtl
    The MIDI audio was also converted to AAC audio which balloons the file size from 9 KB's to nearly 4 MB's.
    Basic results?
    Don't convert text to video.
    Add text tracks after export from iMovie using QuickTime Pro if the files will be viewed on a computer or served from the Web:
    http://homepage.mac.com/kkirkster/Lemon_Trees/
    As an example.

Maybe you are looking for

  • Can't open Canon Rebel T5i raw file in elements 10

    I am trying to open a raw file (CR2) in my Elements 10 program, but I keep getting error messages that it's the "wrong type of file". I've looked around & downloaded the plug-in that was supposed to fix that, but it still isn't working. What am I mis

  • Why is User defined exception block not reaching

    I want to catch exception if wrong column name is there in a select statement. In this example i am useing static query but in real time it will be a dynamic query and it may be possible that a particualre column has been deleted from that table so a

  • How to display vendor bank key Invoice verification

    Dear all: When I use t-code FB60, I got bank name from the display of vendor data. Is it possible to display vendor "bank key" instead of "bank name"? Thanks a lot.

  • Why does PSE destroy Exif entries?

    Someone looking at my images in Flickr asked me why I was shooting in Auto mode?  I don't - I usually shoot in Aperture Priority.  Well my Exif wasn't showing that.  I called Canon Tech Support and they could not give me an answer.  So I kept digging

  • Uninstall an OSX or Pro Apps Update

    Hi, I would like to be able to reverse an update after installing it because sometimes that update creates a confilct with other applications running, such as in my current case. I installed a pro apps update and now postgresql will not start... Is t