Adding field names to spool file?

I'd love to add the field names and "AS" labels as a header row to a spool file...here's a few lines from the spool script:
--SET heading on
--SET echo off
--SET space 0
SET trimspool on
set feedback off
set termout off
set heading off
set pagesize 0
set linesize 2000
SPOOL C:\spools\Prod\files\test\profile_2003.txt
SELECT
a.ZIP
||'|'||a.STATE
||'|'||a.COUNTY
||'|'||a.ZIPNAME
||'|'||a.STATENAME
||'|'||a.COUNTYNAME
||'|'||a.POPCY
||'|'||a.SEXCYMAL-- AS POPMALE
||'|'||a.SEXCYFEM-- AS POPFEMALE
||'|'||a.AGECYMED-- AS MEDIANAGE
something to do with the SET parameters perhaps?
this will be a huge help to me if someone can point me in the right direction...
Thanks!
- Pete

Try:
SPOOL C:\spools\Prod\files\test\profile_2003.txt
SELECT
     'ZIP'           ||'|'||
     'STATE'               ||'|'||
     'COUNTY'               ||'|'||
     'ZIPNAME'      ||'|'||
     'STATENAME'      ||'|'||
     'COUNTYNAME'      ||'|'||
     'POPCY'               ||'|'||
     'POPMALE'              ||'|'||
     'POPFEMALE'     ||'|'||
     'MEDIANAGE'
FROM
     dual
SELECT
     a.ZIP           ||'|'||
     a.STATE               ||'|'||
     a.COUNTY               ||'|'||
     a.ZIPNAME      ||'|'||
     a.STATENAME      ||'|'||
     a.COUNTYNAME      ||'|'||
     a.POPCY               ||'|'||
     a.SEXCYMAL     ||'|'||
     a.SEXCYFEM     ||'|'||
     a.AGECYMED
FROM
     your_table a
SPOOL OFF     

