Dynamic file name in receiver channal

Hi, All,
I would like to set dynamic file name in receiver channal. My xml payload will be like this:
<file_name>file1.txt</file_name>
<text_content>balabala......</text_content>
I would like to output an text file which text content will be the value of <text_content>, file name will be the value of <file_name> in the xml payload.
Is there anyone could help me?
Helpful answer will be surely awarded. Thanks
Yang

Please look at the below description from help.sap.com. You can use the below steps to name the file from a value in the payload. You would have to use File Content Conversion to insert the value of the <text_content> in the file.
Variable Substitution (Target Directory/File Name Scheme)
If you set the Enable indicator, you can enter variables for the Target Directory and File Name Scheme. Enter the names of the variables and references in the table.
●      Enter each variable that you reference in the Target Directory and File Name Scheme fields without the surrounding percentage sign under Name of Variables in the table.
The variables can refer to attributes of the message header or elements of the message payload.
○       If the variables are to refer to an attribute of the message header, add the prefix message: to the name of the variable under Reference. You can specify the following attributes of the message header:
sender_party, sender_service, receiver_party, receiver_service, interface_name, interface_namespace,
message_id (message ID with hyphens, for example 9fbe1ff1-9a0d-11d9-8665-cbf10a126331)
message_id_hex (message ID in hexadecimal format, for example 9fbe1ff19a0d11d98665cbf10a126331)
For example, if you want to specify the interface name from the message header in the target directory or in the file name scheme, enter message:interface_name as the reference.
If one of the message attributes contains characters that are not permitted in a file name, for example \, /, :, *, ?, ", <, >, |, then these characters are replaced by an underscore ("_").
○       If the variable refers to an element in XML schema, add the prefix payload: to the information under Reference. The reference then comprises a pseudo path description in the form of a comma-separated list with the schema namea,na,nameb,nb,....
namea,nameb,...corresponds to the element name and na,nb,... corresponds to the occurrence of the element name at the respective level in the document.
The description begins at the root of the document and ends at the respective element.
To reference the element that is in bold in the example, the following expression is used: payload:root,1,e1,1,e2,2
The parser searches for the first occurrence of the root element at the first level. It then searches for the first occurrence of e1 at the second level and for the second occurrence of e2 at the third level. The content of the last element (u201CExample Valueu201D) is set as the value for a specified variable.
<?xml version="1.0" encoding="UTF-8" ?>
<root>
  <dummy>
     <e1>
        <e2>Data_1</e2>
        <f/>
        <g attr="abc">text</g>
        <e2>Data_2</e2>
     </e1>
  </dummy>
  <e1>
     <e2>illegal/value</e2>
     <f/>
     <g attr="abc">text</g>
     <e2 attr="fghij">Example Value</e2>
  </e1>
</root>
Thanks
Praveen M

