Spool file format

Hi,
I am trying to come up with a clean consistent spool file format. Right now when I set linesize in sqplus to 9999, the rows in my spool file are printed far apart. so for a small query result I end getting a long file. The linesize is what I want for sqlplus but not spooling. Anyone have settings that would fix this?
Thanks.

set trimspool on
should trunc the lines on the last non blank character.
Nicolas.

Similar Messages

  • Changing the file format of spool output when scheduling a background job.

    Hello Experts,
    I have an issue. It is related to Spool output format. I created a job for one report program for which the output is a list output. I have added one recipient in the 'Spool list recipient' while creating the job SM36. After the job is finished the spool output is sent to the recipient mail id as .htm format as an attachment. But the attachment should be excel sheet or text file. No coding in the program should be used to convert the file format. Only settings in the spool while creating job should be manipulated. Please help me in solving this issue.
    Regards.

    Hi Sunil,
    You can use the logic for converting spool to PDF using program : RSTXPDFT4 . Alternatively you can use FM: CONVERT_ABAPSPOOLJOB_2_PDF . In this FM you need to pass the Spool id .
    u can make use of these FM's SO_DOCUMENT_SEND_API1
    SO_NEW_DOCUMENT_SEND_API1
    Check out the following wiki:
    https://wiki.sdn.sap.com/wiki/display/Snippets/ConvertsspoolrequestintoPDFdocumentand+emails
    hope this will use full to you.
    Thanks!!

  • Seek help to format spool file from SQL*PLUS

    I am running a Unix shell script to call a Oracle 11g SQL script from a Oracle database. In this SQL script, I need to connect to many different remote databases to select data, then sool these records as one big text file to a directory. Then email the file to related Group users. In the spool file, there is a line on the top of each page like this:
    DUMMY
    DB_NAME
    I know this is caused by connect to remote database in SQL*PLUS. My connection string is like this:
    Conn system/password@Oracle_SID
    How can I remove these lines or how to skip these lines into spool file? Please advise. Thanks in advnce. Wish all of you Happy New Year!!!

    Hi,
    It sounds like you have some kind of formatting (such as SQL*Plus TTITLE) producing the output you don't want. If that's the case, temporarily stopping the spooling might not help you. Find out what is causing the output that you don't want. You say that you know it is caused by the CONNECT statements, but it must be more than that. I've written scripts with CONNECT statements that don't have anything like what you reported at the top of each page; in fact, they don't even have pages: the output is one continuous stream. Find out what's putting the unwanted output there, and that will be a big clue as to how you can stop it.
    You say that you know the unwanted titles are there because of the CONNECT statements. If so, use database links instead of CONNECT. You don't have to use dbms_scheduler or utl_file; just eliminate the CONNECT statements. (I'm not saying that there's anything wrong with dbms_scheduler or utl_file; you should definitely investigate those tools. I'm just saying that using database links is independent of them.)
    What would happen if you did all your connecting to different databases at the OS level? Can you write a shell script that connects to each database in turn, and runs a SQL*Plus script in each one. Each SQL*Plus script would have a SPOOL or SPOOL ... APPEND command, or maybe you could build the SPOOL into a LOGIN.SQL script.

  • What file format Oracle Database 11g can spool data w chinese characters?

    Hi,
    I have a batch job that spools data into a text file for further processing but now I have data that contains chinese characters.
    From what I know text file (.txt) cannot support chinese characters.
    Anyone has any idea what file format Oracle Database 11g can spool data with chinese characters?
    Thank you!
    Regards,
    Fel

    I'm not sure this can work with SQL*Plus in character mode on Windows DOS mode. But this should work with SQL Developer: see Re: How to display Chinese characters in Oracle?
    I can also make this work with Linux:
    $ locale
    LANG=fr_FR.UTF-8
    LC_CTYPE="fr_FR.UTF-8"
    LC_NUMERIC="fr_FR.UTF-8"
    LC_TIME="fr_FR.UTF-8"
    LC_COLLATE="fr_FR.UTF-8"
    LC_MONETARY="fr_FR.UTF-8"
    LC_MESSAGES="fr_FR.UTF-8"
    LC_PAPER="fr_FR.UTF-8"
    LC_NAME="fr_FR.UTF-8"
    LC_ADDRESS="fr_FR.UTF-8"
    LC_TELEPHONE="fr_FR.UTF-8"
    LC_MEASUREMENT="fr_FR.UTF-8"
    LC_IDENTIFICATION="fr_FR.UTF-8"
    LC_ALL=
    $ cat chinese.sql
    cat tchinese.sql
    set echo on
    spool tchinese.log
    select * from v$version;
    select unistr('\8349') from dual;
    exit
    $ cat tchinese.log
    SQL> select * from v$version;
    BANNER                                                                         
    Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Prod               
    PL/SQL Release 10.2.0.1.0 - Production                                         
    CORE     10.2.0.1.0     Production                                                     
    TNS for Linux: Version 10.2.0.1.0 - Production                                 
    NLSRTL Version 10.2.0.1.0 - Production                                         
    SQL> select unistr('\8349') from dual;
    UNIS                                                                           
    草                                                                              Edited by: P. Forstmann on May 27, 2009 10:30 AM
    Edited by: P. Forstmann on May 27, 2009 10:33 AM

  • Spool file required in txt format

    Hi
    am logging into sql using script.
    sqlplus ima/ima@test <<!
    spool /opt/tt/spoolfile.txt
    @sql.sql
    spool off.
    now i am getting a spool file named spoolfile.txt.lst
    i want it to be only spoolfile.txt
    I am working on solaris
    uname -a
    SunOS massena 5.9 Generic_117171-12 sun4u sparc SUNW,Sun-Fire-V240
    oracle 9.2
    Please Help

    If you are doing on Solaris then why don't you do this way :
    Create a shell script say spool.sh
    SPOOLFILE_NAME=/opt/tt/spoolfile.txt
    sqlplus ima/ima@test @sql.sql > $SPOOLFILE_NAME
    Here in the sql.sql file you can have spool off and exit command at the end. So you will have .txt file as you want.

  • Can I download a spool file from ALV payroll recon report in Fixed Ascii?

    We have a process that imports the spool files from our various nightly payroll recon reports but have recently upgraded to ECC 6.0 and the ALV formatted report does not appear to create a fixed format spool file - the width of the columns changes from spool to spool based on the contents.
    Does anyone know how to accomplish our need?
    Thanks,
    DeWayne

    Does the printer show up in the Windows Printers folder?  We've used PDF995 or Cute pdfwriter for years.  All of these create virtual windows printers.  When you print to them, a dialog box pops up asking for the filename for the pdf.  If you have Activex calls to Excel in order to open a file, you should be able to make ActiveX calls to print it to a print driver such as this.  I don't know if any of these drives have a way to bypass the filename dialog box.  That may take some research and experimentation.  I don't know where the postscript file comes into play in the scenario you are describing.

  • Need Spool file 255 characters for background HR Reports into Excel

    We have been looking for a solution for problem this for more than 2 years now.
    Problem:
    1.     Requirement is to run large HR reports – either standard or with Ad Hoc Query in background mode in a company with more than 50,000 employees.
    2.     Nobody wants printed reports these days.  We want to save the forests. Customers prefer to be emailed an Excel file so they can do further data analysis, filtering, pivot tables etc.
    3.     Reports are running OK in foreground for smaller sections of the organisation, where you send the output to Excel from ALV, or save as a local file in spreadsheet format.
    4.     But large reports for entire company are awkward, tie up your PCs resources, and complex reports accessing many tables can timeout before completion.
    5.     So scheduling these reports to run in background would be the ideal solution.
    6.     However when we access the report output from SP02, we find that most reports (say with more than 13 or so fields) have an output wider than 255 characters and the output of the spool file wraps to the next line in Excel.  It is very tricky to then parse the data back into one row for each employee.  And you have a problem if you output is for 50,000 or so employees, because then you file is 100,000 rows and will not load completely into Excel – limit problem of 65,536 characters.
    7.     We simply want a spool file that does not wrap the data to the next line after 255 characters.
    8.     But how to explain this simple requirement to some technical people. It seems a lot of posts on SDN think we always want to print a spool file.  NO – remember the forests!
    Possible Solutions:
    I see a lot of posts here that refer to OSS note 186603, but they don’t mention the target for the output of the spool is to import into an Excel File (i.e. spreadsheet format).  Just search for 186603 or ” Spool request with more than 255 columns”.  There is also a reference to OSS note 313566.  I am not sure if these will work?
    I have also seen the suggestions that you need to define a customer printer format that does not wrap the output after 255 characters (create a new format type in transaction SPAD).
    Can anyone help us!
    John McKee

    Hi,
    Can you please check whether you can use:
    CONSTANTS C_LF TYPE X VALUE '0A'.
    CONSTANTS C_CR TYPE X VALUE '0D'.
    Regards,
    Lakshmi.

  • Prevent Occurence of list header and page breaks in spool file of ALV Grid

    Prevent Occurence of list header and page breaks in spool file of ALV Grid  Display.
    When we run the ALV in background and create spool request then:
    Spool file output is coming like this.
    Column1 Column2 Column3 Column4
    data        data        data       data
    data        data        data       data
    data        data        data       data
    Column1 Column2 Column3 Column4
    data        data        data       data
    data        data        data       data
    data        data        data       data
    But the required is like this
    Column1 Column2 Column3 Column4
    data        data        data       data
    data        data        data       data
    data        data        data       data
    data        data        data       data
    data        data        data       data
    data        data        data       data
    Please suggest a posible answer

    Hello all,
    if you have not yet solved this on your own, here is my solution: use a format type that has 60000 lines per page for your spool output device.
    It all depends on the format type that was used for creating the spool output.
    By default (in our system), we have 65 lines per page. And after each page the column headings of the ALV will appear.
    What i did:
    create a new format type via transaction SPAD->full administration->device types->format types (copy an existing one)
    change"Number of Rows" to 60000 or something applicable
    edit the device type of your output device (e.g. LOCL) to contain the newly created format type (via SPAD; Button "Formats" in device type maintenance).
    That's it! Be sure to use this format type for your output device in the "Background Print Parameters" window (-> Button "Properties").
    Regards
    Daniel Klein
    All other parameters you discussed before didn't do it. All ALV-Settings will be overwritten by the output device settings and its print properties.

  • Creating a spool file with date/time appended to file name

    In Oracle Sql*Plus, I want to spool out a file, with the date-time stamp as part of the file name. Any idea how to do this?
    Here's what I have right now:
    SQL>
    set serveroutput on size 200000;
    rem
    rem $OFSA is a UNIX alias so sql plus is talking to UNIX
    rem
    spool $OFSA/logs/OFSAP/common_coa_id.log;
    prompt 'Enter date in mmddyyyy format, without quotes';
    exec upd_common_coa_id_driver ('&date_mmddyyyy');
    spool off;
    As an example, I'd like to have a file with this name: common_coa_id083002.log
    Thanks.

    In SQL*Plus this is what you can do to get the current date/time as part of the spool file:
    ============================================================================================
    SQL> column tm new_value file_time noprint
    SQL> select to_char(sysdate, 'YYYYMMDD') tm from dual ;
    1 row selected.
    SQL> prompt &file_time
    20020816
    SQL> spool C:\Temp\logfile_id&file_time..log
    . /* put your code here */
    . /* it will go to a file called C:\Temp\logfile_id20020816.log */
    SQL> spool off
    SQL>

  • Spool file of a background job

    Hello Friends,
    In an SAP system, there is a background job which creates a spool file.
    If there is no printer configuration done on the SAP server, how to find the location of this file in the filesystem?
    Thanks & Regards,
    Kunal Patel.

    Hi,
    Thanks for your reply.
    I was able to locate the file in the filesystem.
    Actually I changed a setting in the printer LOCL so that the spool is stored in Global directory.
    But now there is a new problem.
    The spool file in the filesystem is in a very different format as below:
    Could you let me know how to change the format of the spool?
    Command executed:       more : /usr/sap/DHS/SYS/global/100SPOOL/00010000026674 :
    Target host:            unix0006
    COL0N COL0H05.03.2008
    4 4 4 9 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4
    4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4
    5
    5      5Lene
    5      5Gitte
    5      5Orla Bech
    5      5Janni                                    5We
    4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 3 -  P                                              COL0N COL0H05.03.2008
    4 4 4 4 4 4 4 4 4 4 4 4 4 4 9 4 4 4 4 4 4 4 4 9 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 9 4 4 4 4 4 4 4 4 4 4 9 4 4 4 4 4 4 4 4 4 4 4 4
    4 4 4 4 4 4 9 4 4 4 4 4 4 4 4 9 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 9 4 4 4 4 4 4 4 4 4 4 9 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4
    5 ú    5
    5 ú    5
    5 ú    5
    Rgds,
    Kunal.

  • Spool file Wrapping issue

    Hello experts,
    I have an issue with the output of a report.  If I run the program on line, the output is okay.  If run in background, the output is sent to the spool file.  The problem is when view the report in spool file, the report column wrap around.  This report has 9 columns.  Let's say the first column is the account number and the last column is the zipcode.  When I run the report on-line, I see all 9 columns of data displayed correctly.  When view the same report in spool file, zipcode is written over field account number instead of at the end of the line.  Is there away to fix this?  Please advise.
    Thanks,
    HN

    u  have to change Print format when u are running it in BG.
    select print format type like 65*255.
    ask ur basis person for more details.
    Regards
    Prabhu

  • How to increase spool file width?

    Hi,
    I've a spool file with lot of columns. When I display it (in graphical format) through SM37, the columns appear in two rows and thus it becomes difficult to understand the data.
    How can I increase the width so that all columns appear in a single row?
    Regards,
    Vikrant.

    Hi,
    I suppose that the report you executed to have this list is a cutom report.
    If it's the case you will have to add the following extra statement (in bold) in your report to define the number of columns during output
    REPORT ZREPNAME LINE-SIZE 132.
    ... LINE-SIZE col
    Creates a report with col columns per line.
    If the LINE-SIZE specification is missing, the line length corresponds to the current screen width. The system field SY-LINSZ contains the current line size for generating lists. The maximum width of a list is 1023 characters. You should keep lists to the minimum possible size to improve useability and performance (recommendation: LINE-SIZE < 132). For very wide lists (LINE-SIZE > 255), you should consult the notes for using LINE-SIZE
    Hope that the following info will help you
    Regards

  • Spool file, column width question

    I'm a new user, and just converted to Oracle 9 from Informix.
    I am trying to create a (comma delimited) spool file, but the
    column width for some of the numbers that I'm pulling in my
    queries are very wide. For example, if my query is pulling
    first, last, account#, and cust#, the spool output is as such:
    JOHN , SMITH ,
    10203 , 4987
    I realize I can use 'COL name FOR an' to adjust the width of the
    text columns, but how can I make the width of the number columns
    only 5 or 6 digits wide?
    Help!

    Peter,
    If you just want a comma separated value file without formatted columns and you want to eliminate all spaces, then just trim all your values and concatenate them together. See the example below.
    Barbara
    SQL> -- test table:
    SQL> CREATE TABLE mrs_record_load_errors
      2    (DF_ID                 NUMBER   (10)   NOT NULL,
      3     RECORD_NUMBER         NUMBER   (10)   NOT NULL,
      4     DF_ID_REJECT          NUMBER   (10),
      5     METER_POINT_REFERENCE NUMBER   (10),
      6     ERROR_CODE            VARCHAR2 (8),
      7     ERROR_TEXT            VARCHAR2 (200),
      8     RECORD_IMAGE          VARCHAR2 (2000),
      9     PROBLEM               CHAR     (1),
    10     DF_ID_OUT             NUMBER   (10),
    11     FIELD_NUMBER          NUMBER   (10),
    12     RECORD_STATUS         VARCHAR2 (1),
    13     CLIENT_REFERENCE      VARCHAR2 (30),
    14     TRANS_TYPE            VARCHAR2 (3))
    15  /
    Table created.
    SQL> -- test data:
    SQL> INSERT INTO mrs_record_load_errors
      2  VALUES
      3    (245399, 2, 3, 4, 'A', 'B', 'C', 'D', 5, 6, 'E', 'F', 'G')
      4  /
    1 row created.
    SQL> -- test:
    SQL> SET HEADING OFF
    SQL> SELECT '"'
      2         || TO_CHAR (df_id)
      3         || ','
      4         || record_number
      5         || ','
      6         || df_id_reject
      7         || ','
      8         || meter_point_reference
      9         || ','
    10         || LTRIM (RTRIM (error_code))
    11         || ','
    12         || LTRIM (RTRIM (error_text))
    13         || ','
    14         || LTRIM (RTRIM (record_image))
    15         || ','
    16         || problem
    17         || ','
    18         || df_id_out
    19         || ','
    20         || field_number
    21         || ','
    22         || record_status
    23         || ','
    24         || LTRIM (RTRIM (client_reference))
    25         || ','
    26         || LTRIM (RTRIM (trans_type))
    27         || '"'
    28  FROM   mrs_record_load_errors
    29  /
    "245399,2,3,4,A,B,C,D,5,6,E,F,G"

  • Oracle Spool File

    Hi All,
    I am new to this SPOOLING of oracle Sql data to a file.I am in need of formatting a file.That format looks like...
    Date: 05/17/2006 SOI DIFFERENCE REPORT Page 1
    Latest SOI File Generated : 1:01AM ON 2006/05/18
    CUSIP DESC SYMBOL
    table data
    Can any one help in formatting this spool file.
    [email protected]

    Perhaps the linesize is too short?

  • Output to spool file only

    Hi,
    I don't want the output of the spool file to be written to a log file while executing the script. My script looks like this,
    #/bin/ksh
    sqlplus test/test 1>>/test/abc.log 2>>/test/abc.log <<EOF
    set termout off
    set feedback off
    set flush off
    spool /test/test.dat
    select 'a' || 'b'|| 'c' from dual;
    spool off
    disconnect;
    exit;
    EOF!
    I want the output to be written only into the spooled file. now it writes to both the log file and spool file. how can i avoid it from writting to the log file(1>>/test/abc.log). pl help

    Actually. Why do you want to write to both anyway?
    You are using the general unix format to write to a file so why do you need another file?

Maybe you are looking for

  • Want to create RFC FM for Getting data in CRM from R/3

    Hi, I have made the RFC connection in CRM system , now I want to make RFC FM for getting data from R/3 'MARD' table into CRM, If any one help me how to do this. From CRM system I will pass Plant & material no to FM and I need Storage location & Stora

  • Number Art in Illustrator

    Just a post to share the one of many pieces I created using Illustrator - a must have software for creating art to hang around the house. http://www.facebook.com/artbylama Frank

  • View link trouble

    I have a couple of tables as below: CREATE TABLE year ( year NUMBER); CREATE TABLE policy( year NUMBER, CONSTRAINT policy_year_fk FOREIGN KEY (year) REFERENCES year, I created business components from these tables. While dealing with a PolicyViewRow,

  • Can't send pictures with my tour? No MMS option, how do I get around this!

    I can't stand that I can't send a picture message, I dont understand why this phone would only have the option to email a picture. I want to be able to text a picture, even the oldest of phones have this option.. disliking telus for this one! So is t

  • How to convert QTVR or 3D Flash files to DAE for IBA?

    Does anyone know a way to convert existing QTVR or 3D flash files to DAE format? We are hoping to add interactive 3D content into our books. Thanks!