UDF to get the filename for File Sender Adapter

Hi,
I had an requirement to get the  the Filename and map to the  target payload.
I had configured the File Sender Adapter settings in the ID
This is the following UDF i got from SDN.
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;
But when iam using this UDF iam getting an error
RuntimeException in Message-Mapping transformation: Exception:[java.lang.NullPointerException] in class com.sap.xi.tf._MM_ORDER_CRS_OB_SAP_PROXY_IB_ method Filename$[com.sap.aii.mappingtool.tf3.rt.Context@54e154e1]
Please help me in correcting the error.
Thanks
Srinivas

Hi Jayson,
actually, in the interface mapping, it doesn't give exception.
The DynamicConfiguration is a constant retrieved from the container object, so it will never be returned as null (given that the container object was instantiated).
Just the retrieved value will be null (since it was not previously set), but no exception occurs.
In the message mapping, the container object is never instantiated, and that's the reason for the NullPointerException.
Regards,
Henrique.

Similar Messages

  • Need help to Configure FTPS connection for File Sender Adapter

    Hi,
    I want to Configure, FTPS connection (Secured Connection) for File Sender Adapter. Could anyone please guide me, what Information I require to configure. I just want to know what Information should I request the team inorder the configure FTPS so that it can be deployed properly.
    I have checked with [SAP Help Link|http://help.sap.com/saphelp_nw04/helpdata/EN/e3/94007075cae04f930cc4c034e411e1/content.htm] and while configuring the communication channel found that I need Keystore and the X.509 Certificate and Private Key.  which needs to be deployed on the J2EE server by using the Visual Administrator.
    Is there anything else, I need to configure.
    Any help would be appreciated in this regard.
    Thanks & Regards,
    Varun.K

    The basic things are Certificate/Keys which you already know. Usually it is enough for running a sceanrio.
    However, if you have additional requirements, like FTPS for "Connection Security" for encryption, then you may need additional details like commands. Rest all settings are same as FTP.
    Regards,
    Prateek

  • Get filename from file sender adapter

    Hi Experts,
    I have a question regarding the file/ftp adapter (sender).
    I have a directory with xml and pdf files. for every xml file there is a pdf file with the same filename. for example:
    file1.xml
    file1.pdf
    file2.xml
    file2.pdf
    file3.xml
    file3.pdf
    Now I want to read the xml file with the file sender adapter. afterwards I want to read the related pdf file. for example: If I read the file file1.xml afterwards I want to read the pdf file file1.pdf with the file sender adapter. For this it is nessessary to get the filename from the xml file so that I can read afterwards the pdf file. How can I realise it?
    Thanks and best regards
    Christopher

    Hi srinivas,
    thanks for your quick answer.
    That the file adapter is not able to read pdf files is clear to me. In this case I only want to transport the pdf. that works fine. I tested it.
    the problem is the following:
    I have a xml file with the name "file1.xml". I read the xml file with the sender file/ftp adapter configured with filename "*.xml". Then I want to import the pdf file with the name "file1.pdf". Therefor I need the filename from the xml file.do you know what I mean? So XI has to know the filename of the xml to import the pdf with the same name ...
    regards

  • File selection sequence in the FTP connection for File Sender Adapter

    Hi,
    I have a file to Proxy scenario using FTP connection parameters.
    If there are multiple files in the sender folder, XI picks up the files randomly with no processing sequence.
    I want XI to pick up the files based on the date time stamp meaning the  oldest file created in the folder should be processes first and rest all in sequence there after.
    I know processing sequence can be set for NFS connection but not for FTP .
    Please suggest if there's any way to make this work.
    Thanks in advance.
    Thanks and Regards,
    Amit Bhagwat.
    Edited by: Amit Bhagwat on Nov 4, 2009 5:17 AM

    Hi
    For the Transport Protocol "File Transfer Protocol (FTP)" files are always processed in ascending alphabetical order
    If you want the file to be processed in sequence then you can use Quality of Service EOIO in the sender adapter.
    The files are processed in the sequence they are picked up.
    otherwise use BPM for File Sequencing..
    Refer the following Threads
    FTP Sender Adapter - Processing Sequence
    Processing Sequence issue of FTP protocol
    Regards
    Abhijit
    Edited by: Abhijit Bolakhe on Nov 4, 2009 10:32 AM

  • XSLT mapping to retrieve FileName from FILE SENDER adapter

    Hi
    I have an File Sender adapter scenario where I have switched on Adapter-specific message attributes (FileName).
    In my XSLT mapping program I need to RETRIEVE the filename and map it. Can anyone help please?
    Thx in advance

    Hi Bohamo
    Refer the following link.It provides the required solution for you.
    http://help.sap.com/saphelp_nwpi71/helpdata/EN/83/2200cb50d345c793336d9a1683163e/frameset.htm
    Thanks
    Ram

  • Changing source file for file sender adapter in adapter module

    Hi guys!
    3rd party partner send us files, which are not acceptable by file adapter, so we need to implement (I suppose) adapter module in file sender adapter to correct the file format before it is taken by standard adapter. I have no experience in this development field. Could you give me:
    1, whether it is possible (changing file contents before it is taken by standard file sender adapter)
    2. any ideas, where to start with the development (pdf with info etc.)
    Thanx a lot!
    Olian

    <i>2. any ideas, where to start with the development (pdf with info etc.)</i>
    >>>>>
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/02706f11-0d01-0010-e5ae-ac25e74c4c81
    <i>1, whether it is possible (changing file contents before it is taken by standard file sender adapter)</i>
    >>
    yes you can achieve this in the logic in a module

  • SAP PI Table which stores Dynamicconfiguration(filename) for file sender

    Hello All,
    What is the SAP PI table in which SOAP header elements are getting stored. In my scenario, i need to find out the message ID for a specific file name which is picked by file sender, as file name is stored under Dynamicconfiguration of SOAP header node...
    Regards,
    Sreenivas.

    Hi Sreenivas,
    I am not sure if I have understood your requirement correctly but can't you achieve this using a UDF:
    String headerField;
    java.util.Map map;
    AbstractTrace trace=container.getTrace();
    map = container.getTransformationParameters();
    String key = "MessageId";
    headerField = (String) map.get(key);
    return headerField;
    Let us know.
    Regards,
    Shweta

  • Unable to get the filename from file upload UI element

    Hi,
    I added a FileUpload UI element.
    I created an attribute of type resource , assigned to the resource property of the file upload element.
    I created an action button called upload and added the following code.
    try {
           IWDResource resource = wdContext.currentContextElement().getFileupload();
          } catch (Exception e) {
             e.printStackTrace();
    when I debug to see the value of resource it is null.
    Please let me know where I am going wrong.
    Regards,
    Narayani

    Hi,
    Check if there are any space characters in your uploading path (file path).
    First try to upload a file without any space characters in the uploading path(file path). If the problem is with the space characters then use the below encoding & decoding to resolve that issue.
    Encoding while uploading the file:
    // Getting the file resource
    IWDResource resource = element.getCtx_va_FileResource();
    //Getting the resource name
    String resourceName = resource.getResourceName();
    //Encoding the resource name
    String encoderesourceName = java.net.URLEncoder.encode(resourceName,"UTF-8");
    Again while downloading you can use decoder.
    Hope this helps to resolve your issue.
    See this below link.
    Re: File Upload Problem
    Try this encoding even if there are no space characters.
    Regards,
    Charan

  • Quick question, getting the filename of file just loaded by a loader

    How do i detect the file that a loader has just completed?
    I wish to load a series of small files, and am using the loader functions
        url = "image"+index+".png";
        var request:URLRequest = new URLRequest(url);
        loader.load(request);
       loader.contentLoaderInfo.addEventListener(Event.COMPLETE, loadCompleteHandler);
    and then an event handler
        private functionloadCompleteHandler(event:Event):void
              //do stuff
    however, i am firing of a number of these load requests, and do not want to assume they will be complete in the order they were triggered, so I want a way of detecting which load has just been completed, can this be deduced from the even (url field was blank).
    I had an attempt with a custom event handler, but am unsure how to make it trigger on load completion.
    thanks Ben

    hmm, I am trying to get that from the on completion event, as I do not know the order in which events will complete.
    The debugger says the url associated with the event (both target and curretTarget) is NULL and the LoaderUrl points to the main app swf object.
    I simply want to be able to interigate the loadCompleted event, to determine which load completed.
    thanks ben

  • How to get the filename from J2SE File adapter

    In our project scenario , we are using J2EE and J2SE engine both .J2EE for mapping  and J2SE for Deliveying the message .
    In one senario, routing will be based on the filename .
    J2SE Sender File adapter --- XI Adapter --- XI pipe line
    So the File reaching to XI pipelane via J2SE File adapter--> XI adapter.
    When we are using the dynamic configurator in the XI to get the filename
    we are not able to get the file name  becasue it is coming to XI via
    XI adapter.
    How to get the filename ????Hope I am clear about the problem.

    hi,
    try this
    DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
    //obtengo la Key del FileName
    DynamicConfigurationKey keyF = DynamicConfigurationKey.getName();
    http://help.sap.com/javadocs/NW04/current/pi/com/sap/aii/mapping/api/DynamicConfigurationKey.html
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/70c89607-e4d9-2910-7280-f6746e964516
    /people/mohammed.zabiulla/blog/2008/03/26/have-you-ever-tried-to-determine-mail-cc-dynamically
    Hope it helps
    Thanks
    Rodrigo
    Edited by: Rodrigo Pertierra on Apr 11, 2008 9:31 AM

  • To upload the ZIP file and get the filenames available in ZIP file in ABAP

    Hi Experts,
    For my requirement, file from legacy comes as ZIP file with number of files in that.
    Please provide one code sample to upload the ZIP file from local workstation and get the filenames available in ZIP file to check few filename validation checks for the available files in report program.
    Thanks in Advance,
    Regards,
    Basani

    1. Copy the ZIP file into App server
    2. Call function
      call function 'RFC_REMOTE_PIPE'
        destination 'SERVER_EXEC'
        exporting
          command = command  " Unzip command gunzip /path & file
          read = 'X'
        tables
          pipedata = std_lines
    then you can read the files and can validate the file names

  • Dynamic Send Port : The FILE send adapter cannot open file C:\Temp for writing. Details: Access is denied.

    Hi All,
    We have requirement of using ESB toolkit and transforming incoming xml file to edi format. So, we are using ItinerarySelectReceiveXML pipeline for receiving the input from the input location and "EDISend" pipeline for transforming it into EDI and
    send it to destination.
    Now, the receive pipeline is picking up the file, but it is not processed and sent to destination.
    And, we are getting an Access Denied error from Dynamic send port.
    Error Description : 
    The FILE send adapter cannot open file C:\Users\Public\Temp for writing.
     Details: Access is denied.
    Any Immediate solutions/suggestions are appreciated...Thanks.
    Anand

    The difference between dynamic and static port would be send handler. For dynamic port, default send handler will be used and for static port the one configured on the port will be used, could you validate this configuration.
    Also sometimes, administrative privileges are not "real" administrative privileges and company admins will have limited permissions on C Drive folders. Try writing to some other folder to isolate the issue.
    Regards, Ajeet Kumar MCTS Biztalk Server

  • I need to start and stop logging based on a digital input event(or analog if necessary), log data for several seconds prior to the event, and have the data file close at the end of event and increment the filename for the next logging event.

    I don't know if this can be done with VI Logger or need to use Labview V7.1.

    After browsing through the VI Logger User Manual, it looks like the triggering that you are hoping to accomplish is possible. However, incrementing the filename for the next logging event is not going to be possible. VI Logger does exactly what its name tells - logs data. I don't think the automation that you are hoping to accomplish is possible.
    For help with setting up your application, if you do choose to stay with VI Logger, make sure to chek out the Getting Started with VI Logger Manual.
    Best of luck.
    Jared A

  • I am batch processing in PS 2014 (watermark and saving as jpeg from ps file). I get the message for some but not all 'this file needs to be saved as a copy with this option'. And then I have to save it manually. Does anyone know why this happens? (It is j

    I am batch processing in PS 2014 (watermark and saving as jpeg from ps file). I get the message for some but not all 'this file needs to be saved as a copy with this option'. And then I have to save it manually. Does anyone know why this happens? (It is just a plain photoshop file, a watermark is added, then save as jpeg - the jpeg is saved to a different folder than the original photoshop file.)  It happens for about 10 of 30/40  files approximately . Thank you, Kathryn

    I believe I have figured it out - I need to flatten the image, even though there are no layers except for layer 0, first.

  • FILE SENDER ADAPTER -  TO GET A DINAMIC FILE NAME IN THE DIRECTORY

    Hi,
         Please help me.
         I have to read by a file sender adapter a specific file in the directory that its name is Dyyyymmdd, where yyyymmdd is variable according with the current day:
         D      - fixed letter
         yymmdd - year,month and day of the current day.
         I cant´t use D* in the File Name Scheme because I must read only the one file generated in the day.
         How can I configure my file sender adapter to read this especific file in the directory?
          Thanks in advance.
          Mider.

    Hi Krishna,
        I must access only one file by time ( of the current day ), but in the directory I have a lot of them of different dates. I mean, in the of the read ( in the adapter configuration ) , I need to configure the name of the file Dyyyymmdd before of the reading in the directory, in other words, I need to construct the name of file (withe the current date) before the communication channel access the file to read it.
        I think that OS command just can be applicated in file receivers, but if possible, at your purpose, how can I access the name of this especific file via OS command for senders?
        Thanks,
             Mider.
    Message was edited by: Midervilson  Andrade
    Message was edited by: Midervilson  Andrade

Maybe you are looking for