Similar Messages

  • Error dynamic File Name in Receiver File Adapter

    Hi all,
    Dynamic file name for Receiver file Adapter Problem
    my multi mapping look like this in design mode
    messages
         message1
              SD01_E
                   FileName
                   row
         message2
              SD02_E
                   FileName
                   row
    by processing the xml look like this:
    <ns2:SD01_E xmlns:ns2="urn:lsv.de/SAP/XXX">
    <FileName>L40SA939.xiConstant</FileName>
    - <row>
    or
    <ns2:SD02_E xmlns:ns2="urn:lsv.de/SAP/XXX">
    <FileName>L40SA939.xiConstant</FileName>
    - <row>
    in file receivere adapter  i have try this but it dos not work
    payload:SD01_E,1,FileName,1
    Error:com.sap.engine.lib.xml.parser.ParserException: XMLParser: No data allowed here: (hex) 0(:main:, row:1, col:0)
    is there any way to have access to Filename  in different root elements??
    regards
    Ralf

    Hi Ralf,
    i think, you need for each XML msg (each different root element) a new adapter -> a new IF determination, new rec agreement and a new channel.
    Regards,
    Udo

  • 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

  • Dynamic File Name on Receiver Side using XSLT mapping

    Hi,
      My scenario is a Proxy to File scenario.The File on the receiving side is a TEXT file generated due to XSLT mapping. The file name has to be dynamic like- TEST<DDMMYYHHMMSS>File.DAT.
    If somebody knows how to do the same please help.
    Regards
    Ritu

    Hi Ritu,
    I agree to Krishna.With your XSLT mapping create a XML output which can be converted to a text file with content conversion.
    And for the dynamic file name, i guess its the date that matters which needs to be in DDMMYYHHMMSS format. the same can be accomplished by a Java function and calling it in your XSLT .
    Do refer this weblog it will help you accomplish the same.
    >>> /people/pooja.pandey/blog/2005/06/27/xslt-mapping-with-java-enhancement-for-beginners
    Regards,
    Shabarish

  • Setting dynamic file name in Receiver file adapter - not from payload

    Guys I just remember reading a weblog but can't find it now that I need it, on how to set the file name in message mapping dynamically but not using any payload field.
    Please let me know if you remember this.
    Thanks a lot,
    Viktor Varga

    also u can check in
    <a href="/people/jayakrishnan.nair/blog/2005/06/28/dynamic-file-namexslt-mapping-with-java-enhancement-using-xi-30-sp12-part-ii file name(XSLT Mapping with Java Enhancement) using XI 3.0 SP12 Part -II</a>
    <a href="/people/michal.krawczyk2/blog/2005/11/10/xi-the-same-filename-from-a-sender-to-a-receiver-file-adapter--sp14: The same filename from a sender to a receiver file adapter - SP14</a>

  • Dynamic File name in Receiver File adapter

    Hi,
    My Scenario is Proxy to File.
    I must create filename dynamically in the receiver file adapter by taking the sales order number and divison from the source.
    How can i create a dynamic filename? i searched the forum, but i could not get the correct answer,
    Please help me out.
    Regards
    Srinivas

    Hi Srinivas,
    > My Scenario is Proxy to File.
    > I must create filename dynamically in the receiver file adapter by taking the sales order number and divison from the source.
    public String targetFileName(String Sono, String Div, Container container) throws StreamTransformationException
    DynamicConfiguration conf = (DynamicConfiguration)container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
    DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","FileName");
    String MyFileName = sono + div + "<filename>"+".xml";
    conf.put(key, MyFileName);
    return MyFileName;
    File name you can format according to your requirement.
    And one more thing for this you have to specify the ASMA properties. For this check the below link step-1 and step-2.
    /people/michal.krawczyk2/blog/2005/11/10/xi-the-same-filename-from-a-sender-to-a-receiver-file-adapter--sp14
    Regards
    Ramesh

  • Dynamic  File Name for Receiver File Adapter

    Hi All,
    How can we use dynamic name for Receiver file adapter?
    Can anyone help.
    Thanks in Advance
    Chemmanz

    Hi Chemmanz,
    The dynamic filename generation concept is as follows.
    In your filename field. just give a variable with % symbols. (eg: %file% ).
    Now, under the option Variable Name Substitution, you can give how the value has to be created.
    It can be your interface name, sender service name, etc or it can be some value dynamically from your payload.
    For the former, your give
    message:interface_name ,etc
    and for the payload part you give,
    Payload: "your element root which u wanna acecss"
    Just check this link out,
    http://help.sap.com/saphelp_nw04/helpdata/en/bc/bb79d6061007419a081e58cbeaaf28/content.htm
    And read the contents under variable substitution and it will help you understand the concepts better.
    If you have any clarifications, do get back,
    Regards,
    Bhavesh

  • 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

  • Dynamic file name in receive FTP file adapter

    Hi, All,
    I have a ABAP proxy -> FTP scenorio. The sender side MT is like this:
    <Sender_MT>
      <FileName>abc.txt</FileName>
      <Record>
          <TEXT>.......</TEXT>
          <TEXT>.......</TEXT>
         <TEXT>  ......</TEXT>
    </Record>
    </Sender_MT>
    I would like to output the data which are the values of the tags <TEXT> to a flat file with the file name of the value of <FileName>
    I tried to use Variable Substitution in FTP CC. I set a val1 = payload:Sender_MT:1,FileName,1 .  But I got an error says "Unknown structure 'ns0:Sender_MT' found in document'. I looked at the message monitoring. It shows payload <n0:Sender_MT>. not <ns0:Sender_MT>. I think that is why I got the error. Then I tried to use XSLT mapping. I set
    <Receiver_MT>
    <Record>
         <xsl:value-of select="ns0:Sender_MT/Record"/>
    </Record>
    </Receiver_MT>
    But I get an error says "XMLParser: No data allowed here: (hex) 32, 64, 66(:main:, row:1, col:3): ".
    Could anybody help me out? Thanks!
    Jack
    Edited by: Jack  Mathew on Jun 4, 2009 6:22 PM

    Dude this looks purely like a variable reference error. Have you mapped the the Filename field in the target too? UR XSLT mapping dosent seem to indicate that... run ur mapping test to check that..
    Second ... if ur source structure is hierarchcially similar then var 1 should be -
    payload:Receiver_MT:1,FileName,1
    Regards,
    Arvind R

  • Dynamic file name in receiver - empty line problem with content conversion

    Hi,
    I do a variable substitution from a filename node in my xml structure. Because I don't want to have the the filename in my flatfile i supress the output with the conversion parameters:
    filename.fixedLengthTooShortHandling = Cut
    filename.fieldFixedLengths = 0
    It's working but: the adapter is puting an empty line at the end of the file. If I even put the filename node at the top of the xml struture it generates the empty line at the top of the flatfile.
    Anyone has an idea? is there an other way to set the filename or how can I supress this empty line( I have to) ?
    Regrads
    J.

    Jorg,
    Actually speaking we cannot get rid of this with XI. You have to write a OS script to remove this.
    Else
    you add one more parameter as .endSeparator as backspace ie., 0x08. It will definitely remove the line but I think it is putting a square box at the end of previous line. Please check by giving this and let us know the updates.
    Regards,
    ---Satish

  • Dynamic file name of the attachment in receiver mail adapter

    Hi
    I have configured a receiver mail adapter which receives the payload as an xml attachment.
    Right now the file name of the attachment is hardcoded to "invoice.xml".
    I want to set it to dynamic ie. instead of "invoice.xml"... i want it as "invoice<invoicenumber>.xml".
    Invoice number is present in the payload.
    please suggest a solution w/o the need to develop a custom adapter module.
    Thanks!
    Regards,
    Faria Mithani

    Hi,
    Go through this thread..
    Dynamic  File Name for Receiver File Adapter
    Regards,
    Sarvesh

  • Dynamic file name in case of .txt output files

    Hi all,
    I have a query related to dynamic file name scenario.
    In case of IDOC-XI-FILE sceanrio,
    <b>Is it possible to generate .txt file name based on Plant number like</b>
    <b>%<Plantname>%_%<BusinessDay>_filename.txt</b>
    <b>Note:I have implemneted this for .xml output files but I am not able to implement it for .txt output files .</b>
    PLEASE HELP ME .
    Regards
    Prabhat

    Hi Prabhat,
    I think, the normal Dynamic File Name generation should work fine in your case also. Even if you perform Content Conversion, you can use Variable Name Substiution to create your Destination file name as, the name of the file is determined first and only then is the content converison perfromed.
    for info on content conversion, I would suggest that you go through this thread and check my reply,
    Re: Dynamic  File Name for Receiver File Adapter
    Regards,
    Bhavesh

  • Dynamic file name in communication channel

    hello
    is it possible to give in the communication channel, under the 'File Access Parameters', a dynamic file name?
    to get it out of a table or something?
    Thanks
    Kfir

    Hi,
    Yes its bit possible to use the dynamic file name at File access paramters
    The dynamic filename generation concept is as follows.
    In your filename field. just give a variable with % symbols. (eg: %file% ).
    Now, under the option Variable Name Substitution, you can give how the value has to be created.
    It can be your interface name, sender service name, etc or it can be some value dynamically from your payload.
    For the former, your give
    message:interface_name ,etc
    and for the payload part you give,
    Payload: "your element root which u wanna acecss"
    Just check this link out,
    http://help.sap.com/saphelp_nw04/helpdata/en/bc/bb79d6061007419a081e58cbeaaf28/content.htm
    And read the contents under variable substitution and it will help you understand the concepts better.
    If you have any clarifications, do get back,
    Refer below links for more in depth details about it
    Re: Dynamic file name in Receiver File Adapter
    http://help.sap.com/saphelp_nw2004s/helpdata/en/21/6faf35c2d74295a3cb97f6f3ccf43c/frameset.htm
    /people/michal.krawczyk2/blog/2005/11/10/xi-the-same-filename-from-a-sender-to-a-receiver-file-adapter--sp14
    /people/sap.user72/blog/2005/10/01/xi-new-features-in-sp14
    /people/jayakrishnan.nair/blog/2005/06/20/dynamic-file-name-using-xi-30-sp12-part--i
    /people/jayakrishnan.nair/blog/2005/06/28/dynamic-file-namexslt-mapping-with-java-enhancement-using-xi-30-sp12-part-ii
    /people/michal.krawczyk2/blog/2006/02/23/xi-dynamic-name-in-the-mail-attachment--pseudo-variable-substitution
    http://help.sap.com/saphelp_nw04/helpdata/en/bc/bb79d6061007419a081e58cbeaaf28/content.htm
    Check out this URL
    http://help.sap.com/saphelp_nw04/helpdata/en/bc/bb79d6061007419a081e58cbeaaf28/content.htm
    Check these weblogs as well...
    /people/sravya.talanki2/blog/2005/08/11/solution-to-the-problem-encountered-using-variable-substitution-with-xi-sp12
    /people/sameer.shadab/blog/2005/09/23/an-interesting-usage-of-variable-substitution-in-xi
    Thanks
    Swarup

  • Dynamic File name for File receiver adapter

    Hello,
    I am doing Proxy sender to File receiver scenario.
    Filename is generated in SAP R/3 program and I want to create the file with this same name
    on target location.
    please suggest me how to use this file name in Receiver file adapter?.
    Thanks & Regards
    Jagesh

    Hi,
    you have to enable the adapter specific parameter --> file name in both the sender and the receiver CC to get the input file name as output file name.
    Refer this blog:
    /people/michal.krawczyk2/blog/2005/11/10/xi-the-same-filename-from-a-sender-to-a-receiver-file-adapter--sp14
    Also you need to use this udf
    DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
    DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","FileName");
    String ourSourceFileName = conf.get(key);
    return  ourSourceFileName; 
    Also refer this blog:
    /people/william.li/blog/2006/04/18/dynamic-configuration-of-some-communication-channel-parameters-using-message-mapping
    Regards,
    Nithiyanandam

  • 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

Maybe you are looking for