Dynamic Name from attribute : Variable Substitution

Hey there,
Can I use the variable subsititution feature of the File Adapter to set the filename dynamically from the payload. The filename is to come from a attribute and NOT an element. Is there a way how I can set this in the file schema subsitition .
Thanks is advance,
Zubair

Hi,
I dont think you can use the Attributes in order to use Variable name substitituion.
Another option would be to use Adapter Specific identifiers --> Filename  and the following code in your mapping to set the file adapters file name dynamically,
DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","FileName");
String targetFileName="FILENAME";
conf.put(key,targetFileName);
Also take a look at this blog,
/people/michal.krawczyk2/blog/2005/11/10/xi-the-same-filename-from-a-sender-to-a-receiver-file-adapter--sp14
http://help.sap.com/saphelp_nw04/helpdata/en/43/03612cdecc6e76e10000000a422035/content.htm
Regards,
Bhavesh

Similar Messages

  • Reciever File Adapter - Temp File Name Scheme using Variable Substitution

    How can I create a temporary file that uses variable substitution? 
    We are having a problem with files merging when we write files using the "Use Temporary File" setting on the FIle Adapter.  So two independent files are merging into a single file.  We are not using the "Append" setting.
    We would like to use a Temp File Name Scheme that would append the message id onto the temporary file name. 
    Using variable substitution we created a msgid variable.  When added to the temporary file name using %msgid% the temporary file name is created with %msgid% in the name instead of the actual message id.  We put the variable into the "File Name Scheme" as well and the end completed file used the message id in the name.
    Any Ideas?
    Thanks,
    Matt

    HI Matthew,
    Why are you adding the message id into the temporary file??
    I understand that you want the output of the filename to contain message id .. and hence you are using variable substitution for the same.
    Temporary file name will anyways get overwritten by the actual file name (here the actual filename will be using variable substituion).
    So i suggest to achieve your scenario you can add any name in the temporary file and maintain the desired filename you require as output in the variable subsititution.
    Temporary File Name option actually acts as a lock - unlock mechanism from PI side while the file is getting written to the file server so that while PI is writting the file no third party application batch program picks it up.
    I hope this helps.
    Cheers
    Dhwani

  • Jsp 2.0 tagfile with name-from-attribute causes jasper exception

    hello there, i'm messing around with jsp 2.0 tag files and can't get this simple example to work (tried it for hours in variations ...)
    the tag file:
    <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
    <%@ attribute name="v" required="true" %>
    <%@ variable name-from-attribute="v" variable-class="java.lang.Long" alias="a" scope="AT_END" %>
    <c:set var="a" value="${123}"/>
    <p> TAG: ${v} = ${a} </p>the jsp file:
    <%@ taglib prefix="demo" tagdir="/WEB-INF/tags/demo" %>
    <demo:varAttr v="x"/>
    <p> JSP: x = ${x} </p>exception :
    org.apache.jasper.JasperException: Unable to compile class for JSP
    root cause:
    java.lang.RuntimeException: org.apache.jasper.JasperException: /WEB-INF/tags/demo/varAttr.tag(3,1) The attribute directive (declared in line 2 and whose name attribute is "v", the value of this name-from-attribute attribute) must be of type java.lang.String, is "required" and not a "rtexprvalue".
    ... and so on
    everything else works fine (name-given attribute).
    i use tomcat 5.9.
    any ideas? maybe somebody could try my example on a different installation.
    thank you in advance for any help, because i ran out of ideas.

    The attribute "v" is not allowed to take runtime expressions if you are using it with a name-from-attribute.
    rtexprvalue defaults to true, so you must explicitly make it false.
    <%@ attribute name="v" required="true" rtexprvalue="false" %>Cheers,
    evnafets

  • Dynamic target directory with variable substitution

    Hi everyone.
    I'm trying to save a file in a folder with receiver adapter.
    This folder is determined in runtime and passed to the adapter with variable substitution. My problem is that in RWB i get a error like this : 'Content of variable XXXXX is not safe'
    Does anybody have done a variable substituion for output directory receiver file adapter?
    Regards,
    Inigo.

    Hi,
    Check this links,
    /people/sameer.shadab/blog/2005/09/23/an-interesting-usage-of-variable-substitution-in-xi
    http://help.sap.com/saphelp_nw04/helpdata/en/bc/bb79d6061007419a081e58cbeaaf28/content.htm
    Regards,
    Phani

  • File information -- How to retrieve file name from header variable

    Hi
    I am using File Adapters to read files(.xml) and then I need to perform some database operations.
    One of the requirement is storing the file name read into the DB.
    I searched through the forum and got the information on how to configure this in the header variable. The link below shows the same.
    File Adapter
    Now, I use the XSL mapper to map the source values(from input xml file) to the corresponding table column names. So how should I get the value of the file name.
    I saw some of the in-built functions to be used for this but there is not enough documentation to proceed.
    Can anyone please provide some solution on this.
    /Kiran.

    Hi,
    Here are the steps that you need to do after you have declared the variable.
    1) The variable that you have declared should have the following elements
    a) Filename
    b) Directory
    2) Use the assign activity to copy the value of the filename part of this variable to the arg that needs to be passed to the database. (most probably an invoke variable).
    If you still have any problems implementing this, mail me at [email protected]..and i'll send you the screen shots for the entire process.
    ciao,
    Gunjan

  • Calling actionblocks name from a variable

    Good morning all,
    For log storing purposes, I've created a Table on my Database called MII_LOG, and everytime a Data query returns an error I want to record this error in my database.
    So let's say I have 20 Data query actionblocks inside my Transaction. I created a XML variable called TRANSACTION_QUERIES with the following structure:
    <?xml version="1.0" encoding="UTF-8" standalone="no"?>
    <QUERIES>
    <NAME>Ins_FGE_PROJECT</NAME>
    <NAME>Ins_EMS_PROJECT</NAME>
    And so on...
    </QUERIES>
    After my whole transaction has been executed I've set a repeater to go through
    Local.TRANSACTION_QUERIES{/QUERIES/NAME}
    And for each line I wanted to check if the ActionBlock named after my current <NAME> line . LastErrorMessage is different than "" and if it is, than insert a log line on my table.
    Is that possible?
    Thanks a lot and best regards,
    Guilherme

    Hi Guilherme,
    If your queries are dynamic you can create queries in XML variable like
    <?xml version="1.0" encoding="UTF-8" standalone="no"?>
    <QUERIES>
    <QUERY>Insert into t1 values(1,1)</QUERY>
    <QUERY>Insert into t2 values(2,2)</QUERY>
    And so on...
    </QUERIES>
    and you can use single query temple to execute queries in loop.
    in case of failure you can log action.
    May be this will work.
    Regards
    Anshul

  • ODI - Setting file name from a variable

    Hi,
    I am working on a data integration where I have to fetch data from a database table
    and write it to a flat-file (Fixed length text file). I have succeeded in creating the file.
    I could connect to the database, fetch data and write it to a flat-file in the format I need.
    1. After doing this, can I rename the file or move to file to somewhere, where the filename
    is something like 'File_yyyyMMDDHHmmss.txt'?
    2. To Achieve this, can I use a variable in the ODI project?
    Please help as this is needed urgently for a delivery.
    Thanks,
    Leo

    Hi,
    Thanks for the response. I used it in the same way. But, when I validate the query, it says invalid format description. I am putting this query in the "Select query" text item in "Refreshing" tab of the variable definition screen.
    Thanks,
    Leo

  • How Can I Dynamically Name and Set Variable Values?

    First one with a correct answer will have the FUNCTION named after them......
    What I want to do is create 'new' variables based on the index of the parent.
    So, if I have 4 subforms called 'Panel' (Panel[0], Panel[1], Panel[2], Panel[3]), I want do declare a local variable in my function to count from 0 to n  for each Panel.
    We won't know how many Panels we will have until runtime. So, I need the variables to keep track of the count (it's tracking the number of errors) - for each Panel.
    Something like this:
     if(obj.rawValue==null || obj.rawValue=="")
    var errorCount[obj.parent.parent.index]=errorCount[obj.parent.parent.index]+1;
    app.alert(errorCount[obj.parent.parent.index]);
    I am assuming it has something to do with Arrays.  But I suck at Arrays.
    Thanks for the help.

    You're correct, arrays are the way to go.  Define your error array like this:
    var errorCounts = [];
    Then, understand that when an array entry is not set it will have the value 'undefined', so you can know if an entry has been initialized.  So to increment the count for a particular index (subform occurance) use:
    // If entry is being set for the first time, set it to 1.  Otherwise increment count.
    if ( errorCounts[index] == 'undefined' )
        errorCounts[index] = 1;
    else
         errorCounts[index]++;
    You can also loop through and initialize the array to zero; then you can remove the check for undefined.  How and where you do this and how you figure out what 'index' is depends on how your form is set up and which event you're using to kick off the error check.  Give me a little more detail on what you're trying to do.

  • Variable substitution: (delete leading zeros from file name)

    Hi All,
    I am configuring an IDOC to FILE (fcc scenario) with a requirement of using the IDOC number in the output file name. 
    Using variable substitution, I manged to get the IDOC number from incoming Idoc-control record but it comes in its entitre length with a few leading zeroes like '00000001234'.
    So my output file name looks like 'Output_000000001234.txt'  . I want it to be like 'Output_1234.txt'.
    Is it possible to achieve it ?
    Thanks
    Shirin

    Hi Shirin,
    First supress the leading zeros of IDOC number by using the following code:
    Create a user defined funciton zerosuppress and take the cache as value and take one argument input. Then put the code below:
    //write your code here
    String output = input.replaceFirst("^0+","");
    return output;
    Then use variable substitution for generating ur IDOC number in the out put file name.
    Regards,
    Vinod.

  • File name from an attribute of an element of the payload

    Dear Experts,
    Could you suggest the syntax for specifying the file name from a variable in the file receiver communication channel? I need to grab the file name from an ATTRIBUTE of an element of the payload.
    Thanks a lot.
    Example: Need to pass the attribute "descReceipt" of the element "promotionEvent" to the variable in the following payload:
    <?xml version="1.0" encoding="UTF-8"?>
    <promotionExport>
    <promotionEvent eventIdentifier="30" status="A" descReceipt="FILE1">

    The scenario is IDOC to FILE. I need to get the value of the receiving partner.
    The message header has the node "DynamicConfiguration". Please see the xml below. I need to grab the key RCVPRN (0000002104) from this and pass as the file name in the receiver file adapter.
    How do I setup my receiver file adapter for this? I tried changing the values for the variable, and also enabling the adapter specific message attributes. No solution yet.
    <SAP:DynamicConfiguration xmlns:SAP="http://sap.com/xi/XI/Message/30" xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/" SOAP:mustUnderstand="1">
      <SAP:Record namespace="http://sap.com/xi/XI/System/IDoc" name="RCVPOR">LXDCLNT250</SAP:Record>
      <SAP:Record namespace="http://sap.com/xi/XI/System/IDoc" name="SNDPRT">LS</SAP:Record>
      <SAP:Record namespace="http://sap.com/xi/XI/System/IDoc" name="RCVPRN">0000002104</SAP:Record>
      <SAP:Record namespace="http://sap.com/xi/XI/System/IDoc" name="SNDPOR">SAPLCD</SAP:Record>
      <SAP:Record namespace="http://sap.com/xi/XI/System/IDoc" name="SNDPRN">LCDCLNT220</SAP:Record>
      <SAP:Record namespace="http://sap.com/xi/XI/System/IDoc" name="CIMTYP" />
      <SAP:Record namespace="http://sap.com/xi/XI/System/IDoc" name="IDOCTYP">WPDBBY01</SAP:Record>
      <SAP:Record namespace="http://sap.com/xi/XI/System/IDoc" name="MESTYP">WPDBBY</SAP:Record>
      <SAP:Record namespace="http://sap.com/xi/XI/System/IDoc" name="RCVPRT">KU</SAP:Record>
      </SAP:DynamicConfiguration>

  • Error file adapter with variable substitution in PI 7.31

    Hello,
    I'm trying to create a file with a dynamic name, based on the payload of the message.
    We're trying to create a filename with the bold content in the name %batchId%.xml. The subtitution we use is
    payload:batch,1,batch-info,1,id,1
    <ns1:batch xmlns:ns1="http://www.atosworldline.com/archivingPortal/receivers">
    - <ns1:batch-info id="test" isTest="true"> 
    <ns2:sender-identifier xmlns:ns2="http://www.atosworldline.com/archivingPortal/batchInfo">String 2</ns2:sender-identifier>  
    <ns2:nb-elements xmlns:ns2="http://www.atosworldline.com/archivingPortal/batchInfo">3</ns2:nb-elements>  
    <ns2:batch-integration-mode xmlns:ns2="http://www.atosworldline.com/archivingPortal/batchInfo">String 4</ns2:batch-integration-mode>  
    <ns2:creation-datetime xmlns:ns2="http://www.atosworldline.com/archivingPortal/batchInfo">1999-05-31T13:20:00Z</ns2:creation-datetime>  
    </ns1:batch-info>
    - <ns1:receivers> 
    - <ns1:receiver> 
    <ns1:id>String 5</ns1:id>  
    <ns1:action>String 6</ns1:action>  
    <ns1:contact-details />  
    - <ns1:tokenSets> 
    - <ns1:tokenSet startDate="1999-05-31T13:20:00Z" endDate="1999-05-31T13:20:00Z"> 
    - <ns1:token> 
    <ns1:tokenvalue>String 7</ns1:tokenvalue>  
    </ns1:token>
    - <ns1:token> 
    <ns1:tokenvalue>String 9</ns1:tokenvalue>  
    </ns1:token>
    </ns1:tokenSet>
    - <ns1:tokenSet startDate="1999-05-31T13:20:00Z" endDate="1999-05-31T13:20:00Z"> 
    - <ns1:token> 
    <ns1:tokenvalue>String 11</ns1:tokenvalue>  
    </ns1:token>
    - <ns1:token> 
    <ns1:tokenvalue>String 13</ns1:tokenvalue>  
    </ns1:token>
    </ns1:tokenSet>
    </ns1:tokenSets>
    </ns1:receiver>
    </ns1:receivers>
    </ns1:batch>
    The following error is shown, when processing the message through the receiving fileadapter.
    MP: exception caught with cause com.sap.engine.interfaces.messaging.api.exception.MessagingException: com.sap.aii.adapter.file.configuration.DynamicConfigurationException: Error during variable substitution: com.sap.aii.adapter.file.varsubst.VariableDataSourceException: The following variable was not found in the message payload: batchId
    kind regards,
    Pieter

    AFAIK - Variable substitution does not support attributes. It only support the elements. (- <ns1:batch-info id="test" isTest="true">)
    May be you can go with dynamic configuration instead of variable substitution.

  • Read file name from Payload (File Adapter)

    Hello experts,
    with Receiver-File Adapter I want to save a specific file. Name is given in the xml payload. I use Variable Substitution.
    My structure is like this:
    <root>
        <elements>
            <name>name1</name>
        </elements>
        <elements>
            <name>name2></name>
        </elements>
    </root>
    File name schema: %file%
    Variable Substitution:
        File Name: file
        Reference: payload:root,1,elements,1,name,1
    With this expression my file adapter creates two files (as recommended), but they have both the name "name1". I want to create n files with n different names, given by one xml structure. How can this task be done? Setting the occurency from "1" to "n" or "*" does not work.
    Thank you very much!
    Ilona Seifert

    Hi,
    Like pointed by you , your source strucutre,
    <root>
        <elements>
            <name>name1</name>
        </elements>
        <elements>
            <name>name2></name>
        </elements>
    </root>
    The target strucuture after mutlimapping will be like,
    My structure is like this:
    <root>
        <elements>
            <name>nameX</name>
        </elements>
       </root>
    Now, using Variable Name substitution, you will have the "name " element at a fixed level  always , <b> payload:root,1,elements,1,name,1</b> and so you Variable Name subsitution will also work fine.
    Hope it clears,
    Regards
    Bhavesh

  • FTP Activity - mget multiple files with dynamic names

    Hello All
    Hope all is well.
    I was wondering if there was a way to configure FTP activity to transfer multiple files with dynamic names from source location at daily intervals.
    For example, my source files are affixed with date values (source_filename_<mmddyyyy>_<hh>.txt):
    source_filename_12252009_00.txt
    source_filename_12252009_06.txt
    source_filename_12252009_12.txt
    source_filename_12252009_18.txt
    What I would like my process flow to do would be to download just these 4 files once daily based on a dynamic ftp script as follows:
    open ${Remote.Host}
    ${Remote.User}
    ${Remote.Password}
    cd ${Remote.RootPath}
    prompt off
    mget ????????
    quit
    In DOS batch script you would have the mget command with a wildcard as:
    mget source_filename_%DATE:~0,2%%DATE:~2,2%%DATE:~4,4%*.txt
    How does one go about implementing this in OWB? Does it require a user defined substitution varilable of some sort?
    FYI, I am using version 10gR2.
    Cheers.

    Hi ,
    If you are able to achieve your objective from a DOS batch script then you can call that script for an User Defined Activity in OWB process flow .
    Hope this helps.
    Thanks,
    Sutirtha

  • Access Variable from a dynamic name

    Hello,
    I have a the following example variable in a script defined
    as such:
    mcDrg05OriginalX = mcDrg05._x;
    I wish to access this variable data within a button script,
    but dynamically by assembling the actual variable name:
    newName = holdName[landingCount];
    relocateIDx = (newName + "OriginalX");
    newName accesses the original name from an array, and
    relocateIDx assembles the full variable name to be
    mcDrg05OriginalX. Now I wish to access the original numerical value
    from that variable name, but how?
    I tried:
    _root[newName]._x = (relocateIDx);
    _root[newName]._x = [relocateIDx];
    maybe the answer is out there.
    Thanks in advance.

    Never Mind. I should of searched before.
    If I use:
    relocateIDx = eval(newName + "OriginalX");
    this now gives the original number
    Thanks

  • Variable substitution not working for dynamic file name in Receiver File CC

    Hi Experts,
    I am doing the scenario of Proxy sender to File receiver and my purpose is to Create the text file
    as per the filename available in Source Message payload.
    I am using the Variable Substitution method for this as shown below.
    Source Message Structure:-
         <Row>            -
    having Cocurence 1.1
             <Filename>     -
    having Cocurence 1.1
             <Item>            -
    having Cocurence 1.Unbounded
              <Field1>
              <field2>
             <Item>
             <Item>
              <Field1>
              <field2>
                <Item>        
         <Row>
    Target structure is same as the source structure and i have mapped the Filename field of the Source
    with the Target structure Filename.
    In ID the following is the File receiver CC Configuration.
    File Name Scheme:- %Dyn_filename%
    In Advance tab, I have selected the Enable option and added one row as Variable name %Dyn_filename%
    and Reference as payload:Row,1,Filename,1
    In testing I am getting the Error as 'variable Dyn_filename is not found in Message payload'.
    Please suggest me.
    Regards,
    Jagesh

    Hi Pooja,
    Hi Pooja,
    Thanks for your valuable reply..
    I  tried with the same. but still Filename is appearing in Output file.Giving you some details regarding my Receiver File Configuration settings.
    Target Message Type:-
              <MT_Target_Struct>
                    <Row>----
    1.1 occurence
                            <Filename_test>----
    1.1 occurence
                            <ITEM>----
    1.unbounded occurence
                                  <Field1>
                                  <Field2>
                            <ITEM>
                            <ITEM>
                                  <Field1>
                                  <Field2>
                            <ITEM>
                    <Row>
              <MT_Target_Struct>
    Recordset structure:-  Row,Filename_test,ITEM
    Row.fieldSeparator----
    >'nl'
    Filename_test.fieldFixedLengths----
    >0  (Zero)
    Filename_test.fixedLengthTooShortHandling----
    >Cut
    ITEM.fieldSeparator----
    >,
    ITEM.endSeparator----
    >'nl'
    I want only ITEM node to be written in the output file.
    Please suggest.
    Regards,
    Jagesh

Maybe you are looking for

  • Laserjet 200 Pro 200 color M251nw wont power up

    Havent used this device in about a year,  went to power it up today,  pushed the power button, it flashes white and there is a red X on the screen that also just flashes for about a second.   Have unplugged, have disconnected USB,  have changed outle

  • Transformer throws exception

    Hi I am working with Transformer to transform a xml file using a xsl. I get the following exception :- javax.xml.transform.TransformerConfigurationException: javax.xml.transform.Trans formerException: javax.xml.transform.TransformerException: stylesh

  • Bdc va01

    hi Data transfer gurus,                                   i m writing a bdc program for updating sales data (vao1)                                    frnds can anyone provide to logic  for how to update                                                

  • How to I unlock my iPod touch

    How do I unlock my ipod touch? I have forgotten the passcode.

  • HT1926 (iTunes) Problem with Windows installer package?

    (iTunes) Problem with Windows installer package?  I try to install the new version of iTunes but get an error "Problem with Windows installer package.  A Program required for this install could not be run."  Can anyone help shed some light for me as