Setting File Name inside ABAP mapping

Hello All,
We have a requirement where we need to send the IDOC in a flat file format to the destination system which we are doing inside an ABAP mapping. Now we need to set the file name depending on a particular field in the IDOC. For this we need to use the DynamicConfigurationKey class inside our ABAP mapping.
Can anyone throw some light how to access these Adapter-Specific Attributes inside ABAP mapping?
Thanks
Abinash

guess this is the one
Re: Abap mapping and variable substitution in File adapter

Similar Messages

  • Run time exception while checking dynamic file name in mesage mapping

    Hi Experts,
    In my file to idoc scenario i need to know the file name dynamicalyy as i require this file name during mesage mapping.
    for that i have created UDF with the following code.
    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);
    but when i am testing this code in mesage mapping in IR i am getting runtime exception.why its giving so ?
    RuntimeException in Message-Mapping transformation: Runtime exception during processing target field mapping /ns0:Messages/ns0:Message1/ORDERS05/IDOC/EDI_DC40/MANDT. The message is: Exception:http://java.lang.NullPointerException in class com.sap.xi.tf._MM_EDI_HospitalsToORDERS05_ method filename$com.sap.aii.mappingtool.tf3.rt.Context@545f545f
    Can we test this in message mapping itself ?
    Best Regards,
    Rohit

    One more question - I hope you didn't forget return statement in your java code.
    this worx 4 sure:
    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;

  • [RFC to File]Problem about Changing file name in message mapping.

    Hi,
    my problem:
        Type:RFC to File
        I change the file name in message mapping.
    when I call the RFC to send the data twice at the same time, both of the output file names are changed while I only want to change the second output file name.
        thanks
    Sam

    In my MM, the input values to these variables (var1, var2 and var3) are (<ZZCOMBI>array,G499999,END_FIFC0029) ,
    var1 is an array of input <ZZCOMBI> item list;
    var2 is get from a property file by call another UDF;
    var3 is constant value.
    the test input data :
    I send the data for the first time:
    - <rfc:Z_IFCFR821_ZIFCTT82100010 xmlns:rfc="urn:sap-com:document:sap:rfc:functions">
    - <T_ZIFCTS82100010>
    - <item>
    <ZZCOMBI>G000002G000002</ZZCOMBI>
    <ZZKYKBN>*</ZZKYKBN>
    <ENAME_VE />
    <ENAME_Z5 />
    </item>
    </T_ZIFCTS82100010>
    </rfc:Z_IFCFR821_ZIFCTT82100010>
    so the input values to these variables (var1, var2 and var3) are (G000002G000002,G499999,END_FIFC0029)
    the output file name(File1) :END_FIFC002920090413-171534-053.dat
    output record: G000002G000002
    because the data what I send is the last record, the system send the dummy data for the second time by program.
    - <rfc:Z_IFCFR821_ZIFCTT82100010 xmlns:rfc="urn:sap-com:document:sap:rfc:functions">
    - <T_ZIFCTS82100010>
    - <item>
    <ZZCOMBI>G499999</ZZCOMBI>
    <ZZKYKBN />
    <ENAME_VE />
    <ENAME_Z5 />
    </item>
    </T_ZIFCTS82100010>
    </rfc:Z_IFCFR821_ZIFCTT82100010>
    so the input values to these variables (var1, var2 and var3) are (G499999,G499999,END_FIFC0029)
    the output file name(File2) :END_FIFC002920090413-171533-928.dat
    output record: G499999
    I find that File2(20090413-171533-928) was ouput before File1(20090413-171534-053 ) from the time stamp.
    I am not sure about that "XI will create a message ID for each message and the messages are independent." as you mentioned above.
    Best regards
    Sam
    Edited by: YONGHE ZHOU on Apr 15, 2009 3:59 AM

  • File Name in Java Map

    Hello,
    I want to add the time stamp in the file name in JAVA map.
    Actually we are directly writing the file on to the file system from Java map and also giving its output to other map.
    So we need when we write the file on the file system the file name should be ABC_timestamp.
    Can anyone help me how to do this in Java Map.
    Thanks and Regards
    Hemant

    Hi,
    >>>Actually we are directly writing the file on to the file system from Java map and also giving its output to other map.
    are you sure you want to do this?
    this is highly inadvisable as mappings do not support restarts and any error handling
    further more what if the mapping will crash but the file will be created?
    if you restart the mapping you will get a second file?
    I'd recomment not doing anything like that - maybe think about your scenario once more ?
    Regards,
    Michal Krawczyk

  • Chain interfaces to set file name in sender channel dynamically

    Hi,
    I have a requirement to use the Seeburger SFTP adapter to import a file from an external server to an SAP ECC system.
    The adapter must be Seeburger as the protocol has to be SFTP, not FTPS as with the File adapter.
    Although I can set a wildcard selection, I really want to poll for specific filenames with predetermined naming criteria.
    The sender SFTP communication channel doesn't provide any options to specify dynamic attributes but I wonder if I can link several interfaces together, please can you confirm if the following process would work conceptually:
    1) SAP ECC program runs and determines the fixed filename that I wish to import (e.g. file_abc123.xml).
    2) SAP ECC program calls an outbound proxy with a mapping to set the relevant parameter in dynamic configuration ('http://seeburger.com/xi' is the namepsace, 'dtSubject' is the parameter name for the filename of the SFTP adapter).  Besides mapping I think the Seeburger attribute mapper module could also be used to set this value.
    3) The outbound proxy is configured on the receiver side to call an SFTP sender channel (with a dummy/blank payload as we're only calling the interface to allow settng of the filename to take place) which links to an inbound service interface on the SAP ECC receiver side. 
    I don't know whether chaining of service interfaces in this fashion (receiving interface also being a sender) is a viable approach or whether there are any alternatives.
    Thanks in advance,
    Alan

    Hi Alan,
    Are the specific file names that you are polling for going to be changing or will they be fixed?  Are each of the unique names going to be processed using the same interface?  If so then I would just create multiple SFTP sender channels that poll at different intervals but use the same mappings, etc.
    Regards,
    Ryan Crosby

  • How to get set file name for MessageFileUploadBean in Advanced Table

    Hello Everyone.
        I have a MessageFileUpload item in a advanced table. My requirement is to show file names instead of view when user uploads files. I know how to do this if the item is not inside advancedtable  (by using  uploadBean.setAttributeValue(DOWNLOAD_FILE_NAME,displayNameBoundValue).
    But how to get the different ID's when inside a advanced table?
    Thanks
    Sunny

    try setting a transient view attribute to this message file upload, if you iterate through vo, I hope you can just get the path user browses.
    Regards
    Shobht S

  • Setting File Name in response

    Hi,
    On server side I read the (Pdf) file and then stream the file content thru response object so that this pdf file opens in browser using Adobe reader. This works just fine.
    And right now, if user wants to save this file in browser, complete jsp url appears as file name in save as dialog box.
    For eg.:
    If my jsp has stream the pdf file from this url
    http://www.xy.com/jsp/displayFileJsp?f=xyz.pdf
    then
    when user tries to save this file, browser save as dialog displays file name as "http://www.xy.com/jsp/displayFileJsp?f=xyz.pdf"
    But I want user should download that file name with specific file name like xyz.pdf.
    I tried to set the content type
    response.setHeader("Content-Disposition", " filename=xyz.pdf" );
    But it didn't work.
    any suggestions ?
    rk

    i have created a zip file and i have to make it downloadable i.e. pop-up box should be invoked. my code is
    try {    
              outFilename = "D:\\Product.zip";
              ZipOutputStream out = new ZipOutputStream(new FileOutputStream(outFilename));
              for (int i=0; i<filenames.length; i++) {
              FileInputStream in = new FileInputStream(filenames);
              out.putNextEntry(new ZipEntry(filenames[i]));
              int len;
              while ((len = in.read(buf)) > 0) {
              out.write(buf, 0, len);
              out.closeEntry();
              in.close();
              out.close();
              catch (IOException e)
                   e.printStackTrace();
              String d1file = outFilename;
              File f1 = new File (d1file);
                   response.setContentType ("text/plain");
                   response.setHeader("Content-Disposition", "attachment;filename=\"" + d1file + "\"");
              try { 
              InputStream in = new FileInputStream(f1);
              ServletOutputStream outs = response.getOutputStream();
              int bit = 256;
                   while ((bit) >= 0)
                        bit = in.read();
                        outs.write(bit);
                   outs.flush();
                   outs.close();
                   in.close();
              catch (IOException ioe)
                   ioe.printStackTrace(System.out);
    it is creating zip file and placing it at D:\\ . I want to invoke download "Save As" pop up box, which is not appearing here! what should I do?

  • How to set file name and destination folder without user interaction

    how can I set the file name and destination folder to generate a pdf file like "c:\myfolder\document.pdf" in this folder automatically.
    Is there a tag in .joboptions ?
    Goal: User click print button. In the background a pdf will be generated in e.g. "C:\myfolder\document.pdf".
    that`s it.
    I know that the query dialog for save as can be turned off. But the file name depends on the application.
    Thanks for your help.
    TK

    Hello,
    Please post this  in  PI forums
    Regards, Anil

  • ** How to get Source File Name thru XSLT Mapping

    Hi friends,
    We require source file name after message processing (SXMB_MONI) in the output structure.  We understad from Forums and  blog 2664, this is possible thru UDF - DynamicConfiguration class. This UDF will work if we use message mapping. But, in our case we are using XSLT mapping. So, how do we call  the same from Java Pacakage ? (Imported Archives). For writing java class separately, what are the changes to be made in the program?
    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;
    Kindly reply, friends.
    Kind Regards,
    Jeg P.

    Hi,
    This is the example in this similar manner u have to call the method in which u have to write the code for picking the source file name.
    <name>
       <xsl:if test="function-available('javamap:concat')">
        <xsl:value-of select="javamap:concat($first, $last, $inputparam)"/>
       </xsl:if>
      </name>
    for reference check the Link,
    http://help.sap.com/saphelp_nw04s/helpdata/en/73/f61eea1741453eb8f794e150067930/frameset.htm
    Regards,
    Phani

  • How to set file names?

    Using TCS 5, RH11, FM12, all patched up, if I set a marker, such as "Filename" in FrameMaker, can RoboHelp use the contents of that marker to set the file name of the HTML file it creates? How? Thoughts?
    Cheers,
    Sean

    Hi,
    Thanks for working with me on this. I appreciate your help. The last time I used RoboHelp was when Blue Sky owned it, at the original version 6. I see it has aged logically.
    Cheers,
    Sean

  • Get the file name using XSLT mapping

    Hi
    How to get the file Name at receiver side using XSLT mapping.
    Could any one please help me
    Regards
    sowmya

    Sowmya
    If you will use Grpahical Mesage Mapping then this can be achieved using Adapter-Specific Attribute u201CFileNameu201D
    http://help.sap.com/saphelp_nw04/helpdata/en/43/03612cdecc6e76e10000000a422035/content.htm
    Code Snippet -->
    DynamicConfiguration conf = (DynamicConfiguration) container
    .getTransformationParameters()
    .get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
    DynamicConfigurationKey key = DynamicConfigurationKey.create(
    u201Chttp://sap.com/xi/XI/System/Fileu201D,
    u201CFileNameu201D);
    But in case you have to ONLY use XSLT mapping then I would suggest to use the same jave code & call it from your XSLT mapping. I never tried such thing you might use couple of jar files too.
    - lalit -

  • Need help in setting file name with special characters in attachment

    Hi
    We have a requirement where we need to set the file name that contains special characters (like Russian) and send mauil using Java mail.
    If we set the file name as such, the attachment in the email contains garbled filename
    Can you pl let me know how to resolve this?
    We should use the file name as attachment name and this will have say special characters. The receiver who gets the mail should get with the correct attachment name
    One important point.. the attachments are opened from MS outlook.
    Thanks and regards
    Ram
    Edited by: 884910 on 13 Sep, 2011 5:00 AM

    Read the FAQ carefully. You don't need to call encodeText unless you're using a really
    old version of JavaMail.
    And, it depends on whether the mail reader you're using is handling encoded parameters
    according to the (new) MIME standard, or according to the (old) non-standard hack.
    Sadly, without knowing what mail reader the recipient is using, it's impossible to use
    encoded filenames that will work everywhere.

  • Set file name with XSLT - receiver channel - elements from XML?

    Dear experts,
    I have an XSLT mapping for a message that is sent via a receiver channel to a customer.
    The customer wants a certain file name which is put toghether by elements from the XML message.
    I have looked at:
    Re: Java Map for writing the file
    The java code and the XSLT work perfectly!
    In the line
    fos = new FileOutputStream(new File("Fixed_" + new Date().getTime() + ".xml"));
    a fixed value, date and time are used for the file name.
    But I need some values from the XML message to create my name. But how do I do that? Can I somehow get values from the XML message through that java function or do I have to adapt the XSLT?
    Can someone please help me!
    Thank you,
    Peter

    Hi Udo, Hello experts,
    Now I do have a problem. I am using this XSL file:
    <?xml version="1.0" encoding="UTF-8"?>
    <xsl:stylesheet version="1.0"
      xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
      xmlns:map="java:java.util.Map"
      xmlns:dyn="java:com.sap.aii.mapping.api.DynamicConfiguration"
      xmlns:key="java:com.sap.aii.mapping.api.DynamicConfigurationKey">
    <xsl:output indent="no" />
    <xsl:param name="inputparam"/>
    <xsl:template match="/">
        <!-- change dynamic configuration -->
        <xsl:variable name="dynamic-conf" 
            select="map:get($inputparam, 'DynamicConfiguration')" />
        <xsl:variable name="dynamic-key"  
            select="key:create('http://sap.com/xi/XI/System/File', 'FileName')" />
        <xsl:variable name="dummy"
            select="dyn:put($dynamic-conf, $dynamic-key, 'TOOLDATA_.xml')" />
      <xsl:copy-of select="." />
    </xsl:template>
    </xsl:stylesheet>
    But then the output file is only named "TOOLDATA_.xml". So I assume the XSL is working.
    And I am using this Java-file:
    package pi_mappings;
    import com.sap.aii.mapping.api.*;
    import java.io.*;
    import java.util.*;
    public class SetFileName extends AbstractTransformation
         static final int BUFFER = 1024*1000;
        private Map param;
        public SetFileName(){  }
         public void setParameter (Map map)
              param = map;
              if (param == null)
                   param = new HashMap();
         public static void main(String args[])
              try
                   InputStream in = new FileInputStream(args[0]);
                   OutputStream out = new FileOutputStream(args[1]);
                   SetFileName sfn = new SetFileName();
                   //sfn.setParameter(mapOfMap);
                   sfn.execute(in, out);
              catch (Exception e)
                        e.printStackTrace();
        public void execute(InputStream inputstream, OutputStream outputstream)
        throws StreamTransformationException {
              try
                   DynamicConfiguration conf = (DynamicConfiguration) param.get("DynamicConfiguration");
                   DynamicConfigurationKey KEY_FILENAME = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","FileName");
                   int len = 0;
                   byte buf[] = new byte[BUFFER];
                   FileOutputStream fos = null;
                   if (conf != null)
                        fos = new FileOutputStream(new File(conf.get(KEY_FILENAME) + new Date().getTime()) ); //sample only
                   else
                        fos = new FileOutputStream(new File("Fixed_" + new Date().getTime() + ".xml"));
                        while ((len = inputstream.read(buf)) > 0)
                             outputstream.write(buf, 0, len);
                             fos.write(buf, 0, len);
                        fos.close();          
              catch(Exception e){ e.printStackTrace();}
         public void transform(TransformationInput arg0, TransformationOutput arg1)
         throws StreamTransformationException {
              getTrace().addInfo("JAVA Mapping Called");
         this.execute(arg0.getInputPayload().getInputStream(), arg1
              .getOutputPayload().getOutputStream());
    Could you please help me find the mistake. I tried to test it locally by changing the main-method but I could not get it to work.
    Thank you very much for any ideas!
    Best regards,
    Peter

  • Setting file name for a downloaded file

    I've set up a file download using code I've gleaned from jsf forums. However, the file name is not being set correctly. When the user downloads File.doc, it shows up as downloadPage.jsf. Am I setting the header correctly?
    public class VendorInfoBean extends AbstractViewController {
        public VendorInfoBean() {
        public String downloadVendorApp() {
            ExternalContext context = getExternalContext();
            String path = context.getInitParameter("externalFiles");
            String filename = "Vendor_Application_e_Form.doc";
            String fullFileName = path + filename;
            File file = new File(fullFileName);
            HttpServletResponse response = (HttpServletResponse) context.getResponse();
            response.setHeader("Content-Disposition", "attachment;filename=\"" + filename + "\"");
            response.setContentLength((int) file.length());
            response.setContentType("application/msword");
            try {
                FileInputStream in = new FileInputStream(file);
                OutputStream out = response.getOutputStream();
                // Copy the contents of the file to the output stream
                byte[] buf = new byte[1024];
                int count;
                while ((count = in.read(buf)) >= 0) {
                    out.write(buf, 0, count);
                in.close();
                //out.write(bytes);
                out.flush();
                out.close();
                FacesContext.getCurrentInstance().responseComplete();
            } catch (IOException ex) {
                ex.printStackTrace();
            return null;
    }

    StringBuffer sbFilename = new StringBuffer();
         sbFilename.append("adeem");
         sbFilename.append(".doc");
    StringBuffer sbContentDispValue = new StringBuffer();
         sbContentDispValue.append("attachment");
         sbContentDispValue.append("; filename=");
         sbContentDispValue.append(sbFilename);
    HttpServletResponse response = (HttpServletResponse) context.getResponse();
    response.setHeader("Content-Disposition", sbContentDispValue.toString());
    i think this will work .. if not let me know i will give some code that will work for u then ...

  • Set file name as a variable. Then use it to name a folder

    I'm making a workflow that I want to get the selected file, then create a new folder using that file's name. I made a workflow as follows:
    Get selected Finder Item (In this case a JPG image)
    Set Value of Variable
    New Folder (dragging the variable from 'Set Value of Variable')
    But running this workflow it adds the path of the file to the new folders name, as well as the file's name (e.g. instead of the folder being called 'Photo1' it's called '/Users/Jono/Desktop/Photo1.jpg').
    Does anybody know how I could get it to just the file name (preferably without the extension) instead of prefixing it with the path?

    The New Folder action uses the specified text for the file name. The following Run AppleScript action will return just the names of the Finder Items passed to it:
    <pre style="
    font-family: Monaco, 'Courier New', Courier, monospace;
    font-size: 10px;
    margin: 0px;
    padding: 5px;
    border: 1px solid #000000;
    width: 720px;
    color: #000000;
    background-color: #FFDDFF;
    overflow: auto;"
    title="this text can be pasted into an Automator 'Run AppleScript' action">
    on run {input, parameters}
    get a name from a file path
    input: a list of Finder Items (aliases)
    output: a list of names
    set output to {}
    repeat with AnItem in the input -- step through each item in the input
    set {name:TheName, name extension:TheExtension} to (info for AnItem)
    if TheExtension is missing value then set TheExtension to ""
    set end of output to (text 1 thru -((count TheExtension) + 2) of TheName) -- just the name part
    end repeat
    return the output -- pass the result(s) to the next action
    end run
    </pre>

Maybe you are looking for

  • Get current logged in user's Apple ID

    Hi, I'm trying to implement a rating feature on an app I'm developing, but it's giving me a problem wich is that every user of the app can rate something one and only one time, wich means I can't use his/her IP nor MAC Address, I need something globa

  • CS5 won't open RAF files from FinePix HS10 & Camera Raw 6.3- Is there something I'm missing??

    Ok- I've bought CS5 Extended and then updated it (including the Camera Raw 6.3 update). I am using a MacBook Pro (and an iMac also). When I try to open the RAF file I get the message "Could not complete your request because Photoshop does not recogni

  • Messages stuck in BPM

    Hi Folks, I am facing issue with BPM. I can see the messsages processed from sender to BPM.But I cann't see any messages processed from BPM to Receiver . Is there is anyway to find the messages which stuck in BPM? I can't see failure messages in MONI

  • How to migrate SAP Bex Query to BO report

    Hi All, I want to migrate some of the reports from Bex Query to SAP BO. Will you suggest me what are the best ways to do this,Whether there are any tools to do this?? Regards, Shiva Kumar G.C

  • More than one summary column in cross tab reports

    Hi, I have a cross tab report.  The summary column is SUM. I want to add another summary column next to SUM which will be AVG(Average) column. Any ideas? Please see the attached image. Thanks,