Dynamic file name while using java mapping

Hi All,
i need help.
I am using java mapping to convert xml file in zip file.
Now i need to set output file name as SiteId_TimeStamp.zip.
Site id is comping in xml file.
How can i do this?
I tried many thing but didnt get the solution..
As their is no message mapping so I am unable to use ASMA.
Please help.

Did you check the wiki? You just need to add the code into you java mapping..
  Map mapParameters = (Map) transformationInput.getInputHeader().getAll();
   // a) Set Output File name
   mapParameters.put(DynamicConfigurationKey.create("http://sap.com/xi/XI/Dynamic",
                                                         StreamTransformationConstants.DYNAMIC_CONFIGURATION), "");
   DynamicConfiguration conf = (DynamicConfiguration) mapParameters.get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
   DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File", "FileName");
   //Depending on your requirement edit this logic. Here, NewDynamicName + CurrentDate will be output file name.
   DateFormat dateFormat = new SimpleDateFormat("yyyyMMdd");
   conf.put(key, ("NewDynamicName_" + dateFormat.format(new Date())) + ".pdf");

Similar Messages

  • File to JDBC using JAVA Mapping

    Hello,
      Can u explain me about the above scenario of File to JDBC using JAVA Mapping.
       Iam new to XI explain above in detail.
    *Points will be Rewarded*
    Thanks&Regards,
    RavichandKone.

    HI,
    If your mapping is one to one then dont go for java mapping use graphical mapping.
    /people/sap.user72/blog/2005/06/01/file-to-jdbc-adapter-using-sap-xi-30 --> for jdbc receiver: file -JDBC
    Here are the link which will help you in writing the stored procedure:
    Receiver JDBC scenario MS access - /people/sameer.shadab/blog/2005/10/24/connecting-to-ms-access-using-receiver-jdbc-adapter-without-dsn
    Stored Procedures-
    /people/siva.maranani/blog/2005/05/21/jdbc-stored-procedures
    http://www.ics.com/support/docs/dx/1.5/tut6.html
    /people/sriram.vasudevan3/blog/2005/02/14/calling-stored-procs-in-maxdb-using-sap-xi
    http://www.ics.com/support/docs/dx/1.5/tut6.html
    http://java.sun.com/docs/books/tutorial/jdbc/basics/sql.html
    http://www.sqlteam.com/article/stored-procedures-an-overview
    thnx
    Chirag Gohil

  • 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

  • How to remove ":"  in file name while using Variable substution

    Hi ALL
    I am using  file adapter and I what to create file name dynamically by acesssing PO number and time stamp from the payload using variable substution.
    But the problem is I am getting ":" in time stamp field value and it is not acceptable for file name .
    So could you please tell me a way that I can remove this ":" from that particular field value and create the file name dynamically.
    Note 1)Add Time stamp option will not help me as we require a time stamp of particular zone.
    2) Dynamic Configuration code is also not use full as I am using 1:n file creation

    >
    Prasanna Kumar wrote:
    > Hi ALL
    >
    > I am using  file adapter and I what to create file name dynamically by acesssing PO number and time stamp from the payload using variable substution.
    > But the problem is I am getting ":" in time stamp field value and it is not acceptable for file name .
    > So could you please tell me a way that I can remove this ":" from that particular field value and create the file name dynamically.
    >
    > Note 1)Add Time stamp option will not help me as we require a time stamp of particular zone.
    > 2) Dynamic Configuration code is also not use full as I am using 1:n file creation
    does the time stamp with the ":" a part of your output file?
    else use a replaceAll function in your mapping and replace the : with empty string then use the value in the variable substitution
    Another option is use the normal BPM for 1: N message flow. The use a simple java mapping that will introduce a dynamic configuration and you can create the file name as you want. the java mapping will be used in the flow of messages from BPM to target system.
    ref: /people/shabarish.vijayakumar/blog/2009/03/26/dynamic-configuration-vs-variable-substitution--the-ultimate-battle-for-the-file-name

  • Dynamic file name creation using FTP adapter wired from a mediator

    Hi All,
    My Requirement is as follows....
    Mediator is wired to Three FTP adapters to create three files.
    File names are dynamic.
    In the mediator those three routings, mappings and assignment for the directory and file name are being created.
    But out of 3 files, 2 files are being created with the names mentioned during the FTP adapter configuration and the last one is being created
    with the dynamic value.
    Any help in this regard is highly thankful.
    Thank you.
    Srivatsasa.

    Create a UDF in mapping taking counter from IDoc as input parameter
    DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
    DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","FileName");
    String totalFilename = "AAAA_" + counter;
    conf.put(key,totalFilename);
    return  totalFilename; 
    Map output of this UDF to Top node at target.
    you will not be able to see the result in test tab of mapping but it works end to end
    Select Adapter Specific Message Attributes in receiver file adapter..here select filename checkbox

  • Reports region csv file download: can a dynamic file name be used?

    Application Express 3.1.1.00.09
    Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit
    Firefox 3.0.10
    Hi All,
    In Application Builder -> Report Attributes -> Report Export -> Enable CSV output = 'Yes'
    I want to assign the filename dynamically, based on a variable within the application.
    The text in this box always seems to be used as a literal value.
    Is what I want to do possible?
    Kind Regards,
    Bob.

    Yes, In the report name field you can use a page or application item as as the filename.. This is the syntax: &my_item. where my item is a page or application item..
    Thank you,
    Tony Miller
    Webster, TX

  • REG: Dynamic File Name

    Hi All,
              I have Idoc to File scenario where my output is a flat file.I am using java mapping to achive this.My requirment is, i have to name the output file with respect to one field value in the IDOC.
    So how can be this achived.
    Thanks
    Siva

    you can access adapter specific attributes in your mapping.
    Store the Value from the Idoc in a variable and pass that variable to the key.
    eg:
    String myfilename = <THE VALUE FROM IDoc>;
    DynamicConfiguration conf = (DynamicConfiguration) container
        .getTransformationParameters()
        .get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
    DynamicConfigurationKey key = DynamicConfigurationKey.create(
        u201Chttp://sap.com/xi/XI/System/Fileu201D,
        u201CFileNameu201D);
    conf.put(key, myfilename);
    Ref:
    http://help.sap.com/saphelp_nw04/helpdata/en/43/03612cdecc6e76e10000000a422035/content.htm

  • 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

  • Query on processing a PDF file using Java mapping

    Hi All,
    i am trying to process a XML and PDF file using Java mapping, it is successful in XML but unable to do for PDF.
    below is the code i am using... can any one guide me how to process PDF's..
    byte byte1 = 0;     
    java.io.ByteArrayOutputStream bos = (ByteArrayOutputStream)outputstream;
    while((byte1=(byte)inputstream.read())!=-1){
    bos.write(byte1);
    bos.close(); 
    Thank You,
    Madhav

    Hi Madhav,
    I think instead of going with JAVA mapping you can write a custom adapter module for it.
    Ref:  /people/sap.user72/blog/2005/07/31/xi-read-data-from-pdf-file-in-sender-adapter
    Also check : Re: PI 7.1 : Taking a input PDF file and mapping it to a hexBinary attribute
    /people/shabarish.vijayakumar/blog/2009/05/17/trouble-writing-out-a-pdf-in-xipi
    Thanks,
    Edited by: Hareenkumar on Dec 21, 2010 11:12 AM

  • 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

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

  • Dynamic configuration not working in Java mapping

    Hi All,
    I have a scenario where i  am using java mapping. In this i am doing following
    1)Read file name from input message header
    2)set file name in output message Header
    3) set Directory name in output message Header
    i  have used following code .. but iit is not working... when i test end  to end...  in reciver communication channel it is failing stating " message failed as "Directory is not set in Header. Also i checked in SXMB_MONI  "dynamic configuration".It is not showing Directory.
    this is code.
    public void transform(TransformationInput transformationInput,TransformationOutput transformationOutput)
                   throws StreamTransformationException {
                   private Map para;
                   String Directory ;
                   String  inputFileName;
                   String var1 = "ABC";
                   para = transformationInput.getInputHeader().getAll();
                   DynamicConfiguration conf = (DynamicConfiguration) para
                             .get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
                   DynamicConfigurationKey keyFileName1 = DynamicConfigurationKey
                   .create("http://sap.com/xi/XI/System/File", "FileName");
                         inputFileName = conf.get(keyFileName1);
                   DynamicConfigurationKey keyFilename = DynamicConfigurationKey
                             .create("http://sap.com/xi/XI/System/File", "FileName");
                   DynamicConfigurationKey keyDirecory = DynamicConfigurationKey
                             .create("http://sap.com/xi/XI/System/File", "Directory");
                   Directory = "tmp/"+var1;
                   conf.put(keyFilename,inputFileName);
                   conf.put(keyDirecory, Directory);
    I am in PI 7.1 ,   and in eclipse its showing warning that Para is not used.
    Can anyone show some lights.
    Also is there any way to debug this?? like is there any function by which i can write the trace for each step to see those in MONI.

    Method name:   public void createDirectory(Resultlist result, Container container)throws StreamTransformationException
    //Use Simple UDF and do the following lines
    String Directory ;
    String  inputFileName;
    String var1 = "ABC";
    DynamicConfiguration conf = container
        .getTransformationParameters()
        .get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
      DynamicConfigurationKey keyFileName1 = DynamicConfigurationKey
                   .create("http://sap.com/xi/XI/System/File", "FileName");
      inputFileName = conf.get(keyFileName1);
    DynamicConfigurationKey keyFilename = DynamicConfigurationKey
                   .create("http://sap.com/xi/XI/System/File", "FileName");
    DynamicConfigurationKey keyDirecory = DynamicConfigurationKey
                   .create("http://sap.com/xi/XI/System/File", "Directory");
    Directory = "tmp/"+var1;
    conf.put(keyFilename,inputFileName);
    conf.put(keyDirecory, Directory);
    and remove these 3 lines
    //private Map para;
    //para = transformationInput.getInputHeader().getAll();
    //DynamicConfiguration conf = (DynamicConfiguration) para.get(StreamTransformationConstants.DYNAMIC_CONFIGURATION
    >>I am in PI 7.1 , and in eclipse its showing warning that Para is not used.Can anyone show some lights.
    You can simply remove declaring Map Para line... The eclipse gives warning because you dont assign values for it and you are trying to use...
    For using the same input file name in output side, you dont need coding ... you need only for the directory...
    Enable ASMA attributes in the channel.
    Edited by: Baskar Gopal on Feb 24, 2011 10:58 AM

  • 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

Maybe you are looking for

  • MS Word Reports-how to use bookmarks

    I am using the labview report writing tools to produce an MS Word report. I have produced several headings, information strings, tables etc. I need to use "Word Insert Object.vi" to place certain objects such as excel charts at certain places in the

  • EJB and JMS (newbie)

              I'm looking to deploy what is essentially a message-broking service. A bean that           will invoke a helper class which will dequeue messages.           Basically I want to set up our consumer to invoke a handler, which will invoke     

  • The WebHelp doesn't open in Chrome using Robohelp word X5

    Hello All, I am using Robohelp X5 (very old version) to generate webhelp. They seem to work fine in all the browsers except Chrome. When i click on the help the blank pop up opens.. It does not load the content. Infact i downloaded the new version of

  • More 30 Character for Field Names

    Hi : I need the setting for incremental the limit of 30 character of the field name. Ex: MY_DOCUMENT_IN_THE_YEAR_2000_AND_YEAR_2001 varchar (30) Thanks

  • Photoshop / and Vectors

    Ok i have been seeing this topic all over and it drives me mad... Basically Alot of people are arguing abotu this "Can Photoshop Make a True Vector image" Please can some one from Adobe finally Clear This Up for Users???? Ture yes or No ? please Some