Dynamic file name inside the ZIP file

Hi Experts,
I have done proxy to file scenario, reciever side is the file ZIP file, i have done successfully done Zip file using adapter modules in Communication Channel.
The file name is hard coded like this.
contentType-----Transform.ContentType--
text/plain;charset="UTF-8";name="Billing.txt"
Is there any possible to do dynamic file name instead of hardcoded like add time stamp.
Kind Regards,
Praveen.

hi,
you can always do it using an adapter module like shown in my blog:
/people/michal.krawczyk2/blog/2006/02/23/xi-dynamic-name-in-the-mail-attachment--pseudo-variable-substitution
Regards,
Michal Krawczyk

Similar Messages

  • Retaining the fileName inside the zipped files

    Hi Experts,
    I am working on a file to file scenario, in which the files have to be picked up the files in pair(pdf) and zip them  and post in the particular folder.
    I have used PayloadZipBean for zipping the files, but not able to get the original file names inside the zip, but i am getting one Mail and one additional file.
    This thread seems to be similar to my problem:
    Re: ZIP FileName (Additional Files)
    Please suggest.
    Thanks,
    Sushama

    Hi,
    I have done developed an adapter module for retaining the file name, before PauloadZip Bean, in receiver file adapter:
    package sample;
    import javax.ejb.CreateException;
    import javax.ejb.SessionBean;
    import javax.ejb.SessionContext;
    import com.sap.aii.af.mp.module.*;
    import com.sap.aii.af.ra.ms.api.*;
    @ejbHome <{com.sap.aii.af.mp.module.ModuleHome}>
    @ejbLocal <{com.sap.aii.af.mp.module.ModuleLocal}>
    @ejbLocalHome <{com.sap.aii.af.mp.module.ModuleLocalHome}>
    @ejbRemote <{com.sap.aii.af.mp.module.ModuleRemote}>
    @stateless
    public class SetAttachmentName implements SessionBean, Module{
         private SessionContext myContext;
         public void ejbRemove() {
         public void ejbActivate() {
         public void ejbPassivate() {
         public void setSessionContext(SessionContext context) {
              myContext = context;
         public void ejbCreate() throws CreateException {
    public ModuleData process(ModuleContext moduleContext, ModuleData inputModuleData)
                          throws ModuleException{
         try {
            Message msg = (Message) inputModuleData.getPrincipalData();
            Payload payload = msg.getDocument();
            String fileName = msg.getMessageProperty("http://sap.com/xi/XI/System/File",
                                                     "FileName");
            if(fileName == null) fileName="default.txt";
            payload.setContentType("text/plain;charset = \"UTF-8\";"
                                   + "name=\"" + fileName + "\"");
            inputModuleData.setPrincipalData(msg);
        } catch (Exception e) {
            throw new ModuleException(e);
        return inputModuleData;
    But, I am getting corrupted files .
    Please advise.
    Thanks,
    sushama
    Edited by: sushama pandey on Sep 28, 2011 4:52 AM

  • I want to use a dynamic schema name in the from clause but its not working.

    DECLARE
         vblQueryName VARCHAR2(20);
         vblSchemaName VARCHAR2(20);
    BEGIN
         SELECT CurrentSchemaName INTO vblSchemaName FROM HR_989_SCHEMA;
         vblQueryName:='060_525_020';
         INSERT /*+ APPEND(HP_ELIGIBILITIES,4) */ INTO HP_ELIGIBILITIES
              LVL1ID,
              LVL1Desc,
              LVL2ID,
              LVL2Desc,
              LVL3ID,
              LVL3Desc,
              LVL4ID,
              LVL4Desc
         SELECT /*+ PARALLEL(a,4) */
              LVL1ID,
              LVL1Desc,
              LVL2ID,
              LVL2Desc,
              LVL3ID,
              LVL3Desc,
              LVL4ID,
              LVL4Desc
         FROM
         bold     vblSchemaName.HP_ELIGIBILITIES a
         WHERE
              UPPER(LVL2ID) = 'XX' ;
         COMMIT;
    DBMS_OUTPUT.PUT_LINE( 'Query Executed: ' || vblqueryName);
    INSERT INTO HP_QUERYEXECLOG(QueryName) VALUES(vblQueryName);
    EXCEPTION WHEN NO_DATA_FOUND THEN NULL;
    END;
    I want to create a rules table so that the schema name in front of the table name in the from clause can be controlled by a separate table that is maintained but its not working . Help and your valuable inputs needed for this issue

    I want to use a dynamic schema name in the from clauseyou can alternatively set the current schema as e.g. in:
    declare
       vblqueryname    varchar2 (20);
       vblschemaname   varchar2 (20);
    begin
       select currentschemaname into vblschemaname from hr_989_schema;
       vblqueryname := '060_525_020';
       execute immediate 'alter session set current_schema=' || vblschemaname;
       insert /*+ APPEND(HP_ELIGIBILITIES,4) */
             into hp_eligibilities (lvl1id,
                                    lvl1desc,
                                    lvl2id,
                                    lvl2desc,
                                    lvl3id,
                                    lvl3desc,
                                    lvl4id,
                                    lvl4desc
          select /*+ PARALLEL(a,4) */
                lvl1id,
                 lvl1desc,
                 lvl2id,
                 lvl2desc,
                 lvl3id,
                 lvl3desc,
                 lvl4id,
                 lvl4desc
            from hp_eligibilities a
           where upper (lvl2id) = 'XX';
       commit;
       dbms_output.put_line ('Query Executed: ' || vblqueryname);
       insert into hp_queryexeclog (queryname)
       values (vblqueryname);
    exception
       when no_data_found
       then
          null;
    end;

  • How to change recordset bahaviour to accept dynamic column names in the where clause

    Hi
    im using php-mysql and i make a recordset and i want to make the column names in the where clause to be dynamic like
    "select id,name from mytable where $tablename-$myvar";
    but when i do this my i break the recordset and it disappear
    and when i use variables from advanced recordset it only dynamic for the value of the column not for the column name
    and when i write the column name to dynamic as above by hand it truns a red exclamation mark on the server behaviour panel
    so i think the only way is to change the recordset behaviour is it? if so How to make it accept dynamic column names?
    thanks in advance.

    As bregent has already explained to you, customizing the recordset code will result in Dreamweaver no longer recognizing the server behavior. This isn't a problem, but it does mean that you need to lay out your dynamic text with the Bindings panel before making any changes. Once you have changed the recordset code, the Bindings panel will no longer recognize the recordset fields.
    Using a variable to choose a column name is quite simple, but you need to take some security measures to ensure that the value passed through the query string isn't attempting SQL injection. An effective way of doing this is to create an array of acceptable column names, and check that the value matches.
    // create array of acceptable values
    $valid = array('column_name1', 'column_name2', 'column_name3');
    // if the query string contains an acceptable column name, use it
    if (isset($_GET['colname']) && in_array($_GET['colname'], $valid)) {
      $col = $GET['colname'];
    } else {
      // set a default value if the submitted one was invalid
      $col = 'column_name1'
    You can then use $col directly in the SQL query.

  • Dynamic display name of the sender

    I have requirement like below:
    After creating and executing any Agent/iBOt in OBIEE 11g, the Display Name of the Sender in the From address of email delivered to recipients is showing as "Administrator".
    The user who is authenticated and authorized into the OBIEE also created an agent, he is asking that email should show his name in the From Address when it is delivered to the recipients.
    I know why this is happening, I have provided the Display Name of Sender as "Administrator" while configuring the Agents at the Enterprise Manager Level.
    What I am currently looking is, if there is any alternate solution to Dynamically display the name of the user who creates the Agent in the From address of the email when it is delivered to the recipients.
    Thanks in advance
    -Bharath

    Any body there with the answers !!

  • How can I get object name inside the object

    I'm trying to get the object name inside its pl/sql code to pass to another procedure, there must be a way to select object name from system tables ?
    Thanks for help

    Dear Garcia,
    Let me try to help you out..
    First of all let me confirm your requirement.. ie you want to get the attribute 'CONFIG_LINE_COL' of type cl_crm_bol_entity_col from the object 'ISUORDERITEM" right ?..
    try this code,
    data: lr_col type ref to cl_crm_bol_entity_col.
    lr_col = me->typed_context->isuorderitem->config_line_col.
    now you got the collection in lr_col variable.. you can play with this data now. I dont know whats your actual requirement so that i can help you further :).
    Hope it helps.
    Regards, Sudeep..
    Edited by: sudeep vd on Oct 2, 2008 7:31 PM

  • Create Dynamic table name in the select statement.

    I use oracle reports 6i to make myrep.rdf , this report created using certain select query Q1, I created a formula column in this report,
    in the formula column  I write pl/sql block statements to select the data from certain table depends on the output of a column in Q1,
    I want to make the pl/sql block dynamically enough to change the user which I select the data from depends on the connected user
    Ex: if I connected with user = 'KAM14'
    the pl/sql block will be
    select x into v_value from kam13.bil_file where .....;
    and if  I connected with user = 'KAM13'
    the pl/sql block will be
    select x into v_value from kam12.bil_file where .....;
    and so on
    how can I do this in the pl/sql block ...
    Thanks in Advance.

    I am not sure I understood properly, but I think you should create bil_file table under a different user and create synonyms  under KAM1x users.
    Regards

  • Where do I find the sequence file name inside the Expression Browser?

    HI,
    I would like post the user with a simple question of whether this is the sequence file he meant to load. I want to use an expression rather then typing the question. The problem is that I don't seem to find the proper expression for that. I looked inside "RunState.SequenceFile" and I find everything related to my sequence file except to its name.
    Can you help me?
    Thanks
    Rafi

    Hi Rafi2003,
    The SequenceFile doesn't have a Name property. It has a Path property instead.
    Regards
    Ray Farmer
    Regards
    Ray Farmer

  • Dynamic navigation from inside the java code within the project

    I want to create dynamic navigation in my project.
    On my first page I need to get to a second servlet page by the use of dynamic coding. In normal servlets I would use response.redirect() but I cant here in the creator world and I am stuck on this point.
    Any ideas or directions on how to proceed?
    I know how to use the navigation XML file and know how to modify the file in question.

    Well I sort of worked out what had to be done, and the references that everyone gave me was amazing and I am thankful...
    The JNI does anyone have JNI experience???
    Has anyone got the JNI functionally working within this IDE??

  • How to set dynamic host name in the URL of a URL iView?

    Hello,
    I am using a standard URL iView that points to some J2EE app I've written and deployed on the same server.
    I would like to set the host name to be a dynamic one, this way I won't need to change the iView URL when transporting it from one portal to another. As far as I know the system for a URL iView only controls authorizations but cannot replace the full URL set in the iView.
    Any idea who can this be achieved?
    Roy

    Hi Mrityunjay,
    forced URL at runtime will require me to call the URL iView from another iView that I will need to code (setting the URL in the Request object). If I did all this I might as well call it from this iView already.
    I would like to do it with no further developments. I would have thought that SAP has constants that can be plugged in the URL for this type of thing, i.e. $hostname...
    Rgds,
    Roy
    Edited by: Roy Cohen on Aug 21, 2008 4:03 PM

  • Getting the HTTP server name, port and context name inside the init()

    I have a servlet which is initialized when the Web server comes up. Is there any way I can print the complete URL from this servlet?
    I am aware that this can be done by using request object. But note that in this case, there is no request object. All we have is the ServletConfig and ServletContext.
    Pasting a part of my code here.
    public class MyInit extends HttpServlet
    private ServletContext m_servletContext = null;
    public void init(ServletConfig config) throws ServletException
    super.init(config);
    m_servletContext = config.getServletContext();
    //System.out.println("Print the URL here...")
    }

    Only a request has a URL. It's possible for servlets to be mapped to respond to more than one URL, and the server can be configured to respond to more than one host and at more than one port. So none of those things you are asking for have any meaning without an actual request.

  • Dynamic file name of the attachment in sender mail adapter

    Hi
    I have configured a sender mail adapter which receives some attachments.
    Right now the file name of the attachment is hardcoded to "MailAttachment-1" "MailAttachment-2" using the content-description from "AF_Modules/PayloadSwapBean" module.
    I want to set it to dynamic ie. instead of "MailAttachment-1"... i want it with real name of the attach.
    please suggest a solution w/o the need to develop a custom adapter module.
    Thanks!
    Regards,
    Mariano.

    Thanks Prateek,
    Now, i can see that the name of the original file is into the content type named as  text/xml; name"name of the file.xml" when i send the email from outlook.
    If i send it from hotmail, this is not happend.
    Do you know why happend this?
    If i always would have the original name inside the content type, my problem will be solved.
    Edited by: Mariano Vidal on Feb 13, 2009 2:26 PM

  • Setting the name of streamed zip file

    Hi,
    I have a servlet which creates a zip file with documents retrieved from a database. To create the zip file I am using the ZipOutputStream class and adding the documents one at a time to this object. This is all working fine.
    The problem I have is pretty simple, in that I can't seem to find a way in which to set the name of the zip file. This must be possible! At the moment it appears to be setting the name of the zip file to the name of the class that created it. In this case my class is called DocumentPacker and what comes back from the servlet is a zip file called DocumentPacker.zip. This wouldn't be so bad, but if you're creating the zip file for a user that does not have cookies enabled, it appends the session id to the end of the zip file name which i don't want.
    I am creating my ZipOutputStream like this:
    ZipOutputStream out = new ZipOutputStream(new BufferedOutputStream(response.getOutputStream()));
    and then adding the documents one at a time using a BufferedInputStream.).
    Any help on how to set the name would be much appreciated
    Thanks
    Claire

    Your servlet must set some headers on the HTTP response (Content-Type as "application/zip", Content-Disposition as "attachment; filename=yourfilename.zip")
    Read the RFC1806 document.
    Content-Type: application/zip
    Content-Disposition: attachment; filename=genome.jpeg

  • Problem in unzipping the zip files

    Hi,
    I have created a program to unzip the zip files. But when i try to zip it is creating the zipped files outside the folder where it is to be zipped.
    what is wrong with my code.
    if the zip file is migration.zip
    if the path inside the zip file shows
    and the path inside says this
    /codebase/scripts/
    it would create migration folder and create codebase folder outside the migration folder
    what is wrong with my code
    //Unzip the zip files to the folder with their name
    import java.io.BufferedReader;
    import java.io.File;
    import java.io.FileOutputStream;
    import java.io.FilenameFilter;
    import java.io.IOException;
    import java.io.InputStreamReader;
    import java.util.Enumeration;
    import java.util.zip.ZipEntry;
    import java.util.zip.ZipFile;
    // Getting the path to find the type of files
    public class zipper implements FilenameFilter{
              String ext;
              public zipper(String ext)
                   this.ext="." + ext;
              public boolean accept(File dir,String name)
                   return name.endsWith(ext);
    public static void main(String args[]) throws IOException
              try
                        String dir = "D:/a/";
                        File f2 = new File(dir);
                        FilenameFilter fn= new zipper("zip");
                        String ss[]=f2.list(fn);
                   for ( int j = 0; j < ss.length; j++)
                        System.out.println(" Extracting ...." + ss[j]) ;
                        String zipFile = dir + ss[j];
                        ZipFile zf = new ZipFile(zipFile);
                        Enumeration entries = zf.entries();
                        String directoryName = zf.getName();
                        directoryName = directoryName.substring(0, (directoryName.indexOf(":" + File.separator) + 2));
                             String folderName = zf.getName();
                             folderName = folderName.substring(0, folderName.lastIndexOf("."));
                             File file1 = new File(folderName);
                             //File file1 = new File(entries.getName());
                             file1.mkdir();
                   while (entries.hasMoreElements())
                             ZipEntry ze = (ZipEntry) entries.nextElement();
                             String path = directoryName + ze.getName() ;
                             String path1 = folderName + ze.getName();
                             //System.out.println(" : " + path);
                             if (ze.getName().endsWith("/"))
                                       File file = new File(path);
                                       file.mkdir();
                                       continue;
                                       //break;
                        BufferedReader bReader = new BufferedReader(new InputStreamReader(zf.getInputStream(ze)));
         StringBuffer fileBuffer = new StringBuffer(" ");
         String line ;
                        while ((line = bReader.readLine()) != null)
                                  fileBuffer.append(line);
                                  fileBuffer.append("\r\n");
                                  //line = line + "\r\n";
                                  //byte[] b = new byte[line.length()];
                                  //b =line.getBytes();
                                  //out.write();
                        String fileData = fileBuffer.toString();
         File f1 = new File(path);
                        f1.createNewFile();
                        //FileOutputStream out = new FileOutputStream(folderName + "/" + ze.getName());
                        FileOutputStream out = new FileOutputStream(path);
                        long size = ze.getSize();
                        byte[] data1 = new byte[fileData.length()];
                        for (int i = 0; i < fileData.length(); i++)
                                  data1[i] = (byte) fileData.charAt(i);
         out.write(data1);
         out.close();
                        bReader.close();                         
                   } catch (Exception e)
                             e.printStackTrace();
    Thanks in Advance
    Avinash

    String path = directoryName + ze.getName();
    String path1 = folderName + File.separator+ ze.getName();
    File f1 = new File(path); // pass path1 instead of path
    f1.createNewFile();
    FileOutputStream out = new FileOutputStream(path); // pass path1 instead of path

  • Dynamic file naming with File/FTP adapter

    Hi all,
    I have a requirement for writing files with names of the files based on a customer ID.... a dynamic name based on a value retrieved from the customer DB.
    I have already tried using the dynamic file naming suggestion in the bpel dev guide, it does not work. I followed the instructions, the process fails to compile and throws "part" and "undefined variables" errors etc.
    Has anyone succesfully used file/ftp adapter to write files with dynamic file names (using a varibale), not %SEQ% or %datetime% formats?
    Thanks,
    Hasan

    You can create a header variable that will allow you to set the outbound file name inside the process. This variable is a message type. From the type chooser select:
    Message Types
    Partner Links
    Outbound Partner Link
    Outbound wsdl
    Message Types
    Imported WSDL
    fileAdapterOutboundHeader.wsdl
    OutboundHeader_msg
    This variable will have a part filename.
    Set this part to whatever you wish your file to be named.
    Select the invoke to your outbound file/ftp partnerlink. Move to the adapters tab and select the header variable you created as the Input Header Variable.

Maybe you are looking for