Similar Messages

  • How to give field name to Receiver File Name.

    Hi ,
    In my source target structure there is a field name
    "job id" .
    I need that value coming in that field name to be given to
    Receiver File Name.
    Thanks in Advance

    Hi,
    You could use the field name to the File Name. For that you could go ahead with variable substituiton in receiver communication channel.
    In receiver Communication channel use variable substitution as
    In file name -- %Var1%
    In Variable substitution parameter give Var1 ---> payload:<field Name>
    Refer
    SAP Network Blog: An interesting usage of Variable Substitution in XI
    /people/sameer.shadab/blog/2005/09/23/an-interesting-usage-of-variable-substitution-in-xi
    variable substitution
    http://help.sap.com/saphelp_nw2004s/helpdata/en/8e/464442c1a1c253e10000000a1550b0/content.htm
    Also see the below links to use the dynamic variable substitution
    /people/michal.krawczyk2/blog/2005/03/29/xi-error--unable-to-convert-the-sender-service-to-an-ale-logical-system
    /people/michal.krawczyk2/blog/2005/11/10/xi-the-same-filename-from-a-sender-to-a-receiver-file-adapter--sp14
    Also
    /people/jayakrishnan.nair/blog/2005/06/20/dynamic-file-name-using-xi-30-sp12-part--i - Dynamic File Name Part 1
    /people/jayakrishnan.nair/blog/2005/06/28/dynamic-file-namexslt-mapping-with-java-enhancement-using-xi-30-sp12-part-ii - Dynamic File Name Part 2
    Thanks
    swarup

  • Unable to get Field Names from Archived File

    Hi All,
    We have a ECC 6 Ehp4 system. When i retrieve Idocs archived using SARA, the data only contains application data. There is no field names available - eg: posting date, tax code etc. Please find below the background on this issue.
    I configured archiving of process idocs (status 52,12,03) from EDIDC tables. I set up the settings for Archive Object IDOC and archived the data for 15 days.
    Both archiving and deletion of data from the table was successful.
    I tried reading the Idoc data from Archive File using the Information System option -> Info structure (available as default for Idoc).
    But the data retrieved only shows the Application data for all the segments of the IDoc. The fields for the segments like Tax Code, Posting Date etc are not available in the data. Functional teams will not be able to make sense with just the application data.
    Am I missing some setting? Is there any way to retrieve the related field values also ?
    Please help.
    Thanks and Regards,
    Raghavan

    Hi All,
    There is tcode WE10. You could choose if the data source is archive and also the archive session. You will get the list of segments provided. click on the segment number and you will get the data.
    Thanks and Regards,
    Raghavan

  • Adding column names to data file

    Hi,
    I have a question regarding writing to file. Currently in my program, when I start running it, a dialog box pops up and the user gets to pick/ create a file. My data is written on to a file as columns. I want to add column names to the file. Any suggestions on how to do it? Since the file is created by the user at run time and since the column names have to be added just once at the beginning, I'm not sure how to go about doing this. Any suggestions or pointers?
    Thanks,
    Sukanya

    dear sir
    i wanted to ask you help. i saw your program bt i am having a big problem
    here is my VI. i actually have to do a database where there is the name of the student,
    date of equipment of borrowal. time of the equiment when it was borrowed and its date
    but when am doing this. each time i always have to create a new file each time.
    i cant use the only onw file.
    and also my 2nd problem is that when the output is being yielded, it is repeatedly
    givine me the same output twice, thrice and a lot like in the pic below
    help please
    Attachments:
    1we.JPG ‏84 KB
    doom..JPG ‏44 KB

  • Output a varchar2 field to a spool file.

    I have a varchar2 field in the database which has returns in it. So it has 3 lines of output. When I spool this to s file, that record spans across 3 lines as opposed to 1 line/record.
    I tried using replace(field,'^M','') to get the output but that gives me only the first line of the field.......
    ANY IDEAS ?????

    Have you checked the width of varchar2 data type.else modify it to long and try it.

  • Reg: Adding field names in table control

    Hi
    I am new to table control ,instead of going with table control wizard i am proceeding with table control.
    I have added all the fields as per my requirement, i have added like matnr ,maktx. above these fields i would like to add material and material description..
    can any one suggest me a way to add those fileds.
    And my requirement is i need to display my contents in the internal table..
    if any got sample coding plz do send me.
    Thanks and regards
    Arun Joseph

    Hi Arun joseph,
      In SE51 -> Layout, Press Input/Output button and put it at the end of all your columns in your table control and give variable name ( for example fs_tablecontrol-extrafield ) and press Text Field button and put it in the place of heading give text and save it activate it.
    In your program add the field in data declaration and do furthor logic for that extra field/fields.
    Note: you can add the both fields like this only.
    Regards,
    Mahi.

  • 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

  • FCC configuration in Sender File Channel Without any key field name

    Hi Everyone,
    We have below flat file generated from ECC using standard tcode.
    The flat file is fixed length file and first record is header record followed by line items.
    There is no key field name in the file name.
    Can we read the file and convert into xml without any key field name?
    I want to understand if the FCC configuration for above file can be done without key name or not.
    Thanks,
    Vertika

    Hello,
    AFAIK, using FCC i really doubt u can convert file into xml.
    So technically, there are two options either read each line one by one and then do conversions in ur mapping or write a custom module which will read ur input file and convert into xml.
    Configuring Generic Sender File CC Adapter
    Thanks
    Amit Srivastava

  • Not able to download the field names in GUI_DOWNLOAD(very urgent)

    Hi All,
    I am downloading the file contents to the presentation server.i am able to get the file contents proeprly but not able to download the field names into text file.
    Can anybody please help me in this issue..? its very urgent. Valuable answers will be rewarded.
    CALL FUNCTION 'GUI_DOWNLOAD'
        EXPORTING
          filename                = w_filename
          filetype                = 'DAT'
         write_field_seperator   = c_x
          col_select              = c_x
          COL_SELECT_MASK         = t_mask
        TABLES
          data_tab                = t_tab
          fieldnames              = t_colnames
        EXCEPTIONS
    Thanks & Regards,
    Satish.

    Hi,
    I have tried in both ways its not working.
    while a ran the program it is going to the dump.
    I am working in mySAP ECC6.0
    Can pl you suggest other way..
    Thanks & Regards,
    Satish.

  • Spool non english character names to a file

    Hi There,
    We have a table which has around a million rows. We just need to select two columns(out of which one is a name field with english and non english names) and spool the data to a file. The problem is that through sqldeveloper, if I choose csv or dsv option, the non english names, like chines charaters etc show up as question marks. Is there a better way or format to do this. I tries xls. But although it goes through successfully, when I open the excel file, it has nothing. I was able to do it for around 200000 rows in excel.
    Any suggesstions?
    Thanks,
    Sun
    Edited by: ryansun on Jun 23, 2012 4:24 AM

    ryansun wrote:
    Hi There,
    We have a table which has around a million rows. We just need to select two columns(out of which one is a name field with english and non english names) and spool the data to a file. The problem is that through sqldeveloper, if I choose csv or dsv option, the non english names, like chines charaters etc show up as question marks. Is there a better way or format to do this. I tries xls. But although it goes through successfully, when I open the excel file, it has nothing. I was able to do it for around 200000 rows in excel.
    Any suggesstions?
    Thanks,
    Sun
    Edited by: ryansun on Jun 23, 2012 4:24 AMwhen dealing with non-ASCII characters, two different issues can exist,
    1) data storage - incorrect byte value is stored
    2) data presentation - incorrect character is displayed.
    Can the utility utilized to view the *CSV file actually display the non-ASCII value properly?
    can you inspect the *CSV file using an hexadecimal editor? what do you see inside the file?                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • This field name is not known. for newly added fields

    dear sir,
    i ma using VS 2008 with CR.NET. There are previously dsigned reports. when I add some new Fields to the report, it prompts the error message
    [COMException (0x80041019): This field name is not known.
    Error in File C:\DOCUME1\TERESA1\ASPNET\LOCALS~1\Temp\PolicyReceipt {F0958318-C3D3-493D-9140-4CEA08B27B98}.rpt:
    Error in formula  <Address>.
    '{GetTransactionsForPolicyReceipt;1.ClientAddress_zh}+{GetTransactionsForPolicyReceipt;1.Address_zh_2}'
    This field name is not known.]
       CrystalDecisions.ReportAppServer.Controllers.ReportSourceClass.Export(ExportOptions pExportOptions, RequestContext pRequestContext) +0
       CrystalDecisions.ReportSource.EromReportSourceBase.ExportToStream(ExportRequestContext reqContext) +240
    here is the stored procedure
    select Transactions.TransactionID
                 , Transactions.PolicyDate
                 , Transactions.PolicyNumber
                 , ClientBranch.BranchName as ClientBranchName
                 , c.last_name + ', ' + c.other_name as ClientName
                 , c.last_name_zh + c.other_name_zh as ClientName_zh
                 , c.last_name as ClientLastName
                 , c.address as ClientAddress
                 , c.Address_2
                 , c.Address_3
                 , c.Address_4
                 , c.address_zh as ClientAddress_zh
                 , c.Address_zh_2
                 , c.Address_zh_3
                 , c.Address_zh_4
                 , c.email as ClientEmail
                 , c.[language]
                 , Gender.ShowName as ClientGenderName
                 , Gender.ShowName_zh as ClientGenderName_zh
                 , Institution.InstitutionName
                 , Product.ProductName
                 , FormulaType.FormulaTypeName
                 , Frequency.FrequencyName
                 , Frequency.FrequencyName_zh
                 , Frequency.FrequencyPeriod
                 , Frequency.IsLumpsum
                 , Currency.CurrencyName
                 , Currency.CurrencyName_zh
                 , Transactions.FrequencyPayment
                 , Transactions.Years
                 , Transactions.Terms
                 , Transactions.Remarks
    , c.Address_2
                 , c.Address_3
                 , c.Address_4
                 , c.Address_zh_2
                 , c.Address_zh_3
                 , c.Address_zh_4
    are newly added
    the other fields can be shown properly
    Edited by: tomckw on Oct 24, 2011 10:04 AM

    Only the RAS ( Report Application Server ) SDK includes API's to retrieve the version information. As you do not have full build of CR, you do not have the RAS SDK.
    Just as an FYI. The APIs are:
    CrystalDecisions.ReportAppServer.ClientDoc.ISCDReportClientDocument.MajorVersion
    CrystalDecisions.ReportAppServer.ClientDoc.ISCDReportClientDocument.MinorVersion
    A C# example code looks like this:
    MessageBox.Show("Report Version: " + (rptClientDoc.MajorVersion.ToString() + "." + rptClientDoc.MinorVersion.ToString()), "RAS", MessageBoxButtons.OK, MessageBoxIcon.Information);
    I htink your only way to tell is to take the 10.2 report, add it to your VS2008 project and save. On save, if it says something like;
    "this report was crated ina precious version of CR"
    you know it is not 10.5.
    But I do not think that is your problem here...
    - Ludek

  • Is there a way to import a indd CS4 file with its Data Fields names and properties into CC?

    I have to convert numerous files from CS4 to CC. The CS4 files are using external data from a CSV file. When I open the file in CS4 I can enable the preview and see the data from the CSV file. But when I save the file as indd or idml and try to open it in InDesignCC then I can't see the data as preview. I can see the Data fields (text).I think it's because it doesn't recognize the data fields from the CS4 file. If I delete a data field and remap it I will be able to see the preview for the field I just mapped. the other fields remain the unchanged, like they were just text.
    Any help with this topic will be very appreciated. I have about 70 data fields per document and about 100 documents to go through.
    Update: The symbol for a data field, ex: «fullname_2» change size when I delete and remap it. Explanation: When I open the CS4 file in IndesignCC I can't view a preview of the Data field(s) (almost positive because it's plain text). The data fields show like this «fullname_2». But when I delete that and drag a field from the data field list it shows like this <<fullname_2>>. So definitely, CC is not reading the data fields from InDesign CS4.
    P.S.: The fields above («fullname_2» and <<fullname_2>>  are copy and paste from Indesign CC.

    I'm attaching this image so this forum can notice the difference on the Data fields from CS4 and the ones added on CC

  • Need help adding a default file name in a file chooser of save dialog type

    I need to create a file chooser with save dialog type, how can I add a highlighted default file name into the File Name textfield? As in Microsoft Word, when you want to save a document, a default file name Doc1.doc will appear in the File name text field of the file chooser even when you change to other directories.

    For JRE 1.4.0 you can use this fix:
    public class FileChooserFix implements PropertyChangeListener {
      private String fileName;
       * @see PropertyChangeListener
      public void propertyChange(PropertyChangeEvent ev) {
        JFileChooser chooser = (JFileChooser)ev.getSource();
        if (JFileChooser.FILES_ONLY == chooser.getFileSelectionMode()) {
          if (JFileChooser.SELECTED_FILE_CHANGED_PROPERTY.equals(ev.getPropertyName())) {
            File selectedFile = (File)ev.getNewValue();
            if (selectedFile != null) {
              // remember fileName of selected file
              fileName = selectedFile.getName();
          if (fileName != null &&
              JFileChooser.DIRECTORY_CHANGED_PROPERTY.equals(ev.getPropertyName())) {
            // reset selected file
            File directory = (File)ev.getNewValue();
            chooser.setSelectedFile(new File(directory, fileName));
       * Convenience method to create a fixed file chooser.
       * @return      fixed file chooser
      public static JFileChooser create() {
        JFileChooser chooser = new JFileChooser();
        chooser.addPropertyChangeListener(new FileChooserFix());
        return chooser;

  • Date and time in spool file name

    Hi,
    can anyone show me how i can write the code below so that the spool file will automatically take the system time and date?
    thanks again.
    set term off;
    set echo off;
    set heading off;
    set linesize 1500;
    set pagesize 9999;
    set feedback off;
    spool /home/oracle/ATM_Upload/files/CRD000119MMDDYYHHMISS.DAT;
    SELECT rec_ind||source_type||bbdsa_code||seq_num||dt_ti_ext||ver_num
    as atm_header
    FROM atm_dc_hd;
    spool off;

    Hi,
    I do something similar to this in a file called ed.sql which I use in SQL*Plus to give me a history of SQL*Plus buffers in separate files which follow the naming convention $DATABASE_$SID_$TIMESTAMP.sql. I use it from SQL*Plus when editing, rather than typing "ed" I type "@ed" and it does the naming for me:
    -- Turn off terminal output
    set termout off
    -- Save current buffer to a temp file
    save tmp.txt replace
    -- Set editfile name to $DATABASE_$SID_$TIMESTAMP.sql
    column fname new_value fname
    column sid new_value sid
    select trim(sid) sid
    from v$mystat
    where rownum = 1;
    select global_name||'_&sid'||'_'||to_char(sysdate, 'YYYYMMDDHH24MISS')||'.sql' fname
    from global_name;
    set editfile '&fname'
    -- Retrieve our initial buffer
    get tmp.txt
    -- Turn terminal output back on
    set termout on
    -- Fire up the editor
    edYou could probably adapt this in the following way for your needs:
    column fname new_value fname
    select 'CRD000119'||to_char(sysdate, 'MMDDYYHH24MISS')||'.dat' fname
    from dual;
    spool '&fname'I don't know how you get the 'CRD' part of the filename but you may be able to generate that too using the above as a guide.
    cheers,
    Anthony

  • Flat file should have source field name and value

    Hi Friends
    I have a scenario of Idoc to Flat file , where in the target structure the field name and value should be present, generally only the value is available in a flat file.The target structure is as below:
    for e.g RECTYPE is the Field Name and A is the value.
    RECTYPE,A
    DATEH,20111101
    TIMEH,173125
    RECTYPE,B
    ORDNUM,4500054536
    ORDITM,150
    SUPDAT,20090218
    PLNQTY,000000006
    MATNR,14B300
    BATCH,5697
    PLANT,3026
    DELIVTYPE,PO
    SUPPLIER,0000023305
    SUPNAME,Deutsche BP AG
    SUPADRS,Erkelenzer Strasse 20
    SUPCITY,Monchengladbach
    SUPPOST,41179
    SUPCOUN,DE
    TRUCK_NBR,7589
    BOND_FLG,X
    STG_LOC,PLCL
    LINE_ACTION,CRE
    RECTYPE,B
    ORDNUM,4500056721
    ORDITM,10
    SUPDAT,20090218
    PLNQTY,000000013
    MATNR,116703
    BATCH,6589
    PLANT,3026
    DELIVTYPE,PO
    SUPPLIER,0000023380
    SUPNAME,DOW Belgium NV
    SUPADRS,Havenlaan 7
    SUPCITY,Tessenderlo
    SUPPOST,3980
    SUPCOUN,BE
    TRUCK_NBR,7589
    BOND_FLG,X
    STG_LOC,PLCL
    LINE_ACTION,CHG
    RECTYPE,X
    DATEH,20111101
    TIMEH,173125
    RECORDS,3

    Hi,
         NameA.addHeaderLine
    Specify whether the text file will have a header line with column names. The following values are permitted:
    ■       0 u2013 No header line
    ■       1 u2013 Header line with column names from the XML document
    ■       2 u2013 As for 1, followed by a blank line
    ■       3 u2013 Header line is stored as NameA.headerLine in the configuration and is applied
    ■       4 u2013 As for 3, followed by a blank line
    This specification is only permitted if exactly one structure is defined.
    regards,
    ganesh.

Maybe you are looking for

  • Page Process Does Not Work When Column for APEX_ITEM.HIDDEN is not shown

    I have created a Report Region based on a SQl Query. In the query I have three columns that need to be within an array, but 2 of the 3 columns should not be displayed on the report. Therefore, I don't have Show checked for them in the Column Attribut

  • Flash Player 11 Not Working on OSX 10.7.3 - Plug in failure

    Dear Adobe, I recently updated to Flash 11 and when I tried to watch videos on YouTube it would always say 'Plug in Failure' after about 3-5 secs of the video loading. I've tried all uninstallings and re-instaling it but NOTHING works not even the Fl

  • ECC 5.0 database instance install error in  database load (post processing)

    HI  all! The installation of the environment : VM SERVER v1.03 ECC 5.0 /WINDOWS SERVER 2003 SQL SERVER 2000 SP3 DB INSTANCE install occur error in database load (post processing)  step: sapinst.log: INFO 2008-10-16 14:20:54 Creating file C:\Program F

  • Process chain in PRD

    Hi guys i have transported my process chain to PRD but i can see it in the tree but appears as NEW i suspect that are not active....when i try to plan them i can´t do it because in PRD you cannot made changes....is needed to make changes in PRD for t

  • Practical experience - Max no of interfaces.

    Can anybody please share the practical experience about maximum number of interfaces handaled by XI implementation they've worked on? I want to check the feasibility of using XI for the number of interfaces we foresee in our ERP landscape. Would be v