Adding Header to a TEXT File

Hi All,
I am downloading some data into a text file using GUI_DOWNLOAD FM.
Is there any way that i can add a header line on top of the file? In excel file, it is possible, but how do i do it for a *.txt file?
Regards
Abhijith H

Hi Abhijith,
The below code is to download a CSV txt file. If u want u can get the excel file also by just changing the extension from .txt to .exl Try in the way given below. U will be able to insert the required header too and get the excel file also.
*&      Form  gui_download
      Called to download the data selected
FORM gui_download.
*--Local data declaration
  DATA : l_count TYPE i,
         l_filename TYPE string.
  FIELD-SYMBOLS: <fs_download>.
*--Count the number of fields
  DO.
    ASSIGN COMPONENT sy-index OF STRUCTURE wa_inputtab TO <fs_download>.
    IF sy-subrc <> 0.
      EXIT.
    ELSE.
      l_count = l_count + 1.
    ENDIF.
  ENDDO.
  CLEAR wa_inputtab.
*--Inserting the fields to the internal table in the required format
  LOOP AT inputtab INTO wa_inputtab.
    DO l_count TIMES.         " Adding the delimiter in required places
      ASSIGN COMPONENT sy-index OF STRUCTURE wa_inputtab TO
                                                        <fs_download>.
      CONCATENATE wa_csv_output ',' <fs_download> INTO wa_csv_output.
    ENDDO.
    SHIFT  wa_csv_output.
    APPEND wa_csv_output TO itab_csv_output.
    CLEAR  wa_csv_output.
  ENDLOOP.
*--Inserting the header to the internal table.
  CONCATENATE 'DTAFF#' 'DTPRAC' 'DTPPP'  'DTREP'  'DTCURR' 'DTNATL'
              'DTLAMT' 'DTFMD'  'DT$AMT' 'DTUNIT' 'DTRATE'
              INTO wa_csv_output SEPARATED BY ','.
  INSERT wa_csv_output INTO itab_csv_output INDEX 1.
  IF NOT itab_csv_output[] IS INITIAL.
*--Download Data
    l_filename = p_output.
    CALL FUNCTION 'GUI_DOWNLOAD'
         EXPORTING
              filename                = l_filename
              filetype                = 'ASC'
              has_field_separator     = 'X'
         TABLES
              data_tab                = itab_csv_output
         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.
Reward if useful,
Cheers,
Sharadendu

