Variable filename for output

Hey all,
I want to have the file I spool to in a sql script to change depending on the database I'm connecting to, but am unsure how to accomplish this. Can this be done? Can someone provide an example?

an alternative is to use a recent client and the predefined variable
$ export NLS_DATE_FORMAT='YYYY-MM-DD_HH24-MI-SS'
$ sqlplus scott/tiger
SQL*Plus: Release 10.2.0.2.0 - Production on Thu May 8 13:25:03 2008
Copyright (c) 1982, 2005, Oracle.  All Rights Reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.2.0 - 64bit Production
With the Partitioning, OLAP and Data Mining options
SQL> spool file_&_CONNECT_IDENTIFIER._&_DATE..txt
SQL> prompt hello
hello
SQL> spo
currently spooling to file_TINF4_2008-05-08_13-25-43.txt
SQL> spool offThe main advantage is that you do not need to execute a query, so the file will be created with the right name even if the instance is not mounted and it will not generated an ORA- error if you are not connected
up2u

Similar Messages

  • OPEN DATASET FILENAME FOR OUTPUT.

    HI,
    While doing unicode enable inECC6.0 FOLLOWING ERROR IS COMING.hOW IT WILL BE RESOLVED.
    oPEN DATASET physname FOR OUTPUT.

    Hello,
    For opendataset u need to add the below coding.
    open dataset 'filename' for output in text mode encoding default. ( Based on ur filetype)
                                                            binary mode encoding default
    if it not a unicode system then non unicoding must be added.
    N.B
    In the Transfer stmt the data types apart from CNDT will result dump.
    So please ensure that all are of CNDT types.
    With Regards,
    Sumodh.P

  • Setting up FileName for Output file in SendPort

    Hi - I have a requirement setting up FileName in output file. For instance say, whatever I receive in the 'FathersName' field that Output File should be with that File Name.
    For e.g. if data received in FathersName field is JOHN, output file name should be JOHN.xml
    I am using File Adapters on Receive and send side.
    Can this be achieved just by Messaging Scenario or do I need to implement this using Orchestration ?
    If so, please advise on how to do this ?
    e.
    MBH

    To achieve this, you will have to set your filename value on one of the Context Properties available as a File Adapter macro. For example FILE.ReceivedFileName is mapped to the %SourceFileName% macro.
    You have several options to do this:
    Set FILE.ReceivedFileName in an Orchestration.  It does not have to be Promoted.
    Write the Property ReceivedFileName in namespace
    http://schemas.microsoft.com/BizTalk/2003/file-properties in a Custom Pipeline Component.
    If FathersName can be used in the file name unmodified, you set FathersName as a Promoted Property on the schema and Promote directly to FILE.ReceivedFileName.
    For 1 & 2, you will have to extract FathersName somehow, such as a distinguished field.
    A Custom Pipeline Component or direct Promotion are the only way to achieve this in Messaging only.

  • Open dataset filename for output in text mode encoding default

    Hi,
    When I excute this command I get a sy-subrc = 0, but no file is created. This happens in an ECC 6.0 system. In 4.6C works ok.
    filename has the following structure '
    server\directory\filename'
    What am I doing wrong??
    Thank you very much for your your help.
    Regards.

    Hi,
    Can u tell what syntax u have written for open statement.
    In programs with active Unicode check, you must specify the access type (such as ... FOR INPUT, ... FOR OUTPUT, and so on) and the mode (such as ... IN TEXT MODE, ... IN BINARY MODE, and so on). If the file is opened using ... IN TEXT MODE, you must still use the addition ... ENCODING. If the Unicode check is enabled, it is possible to use file names containing blanks.
    Regards,
    Sruthi

  • Customized filename for output

    Hi,
    Is there someway to set the filename of an outgoing file adapter based on the contents of the file? We're processing invoices and would like to include the invoicenumber in the file containing the invoice ( each file can only contain exactly one invoice ).
    Thanks in advance
    Thomas

    I use the following code in the xsl to create a custom filename:
    <xsl:variable name="HR_ID"
    select='/imp1:verstuurPlaatsingRequest/imp1:PlaatsingCompleet/ns1:StaffingAction/ns1:ReferenceInformation/ns1:HumanResourceId[@idOwner="StaffingCompany"]/ns1:IdValue[@name="id"]'/>
    <xsl:variable name="FILENAME"
    select="concat('albronuit_', kim:getCurrentDateTime('yyyyMMddHHmmssSSS'),'_', $HR_ID, '.xml')"/>
    <xsl:variable name="SET_FILENAME_OUT"
    select="ehdr:setOutboundHeader('/fhdr:OutboundFtpHeaderType/fhdr :fileName', $FILENAME, 'fhdr=http://xmlns.oracle.com/pcbpel/adapter/ftp/;')"/>
    The first step takes the id from my input xml, the second creates the filename and the third passes this filename to the outboundheader.
    Anne

  • Change "SAPScript" email subject/body for External Send(5) for output type?

    Hello,
    I'm emailing a SAPscript form (converted to PDF) generated via Transmission Medium 5 (External send) for output type (EK00) and need to change email's subject and body of email created by SAP code.  Any suggestions on how to change email's subject and body?
    Thanks,
    Billy

    Also if u want to add a body to the mail.  See the below form (sub routine) which needs to be mentioned in NACE.  Either u can keep this routine in the driver program or u can put in separate report program.  All thing u need to is see the below code and mention the name of the program and form name in nace.  Double click on output type in nace. u will find a tab stripped screen in right.  In the screen u can see the first tab as 'General data'  and at the bottom a block with title 'Replacement of text symbols' can be seen.  There u need to pass this program name and form name.
    Execute ur program and test the result.
    FORM text_symbol_replace TABLES pt_lines  STRUCTURE tline
                              USING ps_thead  STRUCTURE thead
                                    ps_nast   STRUCTURE nast.
      DATA:
        lv_kunnr LIKE vbak-kunnr,          " AN0465 Add AKKUMA1 02/19/07
        lv_new_cursor_column LIKE sy-tabix," Cursor column
        lv_new_cursor_line   LIKE sy-tabix," Cursor row
        lv_changed,                        " Indicator
        lv_matnr     LIKE vbap-matnr,
        lv_vkorg     LIKE vbak-vkorg,
        lv_vtweg     LIKE vbak-vtweg,
        lv_desc(20),
        lv_name      TYPE thead-tdname,    " Name
        lt_lines     LIKE tline OCCURS 0 WITH HEADER LINE,
        lv_currentprogram LIKE sy-repid.   " Program Name
      DATA :
        ps_lines LIKE tline.               " Structure
      CONSTANTS:
        lc_int TYPE nast-nacha VALUE '5',  " External Send
        lc_comma TYPE c VALUE ','.         " Comma Separater
      DATA: BEGIN OF ls_fname,
              dsnam TYPE nast-dsnam,       " Spool Name
              dsuf1 TYPE nast-dsuf1,       " Spool Suffix1
              dsuf2 TYPE nast-dsuf2,       " Spool Suffix 2
            END OF ls_fname.
      FIELD-SYMBOLS: <lfs_nast> TYPE vnast.
      IF ps_nast-kschl EQ gc_zj17.
    Fetching vbak-kunnr.
        SELECT SINGLE kunnr                " Customer
                      vkorg
                      vtweg
                 INTO (lv_kunnr,lv_vkorg,
                       lv_vtweg)
                 FROM vbak
                WHERE vbeln EQ ps_nast-objky.
        IF sy-subrc EQ 0.
          SELECT SINGLE matnr INTO lv_matnr
           FROM vbap
             WHERE vbeln EQ ps_nast-objky.
        ELSE.
          IMPORT xvbak-kunnr TO lv_kunnr FROM MEMORY ID 'YSOLDTO'.
          IMPORT xvbak-vkorg TO lv_vkorg FROM MEMORY ID 'YSALESORG'.
          IMPORT xvbak-vtweg TO lv_vtweg FROM MEMORY ID 'YDISTCH'.
          IMPORT xvbap-matnr TO lv_matnr FROM MEMORY ID 'YMATERIAL'.
        ENDIF.
        IF sy-subrc EQ 0.
          CONCATENATE lv_matnr lv_vkorg lv_vtweg
           INTO lv_name.
          CALL FUNCTION 'READ_TEXT'
               EXPORTING
                    id                      = '0001'
                    language                = ps_nast-spras
                    name                    = lv_name
                    object                  = 'MVKE'
               TABLES
                    lines                   = lt_lines
               EXCEPTIONS
                    id                      = 1
                    language                = 2
                    name                    = 3
                    not_found               = 4
                    object                  = 5
                    reference_check         = 6
                    wrong_access_to_archive = 7
                    OTHERS                  = 8.
          IF sy-subrc = 0.
            CLEAR lv_desc.
            LOOP AT lt_lines.
              CONCATENATE lv_desc lt_lines-tdline
                     INTO lv_desc
                SEPARATED BY space.
            ENDLOOP.                       " LOOP AT lt_desc
            CONDENSE lv_desc.
          ENDIF.
        ENDIF.                            " AN0465 Add AKKUMA1 02/26/07
    Fetch Region.
        SELECT SINGLE name1 ort01               " City
          INTO (gv_name1, gv_ort01)
          FROM kna1
          WHERE kunnr EQ lv_kunnr.
        IF sy-subrc EQ 0.
          CONDENSE gv_ort01.
          CONCATENATE ':OC:'
                      gv_name1
                      gv_ort01
                      lv_desc
                 INTO ps_lines-tdline SEPARATED BY space.
          LOOP AT pt_lines.
            pt_lines-tdline =  ps_lines-tdline.
            MODIFY pt_lines.
            CLEAR pt_lines.
          ENDLOOP.
        ENDIF.                             " IF ps_nast-kschl EQ gc_z..
      ENDIF.                               " AN0465 Add AKKUMA1 02/19/07
    IF NO TEXT IS PROVIDED READ TEXT USING HEADER INFO
      IF pt_lines[] IS INITIAL AND NOT ps_thead IS INITIAL.
        CALL FUNCTION 'READ_TEXT'
             EXPORTING
                  id       = ps_thead-tdid
                  language = ps_thead-tdspras
                  name     = ps_thead-tdname
                  object   = ps_thead-tdobject
             TABLES
                  lines    = pt_lines
             EXCEPTIONS
                  OTHERS   = 1.
        IF sy-subrc NE 0.
        ENDIF.                             " IF sy-subrc NE 0.
      ENDIF.                               " IF pt_lines[] IS INITIAL
    REPLACE VARIABLES USING DATA FROM PROGRAM   YVADOR01
      IF NOT pt_lines[] IS INITIAL.
        lv_currentprogram = 'SAPMV45A'.
        CALL FUNCTION 'TEXT_SYMBOL_REPLACE'
             EXPORTING
                  endline = sy-tabix
                  header  = ps_thead
                  program = lv_currentprogram
             IMPORTING
                  changed = lv_changed
             TABLES
                  lines   = pt_lines.
    Subrc Check not required.
        CALL FUNCTION 'FORMAT_TEXTLINES'
             IMPORTING
                  new_cursor_column = lv_new_cursor_column
                  new_cursor_line   = lv_new_cursor_line
             TABLES
                  lines             = pt_lines
             EXCEPTIONS
                  OTHERS            = 2.
        IF sy-subrc NE 0.
          EXIT.
        ENDIF.                             " IF sy-subrc NE 0.
      ENDIF.                               " IF NOT pt_lines[] IS INITIAL
    SPLIT ORDER NUMBER AND PUT THEM INTO SPOOL REQUEST NAME & SUFFIX FIELD
    SAP USES THESE FIELDS TO CONSTRUCT FILENAME
    FOR THE PDF ATTACHMENT IN EMAIL
      IF ps_nast-nacha EQ lc_int OR ps_nast-nacha = '2'.
        IF ps_nast-dsnam IS INITIAL AND ps_nast-dsuf1 IS INITIAL.
          ls_fname = ps_lines-tdline.
          ps_nast-dsnam = ls_fname-dsnam.
          ps_nast-dsuf1 = ls_fname-dsuf1.
          ps_nast-dsuf2 = ls_fname-dsuf2.
        ENDIF.                             " IF ps_nast-dsnam IS INITIAL...
      ENDIF.                               " IF ps_nast-nacha EQ lc_int
    ENDFORM.                               " TEXT_SYMBOL_REPLACE
    Venkat.

  • Variable subsitution for target file names

    Hi All,
    I am using variable subsitution for dynamic file names. I am using the multimapping for multiple files in the target.So i coluld not able to use the dynamic configuration for file names. Now i want to replace all the spaces in the filename to underscore.
    For example
    My payload filed value "file name in the target file".
    Now my filename  "file_name_in_the_target_file".
    How to achieve this using Variable subsitution.
    Regards,
    Ramalakshmi.G

    Use replaceString Function.
    file name
    Constant (" ")               --> replaceString -------> TargetField
    Constant ("_")
    Regards
    Ramesh

  • How do i filter the records in analytic view by using variable/parameter for a time range

    i have a analytic view which has a output column as date type. i want the user who use this view have the control to decided the output records based on a time range (from x to y).
    i tried to create 2 variables, 1 for start_time, 1 for end_time. Ideally, i should have a expression for filtering data like this:
    $$start_time <= date_column <= $$end_time
    However, the variable windows doesn't seem to be feasible for the expression as above.
    Does anyone has the same problem and get it solved?
    Thanks!

    just figured out by my own. So the answer is using "variable" with "range" option.
    Making a variable, then set the "selection type" to "range".
    When preview the data, the variable input window pops up with operator on default "equal", use dropdown list to swtich it to "between", then you can enter the start_time and end_time as a range filter.

  • Dynamic filename for stdout from cron

    OL 5.6 x86-64
    I'm looking for a way to dynamicly specify a filename for stdout from a cron job.
    From a command line, this works fine:
    /home/estevens/bin/x1 > /tmp/estevens_x1_log.`date +%F_%H%M%S`Producing the desired output:
    estevens:dwdev$ ls -ltr /tmp/est*
    -rw-rw-r-- 1 estevens estevens 96 Aug 13 10:23 /tmp/estevens_x1_log.2012-08-13_102356But when I put that in my crontab:
    12 * * * 1 /home/estevens/bin/x1 > /tmp/estevens_x1_log.`date +%F_%H%M%S`I get this result
    /bin/sh: -c: line 0: unexpected EOF while looking for matching ``'
    /bin/sh: -c: line 1: syntax error: unexpected end of file(Result comes to me in an auto-generated email)

    The % sign has a special meaning in cron. A % is used to denote a new line in a crontab entry. You will simply have to escape the % signs and it should work, for instance:
    <pre>
    12 * * * 1 /home/estevens/bin/x1 > /tmp/estevens_x1_log.`date +\%F_\%H\%M\%S`
    </pre>

  • Budget Report to show the fixed and variable split for Materials

    Hello Gurus,
    Could you tell me if there is a budget standards report that will show the fixed and variable split for Materials? Example: Labor, Equip., QC and Overheads? 
    I need it for the correctly rolled-up 'final material number' step.  The report that does this now (without fixed and var split) is the Indented BOM Comparison (sret - cost mgmt-product costing - cost mgmt-customized reports - cost estimate comparison - costed multilevel compare rpt - Indented BOM Comparison).
    Thanks,
    Jefferson

    one simple way is in your final itab declare a slno type i field
    data : begin of itab occurs 0,
    slno type i,
    <other fields>
    end of itab.
    after filling the data in itab.
    loop at itab.
    itab-slno = sy-tabix.
    modify itab.
    endloop.
    in fieldcatalog also you have to define that slno field as the first column.
    but it will change its order if you are sorting the output or filtering the output.
    regards
    shiba dutta

  • The variable $filename and the the *.fm extension

    When you need the title of the document importing into a document, you can use the variable <$filename>.
    This is useful as you can have a template that changes its name with the name of the file.
    However, the variable always writes the document name with the file extension (for example help.fm) making the variable useless.

    Gareth,
    Please also enter a feature request using the official request route via Bugbase & Wishlist and provide some use cases.

  • Open dataset twice once for input and once for output in unicode system

    Hi All,
    In a program
    I used a open dataset to read the data from the file.
    OPEN DATASET cmp_file FOR INPUT IN TEXT MODE
          ENCODING NON-UNICODE.
    Then i closed the file.
    Again later in the program,
    I used a open dataset to transfer the data.
    OPEN DATASET cmp_file FOR OUTPUT IN TEXT MODE
          ENCODING NON-UNICODE.
    But this time I get sy-subrc = 8.
    Unable to open the file and subsequent TRANSFER is leading to the runtime error.
    Note : I am using a unicode system
    I could run the same program well in non-unicode system..
    ->
    Is it that if a file contains data already
    1.I need to delete the data and open it
    or
    2.I need to open in APPENDING mode manadatorily...
    in case of UNICODE system..
    Kindly suggest..

    Hi,
    IF you have write permission al S.O. Level you need to check your DATASET rigths using AUTHORITY_CHECK_DATASET, this validate your rigths with S_DATASET object.
    Example
    TYPE-POOLS SABC.
    CALL FUNCTION 'AUTHORITY_CHECK_DATASET'
    EXPORTING PROGRAM = 'ZDATASET'
    ACTIVITY = SABC_ACT_READ
    FILENAME = '/tmp/sapv01'
    EXCEPTIONS NO_AUTHORITY = 1
    ACTIVITY_UNKNOWN = 2.
    See SABC type pool to know wich activities are aviable.
    Hope this help.
    Regards

  • Setting filenames for images sequences via scripting

    Is there a good way to set the output filename for a sequence via scriping? When I explicitly set the filename and render location, the frame number is being appended to the end of the extension. (example: "filename.png002").

    Did a quick test.
    You can set name the way you want "Comp 1-[#].jpg" - I mean if you add [#] by hand, AE seems to respect that.
    So I guess you could check how many frames you are going to render and set appropriate amount of # signs in the file name.
    Looking at your example, seems that AE ads frame number after the extension. In case you want to control where AE puts those frame numbers, try this "filename-[#].png" - that should do the trick.

  • FH-Collect for Output

    I'm new to FH 11 and OSX on MAC (just upgraded from MAC OS9
    and older FH). I can't seem to figure out how to "collect for
    output" which I did all the time in my older version of FH. Any
    savvy users willing to walk me through it... where in menus, etc?
    Thanks in advance!!

    userj wrote:
    > I'm new to FH 11 and OSX on MAC (just upgraded from MAC
    OS9 and older FH). I
    > can't seem to figure out how to "collect for output"
    which I did all the time
    > in my older version of FH.
    I could find no instructions for "Collect for output" in the
    FHMX Help
    files. Many fonts are now copyright protected, making it a
    copyright
    violation to send away copies of fonts. I'm speculating that
    Macromedia did
    not want to be liable to being an accessory to a crime, so
    downplayed this
    feature.
    1. If the PPD is important, make sure that PPD's printer is
    set up and
    selected as default printer with Print Setup Utility.
    2. Make sure FH Document Setup is set for desired printer.
    Save file.
    3. File>Collect for output.
    4. You get a Report dialog. Go through the categories in the
    left column,
    checking the items in the right column that you want included
    in the report.
    5. Now click the "Report..." button which gives you a Save
    dialog. Create a
    new folder and filename for the report. Click OK. Report and
    collected
    contents will be saved to that folder.
    6. Open the folder. Among the contents, you will see a file
    with a weird
    filename like "4676b98a2c701". This is the PPD. I'm pretty
    sure this naming
    error is a bug. Open the file in TextEdit and find a line
    similar to this:
    *PCFileName: "ADPDF6.PPD"
    This name in quotes is the name of the PPD. I would change
    the filename to
    avoid confusion at the print shop.
    I hope this helps.
    Judy Arndt
    Mac G4, OS 10.4.9

  • SSRS 2008 - Append timestamp in filename for email delivery

    i need to append timestamp in the filename which i am attaching to send report in email
    suggest solution other than fileshare

    Hi,
    As you can see, we can use a variable to get dynamic FileName for the report or attachment only when the subscription is using Windows File Share delivery extension. However, you can implement a custom delivery extension to achieve your goal, please see:
    http://msdn.microsoft.com/en-us/library/ms154050.aspx
    Besides, you can refer to the Printer Delivery Extension Sample provided by SQL Server Reporting Services Samples:
    http://msftrsprodsamples.codeplex.com/
    Similar thread for your reference:
    FileName for datadriven subscription delivered by email
    Regards,
    Vicky Liu
    Vicky Liu
    TechNet Community Support

