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.

Similar Messages

  • Dynamic file name ?

    Hi,
    I am following this blog to name the target file/directory dynamically at the runtime :
    /people/sameer.shadab/blog/2005/09/23/an-interesting-usage-of-variable-substitution-in-xi
    But I am getting this error in the CC monitoring :
    Could not process due to error: com.sap.aii.adapter.file.configuration.DynamicConfigurationException: Error during variable substitution: com.sap.aii.adapter.file.varsubst.VariableDataSourceException: Unknown message header category 'interface_name ' for variable 'var1'.

    Hi,
    Try following this weblog for dynamic file name.
    /people/michal.krawczyk2/blog/2005/11/10/xi-the-same-filename-from-a-sender-to-a-receiver-file-adapter--sp14
    Dynamic filename come under the Dynamic configuration in moni, for your messages.
    This is the code used inside.
    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;
    That is why Dynamic configuration is coming in output.. It is a class to generate dynamic configuration file at runtime provided by SAP XI.
    Hope this will help you.
    regards
    Aashish Sinha
    PS : reward points if helpful

  • 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

  • File Adapter: Dynamic file name

    Hello,
    I would like to use a filename like this:
    Name.<DOCNUM>.Direction.<Timestamp>
    For DOCNUM I use variable substitution. Works fine.
    For <Timestamp> I need a different format as the timestamp function
    in file adapter create. So I try to set up my timestamp in mapping like
    dynamic file name:
    DynamicConfigurationKey key1 = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File", "Timestamp");
    conf.put(key1, a);
    Input a is date function which creates my desired timestamp format. In file adapter I try this:
    Name.%DOCNUM%.Direction.%Timestamp%
    or
    Name.%DOCNUM%.Direction.Timestamp
    or
    Timestamp
    all doesn't work for Timestamp.
    So is there a possibility to configure a dynamic filename like this???
    Is there a possibility to access dynamic configuration variables in dynamic filename except
    the known for filename and directory??
    thanks
    chris
    Edited by: Christian Riekenberg on Mar 10, 2009 4:02 PM
    Edited by: Christian Riekenberg on Mar 10, 2009 4:05 PM

    your file name needs to be
    Name.<DOCNUM>.Direction.<Timestamp>
    dont use variable substitution. use only dynamic configuration and set the file name
    introduce a logic that will create the string
    Name.<DOCNUM>.Direction.<Timestamp>
    eg. String filename = "Name" + var_docnum + "Direction" + var_timestamp;
    then use the dynamic conf code to set the file name and use adapter specific properties in you adapter to retrieve it.
    Ref:
    /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/frameset.htm

  • Dynamic file Name Generation-problem

    Hi Friends..
    in My Idoc to File..
    i want to generate Dynamic File Name ..
    i put the logic in Message mapping -java intialization section
    Container container = null;
    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"+datewithYear+datewithMs+".xml";
    else{
    valueNew =oldFileName+datewithYear+datewithMs+".xml";
    //set the new filename
    conf.put(key, valueNew);
    and i did in reciever File adaper adaper specific settings..
    i am getting error sxmb_moni..
    <?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="1">
      <SAP:Category>Application</SAP:Category>
      <SAP:Code area="MAPPING">EXCEPTION_DURING_EXECUTE</SAP:Code>
      <SAP:P1>com/sap/xi/tf/_ZHRMD5_to_HRMasterData_MM_</SAP:P1>
      <SAP:P2>com.sap.aii.utilxi.misc.api.BaseRuntimeException</SAP:P2>
      <SAP:P3>java.lang.NullPointerException</SAP:P3>
      <SAP:P4 />
      <SAP:AdditionalText />
      <SAP:ApplicationFaultMessage namespace="" />
      <SAP:Stack>com.sap.aii.utilxi.misc.api.BaseRuntimeException thrown during application mapping com/sap/xi/tf/_ZHRMD5_to_HRMasterData_MM_: java.lang.NullPointerException</SAP:Stack>
      <SAP:Retry>M</SAP:Retry>
      </SAP:Error>
    if we remove the dynamic File configuration  logic in message mapping ..i am getting the result..
    please guide me..

    Container container = null;
    DynamicConfiguration conf = ((DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION));
    bound to get a NPE as your variable container is not getting intialized to a valid object ref here...

  • 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

  • F110 file name configuration

    Hi experts,
    I would like to know how to find the configuration of generated file name in F110? Path is taken from DME variant, but filename in AL11 has following format: posting date_ runId_BUKRS_payment method_00. I would like to change it, thank you in advance.
    Best regards
    Paul Smuda

    HI,
    Use substring function in the mapping and give the the values as 5 and 8.
    Map to the any field in the Target Structure.
    Use the variable substitution in the Receiver File adapter.
    Go throgh the following blogs.
    Dynamic File Name using XI 3.0 SP12 Part - I
    Dynamic file name(XSLT Mapping with Java Enhancement) using XI 3.0 SP12 Part -II
    Dynamic File Name depending on the Source File name
    Dynamic File Name - Suppress the Substitue varible
    Solution to the problem encountered using Variable Substitution with XI-SP12
    Regards
    Goli Sridhar

  • Dynamic file name within 1:n mapping

    Dear all,
    I have a 1:n mapping and would like to use dynamic file names.
    I searched the forum but found just some few anserws.
    As far as I can determine, it is not possible to use dynamic file names for multiple target messages, right?
    We are using a 3rd party adapter (SFTP) that doesn't support variable substitution.
    Is there another way?
    Thanks
    Chris

    >>As far as I can determine, it is not possible to use dynamic file names for multiple target messages, right?
    I am afraid you are correct.
    >>Is there another way?
    One option I could think is have an adpter module and adding the dynamic configuration there.
    I personally have not tried this option. But I dont see any reason, why this approach would fail.
    If I am correct, the message is passed to the module chain after the split. So the above logic should work.
    I will be glad if you can try and let me know the results
    Regards
    Jai
    P.S: Let me know if you need any help creating the module. The coding should be so simple and not more than 10 lines

  • Dynamic file name while sending to target FTP

    Hi Experts,
    we have a scenario wherein we are trying to implement dynamic file names.
    The scenario is IDOC to file, and  we need to append the data corresponding to all the IDOC triggered n a daily basis.
    Its like  the file abc_01will contain data for day 1(data of oll the IDOC in that day).For day to we need to dynamically name the file as abc_02 and so on.
    But before naming the file as abc_02 we need to check if abc01 is present or not .If abc_01 is not present then for day 2 file  we need to give the name as abc_01 and so on_.This condition is need to be checked becasue there may be the case that a file may not be picked by the script running  at the target system.
    can anyone let me know how to check whether file are correctly picked at target.
    Regards,
    srinivas.

    Hi  Srinivas,
    I think you can achieve this with the next scenario:
    - For getting all the Idocs info, you need a ccBPM to collect them, and then, download them to a file.
    - To dynamically put the filename, you need to use Dynamic Configuration at the File Receiver Adapter (in the Message Mapping, you can write a UDF.)
    - And to check if the daily file exists, you can also write an UDF and then decide the name of the output file.
    Hope this helps,
    Regards,
    Juan

  • Log4j - dynamic file name

    Hi
    I hava some servers that use log4j to log in shared folder.
    i want that every server will create his own log file with his host name.
    I'm using log4j.xml to configure the appender and I want to use variable to create dynamic file name.
    Could it passible?
    Here is my appender:
         <appender name="traceFile" class="org.apache.log4j.RollingFileAppender">
              <param name="file" value="C:/temp/traceLog.log" />
              <param name="MaxFileSize" value="1000KB" />
              <!-- Keep one backup file -->
              <param name="MaxBackupIndex" value="10" />
              <layout class="org.apache.log4j.PatternLayout">
                   <param name="ConversionPattern" value="%d %p %t %m%n" />
              </layout>
         </appender>
    tnx Yaniv

    yaniv1977 wrote:
    Hi
    I hava some servers that use log4j to log in shared folder.
    i want that every server will create his own log file with his host name.
    I'm using log4j.xml to configure the appender and I want to use variable to create dynamic file name.
    Could it passible?
    And what happens to your distributed enterprise system when that shared folder is not available?

  • 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 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 File Adapter

    Hi,
    I have a requirement to pass dynamic file name in File Adapter.
    Is there any way to pass a variable for the file name attribut in file adapter.
    I am looking for some options apart from %yyMMddHHmmss%,%SEQ%...etc
    Please suggest if any of you have information on how to put values from a variable to file name attribute in file adapter
    regards
    Saiju

    Hi Saiju,
    Yes there is.
    Assign your file name to a variable, let's say 'fileName'.
    Now go to your invoke activity(for the specific fileadapter) -> Property tab-> find a property call jca.file.FileName -> in the value field assign 'fileName' variable.
    That's it... (assuming you are using 11g)
    Arik
    Edited by: Arik on Jun 27, 2012 3:12 PM

  • 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

Maybe you are looking for