Similar Messages

  • How can I add a header to a text file without mapping? [Using only ID]

    Hi Experts,
    I am doing a scenario in which I want to add a dynamic header to a text file, due to the complications related to the structure, I dont want to create a message type, data type etc so I cant use mapping.
    I want to do all the manipuations in Integration Directory itself.
    Can you all please help me out in this?
    Thanks in advance
    Thomas

    Hi  Experts,
    I am new to XI, so only elaborate answers would help me
    This is the specific requirement i want;
    There is a 'source text file' which is a collection of 1000+ records, I want to make a 'target file' which is a combination of 2 fields, one field will be the dynamically generated name [for the target file] and the other field will be the whole 'source file' content.
    From the last response for my question, I understand the dynamic file generation part can be done using java mapping.
    Is there anyway by which I can get in the whole content of the source file into a field in the target file?
    Thanks in Advance
    Thomas

  • Header information in text files

    I have a VI which logs information every ten minutes into a text file. I want to add a header to the beginning of the file only once, not every ten minutes as with the rest of the information. How can I accomplish this.

    At the beginning of your test create the file outside a loop and write the header information to it. Then inside the loop, keep the file open then every 10 minutes append your data to it, then close the file when finished.

  • Adding header to download local file

    Hi All!
    I am downloading .xls file onto the presentation server with column headings and the values following.Now I want to add a header to the downloaded file above the column headings in BOLD.Is it possible to append header/Title to the downloaded file.Please advise me with example code..
    Regards
    Praneeth

    Hi,
    Try using FM CREATE_XLS_HEADER_FROM_DDIC.
    or try using FM : 'EXCEL_OLE_STANDARD_DAT'
    ex code :
    DATA: BEGIN OF i_tab OCCURS 0,
          anlage(20) TYPE c,
          num(2) TYPE c,
          END OF i_tab.
    DATA: BEGIN OF i_head OCCURS 0,
          field(30) TYPE c,
          END OF i_head.
    i_tab-anlage = '0070002545'.
    i_tab-num   = '1'.
    APPEND i_tab.
    CLEAR i_tab.
    i_tab-anlage = '0070002546'.
    i_tab-num   = '2'.
    APPEND i_tab.
    CLEAR i_tab.
    i_tab-anlage = '0070002547'.
    i_tab-num   = '3'.
    APPEND i_tab.
    CLEAR i_tab.
    i_tab-anlage = '0070002548'.
    i_tab-num   = '4'.
    APPEND i_tab.
    CLEAR i_tab.
    i_head-field = 'Installation'.
    APPEND i_head.
    i_head-field =  'NO'.
    APPEND i_head.
    CLEAR i_head.
    CALL FUNCTION 'EXCEL_OLE_STANDARD_DAT'
      EXPORTING
      file_name  = 'C:\Documents and Settings\vepakom\Desktop\test1.xls'
       create_pivot                    = 0
       data_sheet_name                 = 'MY DATA'
      PIVOT_SHEET_NAME                = ' '
      PASSWORD                        = ' '
      PASSWORD_OPTION                 = 0
    TABLES
       pivot_field_tab                  = dlpivot
       data_tab                         = i_tab
       fieldnames                       = i_head
    EXCEPTIONS
       file_not_exist                  = 1
       filename_expected               = 2
       communication_error             = 3
       ole_object_method_error         = 4
       ole_object_property_error       = 5
       invalid_pivot_fields            = 6
       download_problem                = 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.
    Sharat
    ps : pls reward if helpful

  • Write to measurement file, adding column name in text file.

    Hello,
    Is it possible to add own column name for a text file using Write to measurement file function?
    In the created file I have three different columns (I want to name them Time/Voltage/Date&Time).
    Maby I should choose different write option like write to spreadsheet?

    You are going to have to post some actual code if you want us to help here.  Otherwise it is a complete shot in the dark.  Posting an example CSV file of what you have and what you want would also be beneficial.
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines

  • Adding data from a text file into a JTextArea

    I'm working on a blogging program and I need to add data from a text file named messages.txt into a JTextArea named messages. How do I go about doing this?

    then you need to be more specific in what you need help with because those are two commonly used options for reading data in from a file. what have you tried? where is your code failing? what kind of errors are you getting? of course it looks like others in the forum have already reprimanded you for failing to post properly.
    i have used both FileReader and the nio package for cfg and ini files which are both just txt files as well as massive data files. so tell me how they dont help you?

  • Import data from text file

    We are trying to import data from a text file into fields in a form using the importTextData method for the Doc object. The script we are using looks like this:
    var doc = event.target;
    var returnCode = doc.importTextData("datafile.txt",0);
    The text file "datafile.txt" contains tab separated values in a header row (which corresonds to field names in the form) followed by tab separated datarows - all according to instructions in the API.
    The returnCode will result in an integer value, which in our case represent "Error: Invalid Row". It would help us a lot if anyone could give us a hint on what may be wrong or even better post a working solution.
    We have also tried using the importTextData method without any parameters (the user is then prompted to select the text file and then the specific row) but the result remains the same. The fields in the form are not populated with data and the message "Error: Invalid Row" is returned.
    Annika Lindqvist

    The problem you're experiencing is that importTextData is an Acrobat API call. As such, it executes on the AcroForm field equivalents to the XFA fields you've placed on the form. What's not indicated in the API for importTextData is that the names in the fields in the header of the text file must be the
    full AcroForm SOM expression.
    I've created a working sample to explain this.
    First, I created a form with a table with one row in it containing 3 columns named FirstName, LastName and Country.
    Then I created a data.txt file like this:
    FirstName LastName Country
    Fred Jones USA
    Kyle Francis Canada
    Sam Roberts UK
    I then placed a button on the form which calls "event.target.importTextData();" and ran the form in Preview.
    Of course, when I selected a row for import, nothing happened.
    I then used the "Avanced | Forms | Export Data from Form..." menu option in Acrobat after filling-in the fields in the table with some text and looked at the generated text file (note that you have to specify text as the output format). In there, I was able to figure-out what the full AcroFrom SOM expression was for each field I wanted to import data into.
    I changed my data file to look like this:
    form1[0].#subform[0].Table1[0].Row1[0].FirstName[0] form1[0].#subform[0].Table1[0].Row1[0].LastName[0] form1[0].#subform[0].Table1[0].Row1[0].Country[0]
    Fred Jones USA
    Kyle Francis Canada
    Sam Roberts UK
    Afther that, importTextData worked as expected without any errors.
    Stefan
    Adobe Systems

  • How to add header and fooder in text file

    Hi,
    i have created simple application for generate report from database into text file.
    But i need to add header and fooder in text file. I dont know is there any API for adding these.
    Can anyone help me to create header and fooder in text file.
    the below text are needs to be print in the header
    name of the table :
    Recorder type :
    file creation time:
    the below text are needs to be print in the footer
    Recorder Number:
    Record Type;
    the actual code is
                           pst = con.prepareStatement("select REQUEST, DOMAIN_NAME, TRUNC(DATE_OF_CONFIGURATION) AS dateofConfig  FROM employee where id=300");
                               rs = pst.executeQuery();
                            while (rs.next()) {
                                 request = rs.getString("REQUEST");
                                    domain_name = rs.getString("DOMAIN_NAME");
                                    dateofconfig = rs.getString("dateofConfig");
                                    System.out.println(request + " " + domain_name + " " + dateofconfig);
                                   data.add(request + " " + domain_name + " " + dateofconfig);
                            System.out.println("before calling method");
                            writeToFile(data, "c:/Employee.txt");
                            System.out.println("file created successfull");
                            rs.close();
                            pst.close();
           private static void writeToFile(List list, String path) {
                    BufferedWriter out = null;
                    try {
                            File file = new File(path);
                            out = new BufferedWriter(new FileWriter(file, true));
                            for (Object obj : list) {
                                String s=  obj.toString(); 
                                 out.write(s);
                                    out.newLine();
                            out.close();
                    } catch (IOException e) {
    }Thanks
    Jasmin
    Edited by: user13836688 on Mar 21, 2011 4:06 AM
    Edited by: user13836688 on Mar 21, 2011 4:07 AM
    Edited by: user13836688 on Mar 21, 2011 4:08 AM

    user13836688 wrote:
    i have created simple application for generate report from database into text file.First off, when posting code, use &#91;code]...&#91;/code]. or '' tags, not '<code>'.
    But i need to add header and fooder in text file. I dont know is there any API for adding these.
    Can anyone help me to create header and fooder in text file.Well you plainly have the code to write the file contents; and furthermore your report seems to be contained in a List called 'data'. Why not just add the header and footer lines to it? I'd also suggest making 'data' a LinkedList. That way you can add the header afterwards with no performance hit, just in case the information it contains isn't available at the start of your report loop.
    Winston                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Extra space adding during spool data into text file

    I'm using sql developer to query oracle tables. I can export data using GUI of sql developer, but I wish to use spool query to export the data. Using below query, I was able to export the data to specified location, but my final text file consist of additional spaces after each line. These additional spaces between each line is causing an error to upload the text file in different location.
    Did any one face have this issue? Below is my query
    set head off
    SET FEEDBACK OFF
    SET ECHO    OFF
    SET TRIMSPOOL ON
    SET TRIMOUT ON
    spool c:\test.txt
    select cast(memberid||',12'as varchar2(20))
    from abc;
    spool off
    set head on
    set ECHO on
    i'm using trimspool, and trimout, but it is not removing any blank spaces.

    Sorry, I changed my export.sql to the query you provided.
    SET HEAD OFF FEED OFF ECHO OFF
    SET LIN 120 PAGES 0 TRIMS ON
    SPOOL c:\test.txt
    SELECT memberid || ',12' FROM abc;
    SPOOL OFF
    But,the spool query is still adding additional spaces making length of each line 43 characters in final text file output.

  • Include heading in text file

    Hi Experts,
    I need your HELP to include headings START_DATE, NUM_LOGS,MBYES,RSIZE in my text file "redo_history.log" below.
    05-3-2009,36, 3600,100
    05-4-2009,191, 19100,100
    05-5-2009,56, 5600,100
    06-1-2009,220, 22000,100
    06-2-2009,245, 24500,100
    06-3-2009,217, 21700,100
    My desired output text file (redo_history.log) should be on below:
    START_DATE, NUM_LOGS,MBYES,RSIZE
    05-3-2009,36, 3600,100
    05-4-2009,191, 19100,100
    05-5-2009,56, 5600,100
    06-1-2009,220, 22000,100
    06-2-2009,245, 24500,100
    06-3-2009,217, 21700,100
    Im executing the following script below to generate text file named redo_history.log:
    select dump_csv('SELECT Start_Date,
    Num_Logs,
    to_char(Round(Num_Logs * (Vl.Bytes / (1024 * 1024)),2),''999999999'') AS Mbytes,
    Vl.Bytes / (1024*1024) AS RSize
    FROM (SELECT To_Char(Vlh.First_Time,''MM-W-YYYY'') AS Start_Date,
    COUNT(Vlh.Thread#) Num_Logs
    FROM V$log_History Vlh
    WHERE Vlh.First_Time > current_date - interval ''30'' day
    GROUP BY To_Char(Vlh.First_Time,''MM-W-YYYY'')) log_hist,
    ( select distinct bytes from V$log ) Vl
    ORDER BY Log_Hist.Start_Date',',','EXT_TABLES','redo_history.log')
    from dual;
    Please find below dump_csv.sql:
    CREATE OR REPLACE function dump_csv( p_query in varchar2,
    p_separator in varchar2
    default ',',
    P_DIR in varchar2 ,
    p_filename in varchar2 )
    return number
    AUTHID CURRENT_USER
    is
    l_output utl_file.file_type;
    l_theCursor integer default dbms_sql.open_cursor;
    l_columnValue varchar2(2000);
    l_status integer;
    l_colCnt number default 0;
    l_separator varchar2(10) default '';
    l_cnt number default 0;
    begin
    l_output := utl_file.fopen( P_DIR, p_filename, 'w' );
    dbms_sql.parse( l_theCursor, p_query, dbms_sql.native );
    for i in 1 .. 255 loop
    begin
    dbms_sql.define_column( l_theCursor, i,
    l_columnValue, 2000 );
    l_colCnt := i;
    exception
    when others then
    if ( sqlcode = -1007 ) then exit;
    else
    raise;
    end if;
    end;
    end loop;
    dbms_sql.define_column( l_theCursor, 1, l_columnValue,
    2000 );
    l_status := dbms_sql.execute(l_theCursor);
    loop
    exit when ( dbms_sql.fetch_rows(l_theCursor) <= 0 );
    l_separator := '';
    for i in 1 .. l_colCnt loop
    dbms_sql.column_value( l_theCursor, i,
    l_columnValue );
    utl_file.put( l_output, l_separator ||
    l_columnValue );
    l_separator := p_separator;
    end loop;
    utl_file.new_line( l_output );
    l_cnt := l_cnt+1;
    end loop;
    dbms_sql.close_cursor(l_theCursor);
    utl_file.fclose( l_output );
    return l_cnt;
    end dump_csv;
    Thanks in advance for you HELP.
    Regards,
    Eddie

    ow005731 wrote:
    No, I am not asking how to know the column name.
    I am questioning why go through all the hassles to determine the column names, while they are already known.
    When the user prepares the query to pass on to dump_csv():
    SELECT Start_Date,
    Num_Logs,
    to_char(Round(Num_Logs * (Vl.Bytes / (1024 * 1024)),2),''999999999'') AS Mbytes,
    Vl.Bytes / (1024*1024) AS RSize
    FROM ...
    he obviously specifies/knows the column names. (It's not like he was doing select * ...)But what if he was doing select *? And why hard code column names for this query and then have to change them if the query changes when you can write it to be completely dynamic?
    CREATE OR REPLACE PROCEDURE run_query(p_sql IN VARCHAR2
                                         ,p_dir IN VARCHAR2
                                         ,p_header_file IN VARCHAR2
                                         ,p_data_file IN VARCHAR2 := NULL) IS
      v_finaltxt  VARCHAR2(4000);
      v_v_val     VARCHAR2(4000);
      v_n_val     NUMBER;
      v_d_val     DATE;
      v_ret       NUMBER;
      c           NUMBER;
      d           NUMBER;
      col_cnt     INTEGER;
      f           BOOLEAN;
      rec_tab     DBMS_SQL.DESC_TAB;
      col_num     NUMBER;
      v_fh        UTL_FILE.FILE_TYPE;
      v_samefile  BOOLEAN := (NVL(p_data_file,p_header_file) = p_header_file);
    BEGIN
      c := DBMS_SQL.OPEN_CURSOR;
      DBMS_SQL.PARSE(c, p_sql, DBMS_SQL.NATIVE);
      d := DBMS_SQL.EXECUTE(c);
      DBMS_SQL.DESCRIBE_COLUMNS(c, col_cnt, rec_tab);
      FOR j in 1..col_cnt
      LOOP
        CASE rec_tab(j).col_type
          WHEN 1 THEN DBMS_SQL.DEFINE_COLUMN(c,j,v_v_val,2000);
          WHEN 2 THEN DBMS_SQL.DEFINE_COLUMN(c,j,v_n_val);
          WHEN 12 THEN DBMS_SQL.DEFINE_COLUMN(c,j,v_d_val);
        ELSE
          DBMS_SQL.DEFINE_COLUMN(c,j,v_v_val,2000);
        END CASE;
      END LOOP;
      -- This part outputs the HEADER
      v_fh := UTL_FILE.FOPEN(upper(p_dir),p_header_file,'w',32767);
      FOR j in 1..col_cnt
      LOOP
        v_finaltxt := ltrim(v_finaltxt||','||lower(rec_tab(j).col_name),',');
      END LOOP;
      --  DBMS_OUTPUT.PUT_LINE(v_finaltxt);
      UTL_FILE.PUT_LINE(v_fh, v_finaltxt);
      IF NOT v_samefile THEN
        UTL_FILE.FCLOSE(v_fh);
      END IF;
      -- This part outputs the DATA
      IF NOT v_samefile THEN
        v_fh := UTL_FILE.FOPEN(upper(p_dir),p_data_file,'w',32767);
      END IF;
      LOOP
        v_ret := DBMS_SQL.FETCH_ROWS(c);
        EXIT WHEN v_ret = 0;
        v_finaltxt := NULL;
        FOR j in 1..col_cnt
        LOOP
          CASE rec_tab(j).col_type
            WHEN 1 THEN DBMS_SQL.COLUMN_VALUE(c,j,v_v_val);
                        v_finaltxt := ltrim(v_finaltxt||',"'||v_v_val||'"',',');
            WHEN 2 THEN DBMS_SQL.COLUMN_VALUE(c,j,v_n_val);
                        v_finaltxt := ltrim(v_finaltxt||','||v_n_val,',');
            WHEN 12 THEN DBMS_SQL.COLUMN_VALUE(c,j,v_d_val);
                        v_finaltxt := ltrim(v_finaltxt||','||to_char(v_d_val,'DD/MM/YYYY HH24:MI:SS'),',');
          ELSE
            v_finaltxt := ltrim(v_finaltxt||',"'||v_v_val||'"',',');
          END CASE;
        END LOOP;
      --  DBMS_OUTPUT.PUT_LINE(v_finaltxt);
        UTL_FILE.PUT_LINE(v_fh, v_finaltxt);
      END LOOP;
      UTL_FILE.FCLOSE(v_fh);
      DBMS_SQL.CLOSE_CURSOR(c);
    END;This allows for the header row and the data to be written to seperate files if required.
    e.g.
    SQL> exec run_query('select * from emp','TEST_DIR','output.txt');
    PL/SQL procedure successfully completed.Output.txt file contains:
    empno,ename,job,mgr,hiredate,sal,comm,deptno
    7369,"SMITH","CLERK",7902,17/12/1980 00:00:00,800,,20
    7499,"ALLEN","SALESMAN",7698,20/02/1981 00:00:00,1600,300,30
    7521,"WARD","SALESMAN",7698,22/02/1981 00:00:00,1250,500,30
    7566,"JONES","MANAGER",7839,02/04/1981 00:00:00,2975,,20
    7654,"MARTIN","SALESMAN",7698,28/09/1981 00:00:00,1250,1400,30
    7698,"BLAKE","MANAGER",7839,01/05/1981 00:00:00,2850,,30
    7782,"CLARK","MANAGER",7839,09/06/1981 00:00:00,2450,,10
    7788,"SCOTT","ANALYST",7566,19/04/1987 00:00:00,3000,,20
    7839,"KING","PRESIDENT",,17/11/1981 00:00:00,5000,,10
    7844,"TURNER","SALESMAN",7698,08/09/1981 00:00:00,1500,0,30
    7876,"ADAMS","CLERK",7788,23/05/1987 00:00:00,1100,,20
    7900,"JAMES","CLERK",7698,03/12/1981 00:00:00,950,,30
    7902,"FORD","ANALYST",7566,03/12/1981 00:00:00,3000,,20
    7934,"MILLER","CLERK",7782,23/01/1982 00:00:00,1300,,10

  • Adding large arrays to a text file as new columns

    I am trying to merge several large text data files into a single file in Labview 8.0.  The files are too large to read in all at once (9-15 million lines each), so decided I need to read them in as smaller chunks, combine the arrays, and write them to a new file.
    The reason there are three separate data files was for speed and streaming purposes in the project, and the users wanted the raw, unadulterated data written to file before any kind of manipulation took place. 
    My VI:
    1.  Takes a header generated from another VI and writes it to the output file.
    2.  Creates a time column based on sample rate and the total number of data points
    3.  Reads in 3 files that each have text data (each data point is 9 bytes wide, there are up to 15 million data points per file.
    4.  Each iteration of the for loop writes a chunk of 10 to 100 thousand points (Somewhere in there seems to be the fastest it will do), formatted with the time column on the left, then the three data columns, until it's done.  I haven't quite figured out how to write the last iteration if there are fewer data points than the chunk size.
    Anyways, the main thing I was looking for was suggestions on how to do this faster.  It takes about a minute per million points on my laptop to do this operation, and though I recognize it is a lot of data to be moving around, this speed is painfully slow.  Any ideas?
    Attachments:
    Merge Fast Data.vi ‏67 KB

    Thanks for the tip.  I put the constants outside the array and noticed a little improvement in the speed.  I know I could improve the speed by using the binary file VI's but I need the files as tab delimited text files to import them into MATLAB for another group to do analysis.  I have not had any luck converting binary files into text files.  Is there an easy way to do that?  I don't know enough about binary file systems to use them.  I looked at the high speed data logger examples but they seemed complicated and hard to adapt to what I need to do.  Creating the binary header file seemed like a chore. 
    I am up for more advice on the VI I posted, or suggestions on different ways to convert a binary file to a MATLAB readable text file.
    Thanks!

  • Is it possible to import a Fixed Text file that does not have a header?

    I'm trying to import a Fixed Text file through Import Manager, but the text file I am receiving does not have a header on it (the first row is valid data). When I try importing this, Import Manager uses the first row of data as the headings. Is there any way to turn this off and tell Import Manager there is no header data in the file?
    Thanks!

    Hi Ryan ,ur requirement can be met only when u import the file as ODBC .for this follow the below steps.
    1)Go to control panel,in ur settings,select administrative tools
    2) In that select DATA SOURCE(ODBC ).
    3)Go to SYSTEM DSN tab select tab .
    4)Select ur file type MICROSOFT TEST DRIVER (.txt,.csv)
    5)Double click on "Import DSN" and in the blank give the name of DATA SOURCE NAME any name u want to give.
    6)Uncheck the use current directory box and select the directory ur file is it will automatically show ur source file select it and click ok.
    7) Now when u import ur file as ODBC give the name of ur DATA source name which u have given and it will show ur file in the source preview itself .
    In  this way u can import ur file as ODBC.
    Hope this may help u.
    Regards
    Ankit

  • Add header line to the text file in receiver file adapter

    Hello Experts,
    I have to add a new line to the text file generated at the receiver end.
    My structure is
    Record
       Item......0-unbounded
             field1
             field2
             field3
    I have defined below parameters in receiver FCC.
    RecordSet Structure : Record,Item
    Item.fieldSeparator : ;
    Record.fieldSeparator : nl
    Record.endSeparator : '0x0D''0x0A' ( this is to get a carriage return at the end of the file)
    Item.addHeaderLine : 1
    With the above configuration, i am getting the desired output with NO header line.
    Please help.
    Thanks,
    Swetha.

    Hi, it looks like that the headerline "specification is only permitted if exactly one structure is defined." Please check [SAP help under Define Parameters for Recordset Structures|http://help.sap.com/saphelp_nw73/helpdata/en/44/686e687f2a6d12e10000000a1553f6/frameset.htm].
    One solution would be to generate the header fields in the message payload. Generate an additional first line containing the header names, e.g.
    <Item>
    <field1>Header1
    <field2>Header2
    <field3>Header3

  • Adding text to a text file problem

    I have used an Apple script to create a text file and I am having problems with it
    First the script creates a file containing text, as a example "ABCDE" then I enter test to the file, say "12345" and the file now has "ABCDE12345". At this point I run my Apple Script to add more data to the file, in this case "FGHIJ".
    The problem I am having is the file does not contain "ABCDE12345FGHIJ" as I expect, but instead has "ABCDEFGHIJ" because the EOF was not updated when I added "12345".
    I typed the additional text into the text window and saved it to the disk and even closed the window, quit TextEdit and reloaded the file but the results were "ABCDEFGHIJ" and not "ABCDE12345FGHIJ"

    At this point I think you should get Applejack...
    http://www.versiontracker.com/dyn/moreinfo/macosx/19596
    http://www.macupdate.com/info.php/id/15667
    After installing, Reboot holding down CMD+s, (+s), then when the DOS like prompt shows, type in...
    applejack AUTO
    Then let it do all 5 of it's things.
    The 6 things it does are...
    Correct any Disk problems.
    Repair Permissions.
    Clear out Cache Files.
    Repair/check several plist files.
    Dump the VM files for a fresh start.
    Delete old Log files.

  • Header in text file.

    Hi expert,
    wn i m downloading a text file into presentation server , hw can i add header there for heading of the particular fieds which is showing in file.plz suggest.
    thanx and regards...
    sunil.

    hello,
    you can try doing as mentioned above
    however, in some cases, the datatype of the internal table may not allow you to entire the text header string that you need
    in such cases you can use this method
    what i have done here, is to make a simple internal table with text values to insert the text
    i used that table with the FM first
    then i called the function module again and passed the data
    in the second call, i set the append parameter to 'X'.
    types: begin of header_type,
      field1(20),
      field2(20),
      field3(20),
    end of header_type.
    data: it_header type header_type occurs 0 with header line.
    it_header-field1 = 'field_1'.
    it_header-field2 = 'field_2'.
    it_header-field3 = 'field_3'.
    append it_header.
    CALL FUNCTION 'GUI_DOWNLOAD'
      EXPORTING
        filename              = 'c:\test_xls.xls'
        filetype              = 'ASC'
        write_field_separator = 'X'
        DAT_MODE              = 'X'
        TRUNC_TRAILING_BLANKS = 'X'
      TABLES
        data_tab              = it_header.
    CALL FUNCTION 'GUI_DOWNLOAD'
      EXPORTING
        filename              = 'c:\test_xls.xls'
        filetype              = 'ASC'
        append                = 'X'
        write_field_separator = 'X'
        DAT_MODE              = 'X'
        TRUNC_TRAILING_BLANKS = 'X'
      TABLES
        data_tab              = itab.

Maybe you are looking for