Regarding Target File name

Hi Everyone,
I want the Target File name to be as Update_Order_%y%y%y%y%M%M%d%d%H%H%m%m%s%s.A04.
How do i proceed to create such files.
Any help would be appreciated.
Thanks & Regards,
Varun

>
Varun Reddy wrote:
> Hi Everyone,
>
> I want the Target File name to be as Update_Order_%y%y%y%y%M%M%d%d%H%H%m%m%s%s.A04.
> How do i proceed to create such files.
> Any help would be appreciated.
>
> Thanks & Regards,
> Varun
Hi,
1. In the Sender File Communication Channel, check the option Set Adapter-Specific Message Attribute and Filename.
2. Assuming Update_Order is a constant string, Use this UDF. If Update_Order is a element at your source structure, pass it as a parameter to the UDF.
DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","FileName");
java.text.SimpleDateFormat dateformat = new java.text.SimpleDateFormat( "yyyyMMddHHmmss" );
dateformat.format( new java.util.Date() );
String tagetfilename="Update_Order_" + dateformat;
conf.put(key, newfilename);
Regards,
Chandra

Similar Messages

  • Need to genereate Target file name same as Source File Name thru Local J2SE

    Hi Everyone,
    I want to genereate Target file name exactly same as Source File Name. I know how to handle this in Central Adapter Engine(Sender & Receiver Communication Channel).
    But I need to do this in Local J2SE adpater engine.
    Please help me in this regard.
    Thanks & Regards,
    Nagaraju

    U can use the parameter to save the filename in the message header
    file.messageAttributes=<name,directory>
    This is similar "Adapter-Specific Message Attributes" concept.
    http://help.sap.com/saphelp_nw04/helpdata/en/6f/246b3de666930fe10000000a114084/frameset.htm
    Regards,
    Prateek

  • Target file name as field in target structure

    Hi SDNers,
    I have a requirement where I need to populate a field in target structure with the target file name, this will be a counter.
    So if the interface is run 2 times already the third file should have name XXXXXXX_03 and also this needs to be mapped to a field in the target structure.
    Any ideas on how to achieve this?
    (Pls Note: I am aware of ASMA and variable substitution)
    Regards,
    Gautam Purohit

    Hello Gautam!
    File adapter - How to pass File name and path at runtime
    This SDN topic probably covers the requirement you mentioned!
    BR,
    Lucas

  • Need Target File  Name  Timestamp  is  same  as Source File name Timestamp

    Hi ,
           I want to genereate Target file name (Target_09062008082030.xml)   but  this time stamp is exactly Sorce FileTime stamp..(Source_09062008082030.xml)..
         so, i want to create a  target file  with the same source file time stamp.. 
    for this.. i sed Message Specific attributes... in both sender and receiver side.. but  that was creating with the complete name.of source file name.. but i want only Timestamp of the source filename... and remaing is the constant.. for this  how can i proceed  ..
    Thanks
    Jain

    See in Sender CC when you set the Adapter Specific Message Attr  for file name it will send the filename in the header of the XI Message.
    To acces this file name inside mapping you need to create a UDF . The type can be any thing as you desire.
    You dont need to pass any variable .if suppose you want the file name (constant) e.g ABC_<timestamp>.xml
    DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
    DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","FileName");
    String fileName= conf.get(key);
    //see above your key is FileName which will be sent by the sender CC automatically... You are simply accessing it here using get() method.
    //now ur filename will contain name of the source file... you need to perform a substring operation to get the timestamp and create a new file name as you desire.
    fileName = "New_<timestmp>.xml"; //for e.g
    //set this file name again in header message using put()
    conf.put(key, fileName);
    //when you check on the adapter specific message attr for fileName in the receiver CC ,it will automatically take this new file name value.
    return fileName;
    // if you want to use this new fileName inside your mapping payload (for other fields) you can assign this to any target field,else just assign it to the root tag which will make no difference if this file name is not used anywhere.

  • Variable subsitution for target file names

    Hi All,
    I am using variable subsitution for dynamic file names. I am using the multimapping for multiple files in the target.So i coluld not able to use the dynamic configuration for file names. Now i want to replace all the spaces in the filename to underscore.
    For example
    My payload filed value "file name in the target file".
    Now my filename  "file_name_in_the_target_file".
    How to achieve this using Variable subsitution.
    Regards,
    Ramalakshmi.G

    Use replaceString Function.
    file name
    Constant (" ")               --> replaceString -------> TargetField
    Constant ("_")
    Regards
    Ramesh

  • Target file name-'YYYYMMDD-HHMMSSMMM- test .txt

    Hi Experts,
    We have a requirement where we need target filename as 'YYYYMMDD-HHMMSSMMM-test.txt'. Kindly suggest can we get this filename without using Variable Substitution and Dynamic Configuration.
    Regards,
    Sudha

    Hi Sudha,
    If your requirement is to avoid using Variable Substitution and Dynamic Configuration, you can always use an Operating System Command After Processing that you will define in the Receiver Communication Channel. You can use it to change the file name of the file that just got created, and add the timestamp at the beginning.
    Hope this helps,
    Greg

  • How to get the target file name from an URL?

    Hi there,
    I am trying to download data from an URL and save the content in a file that have the same name as the file on the server. In some way, what I want to do is pretty similar to what you can do when you do a right click on a link in Internet Explorer (or any other web browser) and choose "save target as".
    If the URL is a direct link to the file (for example: http://java.sun.com/images/e8_java_logo_red.jpg ), I do not have any problem:
    URL url = new URL("http://java.sun.com/images/e8_java_logo_red.jpg");
    System.out.println("Opening connection to " + url + "...");
    // Copy resource to local file                   
    InputStream is = url.openStream();
    FileOutputStream fos=null;
    String fileName = null;
    StringTokenizer st=new StringTokenizer(url.getFile(), "/");
    while (st.hasMoreTokens())
                    fileName=st.nextToken();
    System.out.println("The file name will be: " + fileName);
    File localFile= new File(System.getProperty("user.dir"), fileName);
    fos = new FileOutputStream(localFile);
    try {
        byte[] buf = new byte[1024];
        int i = 0;
        while ((i = is.read(buf)) != -1) {
            fos.write(buf, 0, i);
    } catch (Throwable e) {
        e.printStackTrace();
    } finally {
        if (is != null)
            is.close();
        if (fos != null)
            fos.close();
    }Everything is fine, the file name I get is "e8_java_logo_red.jpg", which is what I expect to get.
    However, if the URL is an indirect link to the file (for example: http://javadl.sun.com/webapps/download/AutoDL?BundleId=37719 , which link to a file named JavaSetup6u18-rv.exe ), the similar code return AutoDL?BundleId=37719 as file name, when I would like to have JavaSetup6u18-rv.exe .
    URL url = new URL("http://javadl.sun.com/webapps/download/AutoDL?BundleId=37719");
    System.out.println("Opening connection to " + url + "...");
    // Copy resource to local file                   
    InputStream is = url.openStream();
    FileOutputStream fos=null;
    String fileName = null;
    StringTokenizer st=new StringTokenizer(url.getFile(), "/");
    while (st.hasMoreTokens())
                    fileName=st.nextToken();
    System.out.println("The file name will be: " + fileName);
    File localFile= new File(System.getProperty("user.dir"), fileName);
    fos = new FileOutputStream(localFile);
    try {
        byte[] buf = new byte[1024];
        int i = 0;
        while ((i = is.read(buf)) != -1) {
            fos.write(buf, 0, i);
    } catch (Throwable e) {
        e.printStackTrace();
    } finally {
        if (is != null)
            is.close();
        if (fos != null)
            fos.close();
    }Do you know how I can do that.
    Thanks for your help
    // JB
    Edited by: jb-from-sydney on Feb 9, 2010 10:37 PM

    Thanks for your answer.
    By following your idea, I found out that one of the header ( content-disposition ) can contain the name to be used if the file is downloaded. Here is the full code that allow you to download locally a file on the Internet:
          * Download locally a file from a given URL.
          * @param url - the url.
          * @param destinationFolder - The destination folder.
          * @return the file
          * @throws IOException Signals that an I/O exception has occurred.
         public static final File downloadFile(URL url, File destinationFolder) throws IOException {
              URLConnection urlC = url.openConnection();
              InputStream is = urlC.getInputStream();
              FileOutputStream fos = null;
              String fileName = getFileName(urlC);
              destinationFolder.mkdirs();
              File localFile = new File(destinationFolder, fileName);
              fos = new FileOutputStream(localFile);
              try {
                   byte[] buf = new byte[1024];
                   int i = 0;
                   while ((i = is.read(buf)) != -1) {
                        fos.write(buf, 0, i);
              } finally {
                   if (is != null)
                        is.close();
                   if (fos != null)
                        fos.close();
              return localFile;
          * Returns the file name associated to an url connection.<br />
          * The result is not a path but just a file name.
          * @param urlC - the url connection
          * @return the file name
          * @throws IOException Signals that an I/O exception has occurred.
         private static final String getFileName(URLConnection urlC) throws IOException {
              String fileName = null;
              String contentDisposition = urlC.getHeaderField("content-disposition");
              if (contentDisposition != null) {
                   fileName = extractFileNameFromContentDisposition(contentDisposition);
              // if the file name cannot be extracted from the content-disposition
              // header, using the url.getFilename() method
              if (fileName == null) {
                   StringTokenizer st = new StringTokenizer(urlC.getURL().getFile(), "/");
                   while (st.hasMoreTokens())
                        fileName = st.nextToken();
              return fileName;
          * Extract the file name from the content disposition header.
          * <p>
          * See <a
          * href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec19.html">http:
          * //www.w3.org/Protocols/rfc2616/rfc2616-sec19.html</a> for detailled
          * information regarding the headers in HTML.
          * @param contentDisposition - the content-disposition header. Cannot be
          *            <code>null>/code>.
          * @return the file name, or <code>null</code> if the content-disposition
          *         header does not contain the filename attribute.
         private static final String extractFileNameFromContentDisposition(
                   String contentDisposition) {
              String[] attributes = contentDisposition.split(";");
              for (String a : attributes) {
                   if (a.toLowerCase().contains("filename")) {
                        // The attribute is the file name. The filename is between
                        // quotes.
                        return a.substring(a.indexOf('\"') + 1, a.lastIndexOf('\"'));
              // not found
              return null;
         }

  • Target file name using Dynamic Configuration

    Hi,
    Currently we have requirement Idoc to File interface.In this scenario if one field exists infile then we have to check and we need to create update directory and  if it is not exist then we should create one more  directory and upload files over there there files should create with timestamp. Since,File system using Sql database so we have used JDBC lookup to check that particaluar field  and if it exists we are passing update to UDF if it is not then we are passing constant Create to that. If we use Adapter Specific Message Attributes  then in reciever side file Communication Channel addtimestap will it consider or do we have to write anything in Udf it self? Could anybody explain on this?Please provide some sample udf .
    Thanks ,
    Aparna.
    Edited by: aparna_karnam on Dec 24, 2011 11:44 AM
    Edited by: aparna_karnam on Dec 24, 2011 11:52 AM

    Hi,   
            I have added little changes to the code you have written, to meet your expectations
    DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
    DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","Directory");
    conf.put(key,"/sap-dev/" +a);
    DynamicConfiguration conf1 = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
    DynamicConfigurationKey key1 = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File", "FileName");
    string filename=conf1.get(key1);
    final String DATE_FORMAT_NOW = "dd-MM-yyyy_HH-mm-ss";
    String s;
    java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat(DATE_FORMAT_NOW);
    java.util.Calendar cal = java.util.Calendar.getInstance();
    s=sdf.format(cal.getTime());
    filename=a+" "+"User_"+s+".txt";
    conf1.put(key1,filename);
    return " ";
    So if value of input variable "a" is "update" then the target directory will be "/sap-dev/update" and the file formed will have name "update User_26-12-2011_01-20-50.txt", of course the date and time values will change depending on server settings. I just showed a sample. one more point, the directory will not be created, you have to create the directories before you run the scenario, only the final directory will be decided depending on value of variable "a". In case you wanna create new directory if directory is not pre-existing then try ticking  on "Create Target Directory" option under "file access parameters" in communication channel. (I have never used this option u can have a try. )
    Now coming to your queries
    1. But whether file type txt automatically it will take or do we have to give in udf it self ?
    ans) You have to put the value in UDF as I have done in code.
    2.    how it will consider timestamp ?
    ans) This has been generated in UDF itself.
    3.  how i can give file extension .txt?
    ans) same as ans 1
    4. And also in Receiver Communication Channel under Adapter Specific Message attributes we have option of file type how it works?
    ans) File type determines is the file you are going to write is of type "text" or "binary". From "Processing Parameters" tab you can select this from drop down menu in communication channel or you can set it through ASMA properties in similar manner as you have done for file name and directory name. For more details refer to http://help.sap.com/saphelp_nw04/helpdata/en/bc/bb79d6061007419a081e58cbeaaf28/content.htm
    http://help.sap.com/saphelp_nwpi71/helpdata/en/44/6830e67f2a6d12e10000000a1553f6/content.htm
    Finally few more points I would like to add
    1) you have  not mentioned the operating system of the server where file is going to form. In case its UNIX/LINUX you are not allowed to use space in the filename. you can consult these links before you decide on file name and directory name in the UDF mentioned above
    http://www.med.nyu.edu/rcr/rcr/nyu_vms/unixfileanddirectorynames.htm     (UNIX)
    http://msdn.microsoft.com/en-us/library/windows/desktop/aa365247(v=vs.85).aspx#naming_conventions  (WINDOWS)
    2) you can alter the string "DATE_FORMAT_NOW" as per your requirement so  that the timestamp appears in the way you want. I have just showed a sample.
    3) Plesae do not forget to tick on the options "Use Adapter-Specific Message Attributes indicator", "Fail If Adapter-Specific Message Attributes Missing", indicators "File Name" and "Directory" under "Define Adapter-Specific Message Attributes." in receiver communication channel.
    Hope this solves your problem.
    Wish my dear forum members and users of SDN
    Merry Christmas and Happy new year (in advance)
    Regards
    Anupam
    N.B:- I initially forgot to add the ".txt" part to the file name. I made necessary corrections in code now.

  • How to get target file name and buffer the incoming messages?

    Hi Experts
    I have one scenarion like
    I wanted to find whether is there any file existing in target folder. If it exists I dont want to overwrite it but I have to buffer the incoming messages in some queue or something like that. And when ever the request comes next time I have to send the data buffered in queue first.
    I dont want to add any time stamp for target file to avoide duplication.
    Can we do this using XI. If yes please suggest me how to achive this.
    Regards
    Sowmya

    >
    Sowmya wrote:
    > Hi Experts
    >
    > I have one scenarion like
    > I wanted to find whether is there any file existing in target folder. If it exists I dont want to overwrite it but I have to buffer the incoming messages in some queue or something like that. And when ever the request comes next time I have to send the data buffered in queue first.
    >
    > I dont want to add any time stamp for target file to avoide duplication.
    >
    > Can we do this using XI. If yes please suggest me how to achive this.
    >
    >
    > Regards
    > Sowmya
    there is no standard way to achieve this. I suggest a redesign.
    post the files to a different directory and write a script which will move the file to the required target directory only if it is not present there.

  • Counter in target file name

    Hi ,
          There is a feature to append a counter value to the file name in the file adapter using NFS protocol , where is this counter value stored in the adapter engine so that the next time a file is created its name has incremented value for the counter. Can that value be stored and accessed using custom module in the receiver adapter for some modification in the standard feature.
    Thanks in advance,
    Pravesh Puria.

    Hi,
    In the "Processing Parameters" section, in the dropdown for "File Constrcution Mode", you can select "Add Counter".  Then, use the "Counter Definition" section to configure tne increment for the counter.  You can also put a prefix before the counter in this configuration.
    Also, by using the section "Adapter-Specific Message Attributes", you can use an user-defined function to create the filename based on your own specific requirement, which can by dynamically determined duirng runtime.
    Regards,
    Bill

  • Target file name - YYMMDD FILE - how to achieve

    Hi guys!
    I need to produce target file in my receiver fila adapter of name, where date is a part of the name. However, it is not a part of message, so there's no way, how to get it from payload.
    Any ideas, how to achieve it?
    example: 070924FILE
    Olian

    Hi Olian
    have a look at this Thread
    mapping UDF
    File Name with extension
    mapping UDF
    Re: convert to julian date
    Thanks !

  • Regarding the file name checking

    Hi ,
         I m using the below program which will upload the XL sheet , here i want to validate the file name which i m selecting from the destop. the file name should be named as "Suresh.XLS", where and how i can do validation for checking the file name..
    I gave the code for the refernce...
      please let me know the solution ASAP..
    REPORT  ZSURESH13062007                         .
    types: begin of ttab ,
          fld1(30) type c,
          fld2(30) type c,
          fld3(30) type c,
          fld4(30) type c,
          fld5(30) type c,
          end of ttab.
    data: itab type table of ttab with header line.
    selection-screen skip 1.
    parameters: p_file type localfile         .
    selection-screen skip 1.
    at selection-screen on value-request for p_file.
      call function 'KD_GET_FILENAME_ON_F4'
           exporting
                static    = 'X'
           changing
                file_name = p_file.
      start-of-SELECTION.
       IF  p_file IS INITIAL.
    MESSAGE S398(00) WITH 'No input file specified.'.
      ELSE.
    clear itab.
        refresh itab.
        PERFORM upload_data.
    loop at itab.
        write:/ itab-fld1, itab-fld2, itab-fld3, itab-fld4, itab-fld5.
      endloop.
      endif.
    form upload_data.
      data: file type  rlgrap-filename.
      data: xcel type table of alsmex_tabline with header line.
      file = p_file.
      call function 'ALSM_EXCEL_TO_INTERNAL_TABLE'
           exporting
                filename                = file
                i_begin_col             = '1'
                i_begin_row             = '1'
                i_end_col               = '200'
                i_end_row               = '5000'
           tables
                intern                  = xcel
           exceptions
                inconsistent_parameters = 1
                upload_ole              = 2
                others                  = 3.
       loop at xcel.
        case xcel-col.
          when '0001'.
            itab-fld1 = xcel-value.
          when '0002'.
            itab-fld2 = xcel-value.
          when '0003'.
            itab-fld3 = xcel-value.
          when '0004'.
            itab-fld4 = xcel-value.
          when '0005'.
            itab-fld5 = xcel-value.
        endcase.
        at end of row.
          append itab.
          clear itab.
        endat.
      endloop.
    ENDFORM.
    Thanks,
    Suresh...

    Hi Suresh,
    Check the Function Modules,
    PC_CHECK_FILENAME_WITH_EXT,
    PC_CHECK_FILENAME.
    Thanks,
    Reward If Helpful.

  • Help in regards to file names when importing to iTunes.

    I recently bought an iPod and I'm dying to use it but at the moment, I can't due to an annoyance I have. I have all my mp3's neatly organized like this: Artist - Song Name.mp3
    The thing is, that's only the file name. I never bothered to modify their ID tags. When I play the songs in iTunes, it sometimes looks like a mess but I didn't mind since I just simply looked for the songs I wanted via the Finder. As you know, to hear tracks on the iPod, you gotta copy your playlist from iTunes so that means that all those tracks with their gibberish names get passed to the iPod. As you can imagine, this is less than convenient as I won't obviously be able to recognize the darn songs. I am further stressed due to the huge amount of songs I have and since it wasn't until recently that I switched to Mac (best decision ever...), I have a huge library of songs that were never identified on my PC. All I did was basically typed in the artist name followed by the song title.
    I browsed through some sites in hopes of finding something that would help me but I have to admit, I barely understand just what I am exactly looking for.
    I would really appreciate your help in any way possible, I'd really like to enjoy my iPod as soon as possible.

    check if this app an help you: http://www.tuneupmedia.com/index.php.
    JGG

  • Regarding dynamic file name

    Hi,
    In the Communication channel We have an option in the File processing parametrs that is File construction mode Here i gave Append, every time the output is appended to the current file, but my requirement is i want to append the data on the date wise, means today(05/09/08) i want only one file, tomorrow(06/09/08) ill get only one file,...
    So in the target side i created one field and at the mapping time i mapped current date to this field, and use this field in the CC, for this I followed this blog
    Solution to the problem encountered using Variable Substitution with XI-SP12
    Here i am getting the output, but the thing is, i am getting the blank line for every file. means i got file with date followed by one blank line again file with date followed by blank line, ......., But i don't want to get that blank line, how to do that ?

    Please check your CC parameters or conversion parameters.You must be adding or leaving some for blanks.

  • Target file of the same name as source file

    Hi,
        I am working on a file to file scenario. I need the target file name to be same as the source file name.
        I checked the adapter specific message attributes in the sender as well as receiver file adapter,and also checked the file name.
        Now am using variable substitution for the file name in the receiver file adapter.
        I defined the variable value as :
        message:FileName
       But no file is getting created in the destination folder.
       Can anyone help me out with this.
    Thanks and regards,
    Pravesh Puria.

    Pravesh,
    If you have selected  File adapter --> Adapter Specfic Attribuest --> File name in the sender and receiver file adapter , then do not go for variable name substittutuion.
    Just make a dummy file name in the receiver file adapter for the file name field and XI will automatically use the same file name as the source when creating the file.
    Regards,
    Bhavesh

Maybe you are looking for

  • Displaying trim box size with Acrobat Reader

    I am looking for a way to have Acrobat Reader display Trim Box size. We have many Customer Service Reps and Sales people who receive PDFs from clients and cannot tell what the Trim Box size is except for asking me. I have Acrobat Pro and can easily f

  • Type ahead function in the implict list

    Dear Experts, I wonder if type ahead function can be added to search implicit list. I have looked for some info but it seems to me that it is not that simple. What I am looking for the same functionality as in the phone book. Any experiecence? Many t

  • Is there any recycling program for mac book batteries?

    Is there a recycling program for the mac book batteries??

  • Break link to style

    I've just had a situation where the font in a masthead has changed. I am guessing that when the masthead was built, a default paragraph style was in place so that the masthead represented style overrides, and that somehow the overrides have been remo

  • DB Adapter calling PL/SQL Procedure gives error

    Created partner link, calling pl/sql procedure with one in variable and one out variable. Invoke works fine. Assigning pl/sql return value to output is causing run time error. "Rebuild" and "Deploy" works file. Here is the error: Assign_2 [2007/08/03