Spooling with dynamic file names

Hi
i'm having a situation where i need to execute a script daily, the logs of the script should be saved using spool. is there a way to dynamically create a destination file with the filename as "spooled_text_"||sysdate
like
spool spooled_text_30_Jan_2008_08_45_AM
Any help is greatly appreicated
Thank you

As follows, in sqlplus...
SQL> column dt new_value file_date
SQL> select to_char(sysdate,'YYYYMMDD') as dt from dual;
DT
20080130
SQL> spool file_name_&file_date..log
SQL> spool off
SQL> host ls
file_name_20080130.log

Similar Messages

  • Export with dynamic file name

    Hi everyone.
    I want to know how export oracle tables with dynamic file name on windows XP platform.
    bye.

    You'd have to generate the export command-line or par file using a script -- Windows or SQL !
    It would be easy to use SQL to generate the script.
    So you could have a BATch file that
    a. Calls the SQL to generate the export command-line or parfile
    b. Executes the export
    even possibly run in a loop.
    Hemant K Chitale

  • Saving Offline PDF form from Web-Dynpro with Dynamic File Name

    Hello All,
    We have a offline PDF form.... When we save the form, a default file name appears. We need to change this default name to some value that is already available in the form fields.
    I have gone through some posts in the forum. However not able to figure out the solution.
    Following are the details:
    1. Web-Dynpro used : ABAP Web-Dynpro
    2. Form Type: Native
    3. Offline Editable form
    Regards,
    Kunjal Patel

    Hi Rajesh,
    I have not yet found a solution....
    Also as you have seen no one is replying.....
    All,
    Should we consider that this issue does not have a specific solution?
    Regards,
    Kunjal

  • Calling SQL Loader with Dynamic file names

    HI all
    I woul like to know if I can call sql loader as below
    $ sqlldr userid=uname/pwd control=new.ctl, data=$1
    I have to schedule my loader 3 times a day and each time my file names are different(AAA_BBB_timestamp)
    Thanks

    I have found a solution myself and if any one is interested its like this
    for file in `ls -1 /opt/user/from/`
    do
    sqlldr userid=user/pwd@connect_string control=control_file.ctl data="/opt/user/from//$file"
    done
    Ramu

  • IDOC to multiple file with dynamic file names with same content

    Hi,
    My scenario is from IDOC to file.
    The number of files which i need to create is dynamic, which depends on the number of plants.
    I have a Z-table where i will maintin list of all plants ( non SAP plant names).
    I need to fetch the data from this z-table and depending on the nunber of plants i need to create the file for each plant and fiel name should contain plant name in it. EX: abc_<plant>_datatype.txt
    I want to use only receiver one CC, and files should be created in the same directory.
    Can we do this without BPM?

    Hi,
    You can use the Mapping lookup concept to fetch the plant names from Z-tables and then you can use the variable substitution technique to resolve your purpose.
    Here you need to create multiple interfaces ie.e per plant to create multiple files. You can use common Communication channel for all.
    Mapping Lookup
    http://help.sap.com/saphelp_nw04/helpdata/en/cf/406642ea59c753e10000000a1550b0/frameset.htm
    Mapping Lookups - RFC API
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/a03e7b02-eea4-2910-089f-8214c6d1b439
    /people/bhavesh.kantilal/blog/2006/11/20/webservice-calls-from-a-user-defined-function
    http://help.sap.com/saphelp_nw04/helpdata/en/cf/406642ea59c753e10000000a1550b0/frameset.htm
    Variable Substitution
    An interesting usage of Variable Substitution in XI
    /people/sameer.shadab/blog/2005/09/23/an-interesting-usage-of-variable-substitution-in-xi
    SP12 -Variable Substitution option
    Receiver File Adapter:Variable substitution :FATAL  ERROR
    Thanks
    Swarup

  • Dynamic file name from input payload (RFC 2 flat file)

    Hi,
    I have an RFC to flat file scenario. The output flat file has not an XML structure, it's just a plain text file generated with abap mapping.
    In my source interface (RFC), I have a field called <FILENAME>, I want to use the value of that field to create the target file using dynamic file name. But if  in variable substitution I use payload:ZRFC_NAME,1,FILENAME,1 It doesn't work because the dynamic variable substitution try to access to output payload, not the source one...
    What can I do?

    Hi Marshal,
           You can add a extra node to your target strucutre like
    FileName- Node
    --FileName - Element.
    do the mapping from the field filename of RFC to FileName field in u r target strucure. And use this  field path at Refrence in variable subtituion.
    In the Content converison add the Name & Values as below
    FileName.fileldNames -- FileName
    FileName.fieldFixedLengths -- 0
    FileName.fixedLengthTooShortHandling -- Cut
    So the extra field in u r target structure would not populate in u r target text file.
    Cheers
    Veera

  • Dynamic File Name - UDF

    Hi Master,
    I written the UDF for Getting the Dynamic File name.
    DynamicConfiguration conf = (DynamicConfiguration) container.getParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
    DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","FileName");
    // Retrieve the filename
    String FileName = conf.get(key);
    This is working ok - but I want to return these values so I can be used in mapping.
    when I try to add the statement return FileName; , the compiler then complains with the following error:
    cannot return a value from method whose result type is void return FileName;
    Please help me,
    Thanks,
    Anu

    Thanks Nithiyanandam,
    I am using the Same code. But i am getting the Syntax error:
    Source code has syntax error:  E:/usr/sap/DX1/DVEBMGS01/j2ee/cluster/server0/./temp/classpath_resolver/Mapaf708c00d6bb11dd83ee00101816a382/source/com/sap/xi/tf/_MM_I_FF_O_RFC_.java:13: cannot resolve symbol symbol : class variable location: class com.sap.xi.tf._MM_I_FF_O_RFC_ variable a; ^ 1 error
    UDF Name: FileName
    while creating the UDF, I select the first radio button(Value). not  Context and Queue.
    I written the below code.
    DynamicConfiguration conf = (DynamicConfiguration) container
        .getTransformationParameters()
        .get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
    DynamicConfigurationKey key = DynamicConfigurationKey.create(
        "http://sap.com/xi/XI/System/File",
        "FileName");
    String FileName = conf.put(key, a);
    return FileName;
    Thanks,
    ANU

  • Dynamic File Name depending on the Source File name

    Hi Experts,
    I have a problem like Dynamic File name depending on the Source File Name. I will explain with example as follwos
    Source File name                 Targer Folder/Filename
    NK01.VR59.L2007030         VR59/Rec.l200
    NK01.VR71.L2017030         VR71/Rec.l201
    NK01.VR77.L2027030         VR77/Rec.l202
    See above the exaple, Depending on the Source file name, I am deciding where i need to place my file and what name i need to name it.
    So please suggest me the solution and How can i do this with a single communication channel ? Do i need to create multiple CC for each folder??
    Points will be rewarded for Valuable anwer.
    Thanks in Advance,
    Best Regads,
    Vijay

    Hi VIjay,
    Thanks for quick reply. But i am getting error in End to End Scenarios only. If i remove the Return " "  statement from the UDF, while activating it is showing the error saying like missing return statement. I also mapped to the top most node to this UDF.
    I am getting the following error in End to End error Scenarios:
    <?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
    - <!--  Request Message Mapping
      -->
    - <SAP:Error xmlns:SAP="http://sap.com/xi/XI/Message/30" xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/" SOAP:mustUnderstand="">
      <SAP:Category>Application</SAP:Category>
      <SAP:Code area="MAPPING">EXCEPTION_DURING_EXECUTE</SAP:Code>
      <SAP:P1>com/sap/xi/tf/_MM_Target_File_determined_</SAP:P1>
      <SAP:P2>com.sap.aii.utilxi.misc.api.BaseRuntimeException</SAP:P2>
      <SAP:P3>Fatal Error: com.sap.engine.lib.xml.parser.Parser~</SAP:P3>
      <SAP:P4 />
      <SAP:AdditionalText />
      <SAP:ApplicationFaultMessage namespace="" />
      <SAP:Stack>During the application mapping com/sap/xi/tf/_MM_Target_File_determined_ a com.sap.aii.utilxi.misc.api.BaseRuntimeException was thrown: Fatal Error: com.sap.engine.lib.xml.parser.Parser~</SAP:Stack>
      <SAP:Retry>M</SAP:Retry>
      </SAP:Error>

  • Dynamic File name for Open Hub file

    Hi All,
    I wanted to create a .csv file using open hub destination. I wanted the name of the file to be dynamic based on month. for example in jan I wanted it as 01.Dump for January and 02.Dump for february.
    is is possible at all to do that.I wanted to save the file in the application server. There should not be any manual intervention the process.
    Thanks in advance.
    Regds
    Raghu

    Hi
    We have take month from the first record that we read.
    Our requirement is to take one months data and give it in a file with a file name having the corresponding month.
    In the code mentioned below MOC_CODE is the field that is used for this purpose.
    Hope it helps.
    Regards,
    Raghu
    code:
    #!/bin/sh
    Script to dump file.
    Parameters.
    $1 Division name to extract from the data file.
    It re-arranges the columns.
    It replaces values in strings.
    Parameters.
    DATA_FILE_NAME="data_file.csv"
    HEADER_FILE_NAME="header_file.csv"
    DIVISION_NAME="$1"
    Re-arrange header file columns.
    Transpose rows to columns comma separated.
    HEADER_ROW=`cat "$
    Re-arrange header columns.
    Re-direct the output to a temporary file.
    " | tr '\n' ',' | sed 's/,$//g'`
    echo "$" | awk 'BEGIN { FS = ","; OFS = "," } { print $2, $3, $1, $4, $5, $6, $7 }' > "$.$.tmp"
    Prepare awk program.
    Re-arrange data file columns.
    Replace UNI in 6th column with UNIT and Replace TON in 6th column with TONS.
    Filter division rows.
    AWK_PROGRAM="BEGIN { FS = \",\"; OFS = \",\"; TVAL = 0 } \$5 ~ /$/ { sub( \"UNI\", \"UNIT\", \$6 ); sub( \"TON\", \"TONS\", \$6 ); print \$2, \$3, \$1, \$4, \$5, \$6, \$7; TVAL = TVAL + \$7 } END { printf \"$ Total Value: %f\", TVAL 2> \"$$Re-direct the program to a temporary program file.Control.ctl\" }"
    echo "$" > "$.awk"
    Execute the data file formatting command.
    awk -f "$.awk" "$" > "$.$
    Get generation date.
    Get moc code from data file.
    .tmp"
    GENERATION_TIME=`date +"%Y%m%d_%H%M%S"`
    MOC_CODE=`head -1 $ | awk -F, '{ print $3 }'`
    Prepare dump file.
    DUMP_FILE_NAME="$_$_$_$"
    cat "$.$.tmp" "$.$.tmp" > "$
    Remove temporary files.
    FTP dump file to remote server.
    FTP.
    rm *.tmp
    REMOTE_SERVER="<replace with server ip address>"
    REMOTE_USER="xxxx"
    REMOTE_PWD="xxxx"
    ftp -n "$" << EOF
         quote USER "$"
         quote PASS "$"
         ascii
         put "$"
         bye
    EOF
    Exit.
    exit 0

  • Xml file in dynamic file name in file receiver adapter

    Hi,
    I'm doing the dynamic file name in file receiver adapter. I have done as per instructed in /people/jayakrishnan.nair/blog/2005/06/20/dynamic-file-name-using-xi-30-sp12-part--i
    All turned out okay. I have got the file name I require. Except that the file format is XML and I need to suppress the filename node occupied by the dynamic file name.
    The content conversion mentioned in /people/sravya.talanki2/blog/2005/08/11/solution-to-the-problem-encountered-using-variable-substitution-with-xi-sp12, does not seem to solve my problem. As it is only for file format other than the XML one, because we only do the content conversion if we want to "convert" the format of the content from XML to the other format.
    Does anybody have the solution to my problem? thanks in advance

    Thank you Raj for the direction
    The way to do it is :
    1. In ID, advanced tab, put a check on the adapter-specific message attributes - file name.
    2. Put a "*" on the file name scheme
    3. In IR, create a UDF to set up target file name :
    DynamicConfiguration conf = (DynamicConfiguration) container
    .getTransformationParameters()
    .get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
    DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","FileName");
    // set up file name for receiver adapter
    String SourceFileName = conf.get(key);
    conf.put(key, TargetFileName);
    return " ";
    4. Map the above UDF to the header level of the target structure.
    Regards,
    Idi

  • Dynamic file names in outbound file adapter

    I have to configure a flow in XI system wich takes an input file from one machine and after mapping process leaves the output file in target machine with the same name of input file.
    Name of input file won't be always the same (*.dat) so i cannot hardcode this name in outbound file adapter.
    Does anyone know how to transfer input filename from inbound file adapter to XI message and then to outbound file adapter?
    I know there is an option to create dynamic file names in file adapter but i think it isn't enought to solve my problem.

    I have to configure a flow in XI system wich takes an input file from one machine and after mapping process leaves the output file in target machine with the same name of input file.
    Name of input file won't be always the same (*.dat) so i cannot hardcode this name in outbound file adapter.
    Does anyone know how to transfer input filename from inbound file adapter to XI message and then to outbound file adapter?
    I know there is an option to create dynamic file names in file adapter but i think it isn't enought to solve my problem.

  • How to give a dynamic File Name for Receiver File/FTP Adapter.

    Hi Experts,
        I have one scenario in which we are creating a flat file of IDOC which is coming from R/3 & sending it to FTP location. For this we have configured Receiver FTP adapter with File Name Scheme as "NT.out"  & in File Consturction mode i have given as "Add Time Stamp".
        therfore while creating a file it is creating as NTyyyyMMdd-HHmmss-SSS.out
    where as my requirement is only to to add Time & not the Date. (NThhmmss.out)
        How to do this ?
        for your info we are using ABAP Mapping.
        Pl help me
    Regards,
    Umesh

    Hi Umesh,
          Add one more field to your target structure for your file name and populate that field as per your requirement like NTyyyyMMdd.out. In receiver communication channel use Variable subtiution option and give the refrence of Payload and file construction mode set as create.
    And refer the below weblogs for Variable Subtiutuion File Name Scheme
    /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
    Hope this way would be solve u r problem.
    Cheers
    Veera
    >>>Reward points, if it is needful

  • Passing Dynamic File Name to ODI nterface for processing to another system

    Hi,
    I need help regarding passing a Dynamically Name changing fixed length Flat File in ODI Interface. This interface is built for taking the Flat File as Input and process it to SQL Server by applying Data Mapping and transformations... The input Flat File Name is sequence generated for eg: OEORD1123.txt and next file will be OEORD1124.txt and it sits in Oracle Conc tier. How to pass the latest file name to ODI interface for processing
    Regards,
    Anil..

    Hi Guys...
    I would like to suggest a way.
    a) create a single interface with dynamic resouce name (a ODI variable) with a filter to the month column like:
    month_column = '#vCountMonth'
    b) in the refresh tab of a first variable (I named "vMonth"), use the following query: (varialbe should be alphanumeric, "not persistent")
    select to_char(to_date('#vCountMonth','MM'),'month') from dual
    c) create one more ODI variable (I named "vCountMonth"), alphanumeric, not persistent and at its refresh tab write:
    select lpad(to_char(#vCountMonth + 1), 2, '0') from dual
    d) now just create a package, drag and drop the objects in the following order:
    d.1) vCountMonth in set mode and set = 0 (zero)
    d.2) vCountMonth in refresh mode
    d.3) vMonth in refresh mode
    d.4) the interface
    d.5) vCountMonth in evaluate mode, evaluating "= 12"
    ==> if NO (KO, red line) link the KO line to d.2 step
    ==> a OK line is not necessary unless you have others steps after finish the evaluating
    Make any sense? That is a single loop to have the interface developed only one time.
    Please, remember to check each thread reply as Useful or Correct if they are useful to you...

  • Dynamic file name configuration issue

    Hi,
    My scenario is Idoc to multiple file scenario..
    I need to drop 2 files at the target with the file names to be configured dynamically, at present i have used dynamic UDF to drop the files with the dynamic name. but i am getting the output files with the same name i mean the name which i used in the second structure.
    eg: Input -- IDOC
    ouput: i need to have abc.idocnumber.sysdate.xml & xyz.idocnumber.sysdate.xml
    But now we are getting as xyz.idocnumber.sysdate.msgid.xml & xyz.idocnumber.sysdate.xml
    so correct me if i am wrong .. i should not use 2 dynamic UDF in a single scenario..
    else can i use variable substitution for one structure and Dynamic UDF for another structure..
    please suggest some solution
    Thanks,
    --Kishore

    Hi Kishore,
    you can append the system date to the filename of the receiver.
    Try the below code:
    SimpleDateFormat simpledatFormat = new SimpleDateFormat("yyyyMMdd");
    Date date = new Date();
    String datewithYear = simpledatFormat.format(date);
    SimpleDateFormat simpledatFormat1 = new SimpleDateFormat("HHmmss");
    Date date1 = new Date();
    String datewithMs = simpledatFormat1.format(date1);
    DynamicConfiguration conf = ((DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION));
    DynamicConfigurationKey key = DynamicConfigurationKey.create("http:/""/""sap.com""/""xi""/""XI""/""System""/""File" , "FileName");
    String oldFileName=conf.get(key);
    String valueNew;
    if( oldFileName == null){
    valueNew = "HRXML"datewithYeardatewithMs+".xml";
    else{
    valueNew =oldFileNamedatewithYeardatewithMs+".xml";
    //set the new filename
    conf.put(key, valueNew);
    Are you using multi-mapping? If so Dynamic configuration does not work.

  • Dynamic file name from messsage payload

    Hi Friends,
    My requirement is to read one .xml file , which has  Purchase Order deatails and place .html file on receiver side, we are using XSLT for mapping.
    The file name should be "POnumber.html " , i've gone through below but couldn't get much
    http://help.sap.com/saphelp_nw04/helpdata/en/43/03612cdecc6e76e10000000a422035/content.htm
    Can any one send the that code , and steps to add that code in side XSLT.
    Thanks
    John

    Hi,
    With above links
    /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
    See in the below Michal blog , how to conver the file as html , take that part only.
    /people/michal.krawczyk2/blog/2005/11/23/xi-html-e-mails-from-the-receiver-mail-adapter
    Regards
    Chilla

Maybe you are looking for

  • User Unable to change Ship to address in SC while creating

    Hi All, When user is trying to change the ship to address which was defaulted is unable to make change. USer is trying to make manual entry in the NAME field change so that the other field would automatically gets changed withrespect to NAME in the S

  • QT 7.1.2 + OSX 10.3.9 + mozilla = no web content?

    I've been upgrading my Dad's machine (eMac G4 700/640MB) and after running software update, QT 7.1.2 was installed. After that, I opened Firefox only to find that actual content would not be played and the QT logo with the "?" in the center would sho

  • Freight cost to be copied from Sales order

    Hi I settling freight cost via third party PO . In an SO  i have setup the freight as service line items , so a Pr will be created for these items subsequently a PO will be created for each line item . In this PO i need to capture the freight price f

  • FTP error 426 with Windows IIS server

    Dear SAP, We are experiencing an issue between SAP PI 7.0 SP15 on P-Series AIX IBM Server and the Windows IIS FTP server. The interface in PI does connect to 3 systems with the FTP file adapter (a Mainframe, an AS400 and a Windows IIS FTP server). Th

  • HT4910 how can i backup my photos from my macbook pro into icloud ?

         hi can you help me how to backup all the files in my macbook pro into icloud in want to save may photos to icloud i hope for your kindly response thnaks