Maybe you are looking for

  • Multiple AEBS, How to choose a specific base station?

    Hello - I have a new AEBS N as well as an older UFO-shaped AEBS. Both are connected to the internet via ethernet and I am sharing a wireless network between the two. I have one printer and 2 USB hard drives hooked up to the AEBS N via Air Disk. So fa

  • HP psc1300 series won't scan

    Yesterday I installed new software update that came in automatically from Apple. I have 10.5.6. Since then I cannot scan with my HP psc 1300. I can print. When I try to scan I get a window that says "HP communications application is not running". I *

  • HR-ABAP Infotype short dump

    Hi I have created a custom infotype and I had added some additional logic in the module pool in PM01. Nw whn try to open the module by double clickin on it , it is goin for dump. I'm gettin the followin error.. TSV_TNEW_PAGE_ALLOC_FAILED No more stor

  • Midp guide, how to use it.

    Hi, I like to make midp programs for my mobile device, but my mobile device supports only midp 1.0. I was wondering is there a way to install midp 2.0 or above and how ? Edited by: GNU_D on Jul 16, 2008 4:28 AM wrong bold beginning tag.

  • Terms and Conditions in pdf output but not printing

    Hello all, I had this similar issue with my cover letter, but I could move the call to xml control file and that resolved the issue. But with T&C, I need to print them on back of every page and I've used the logic from Tim's blog (http://blogs.oracle