UDF to read a file name and use some of its contents to map fields in target.

I have a scenario where I need to take the month and year from the file name and map it to suitable fields in the target. Ex - filename_apr2014 from this i should be able to read the month and year and map it. How to do this? I tried the udf -
public String getFileName(Container container){
DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
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;
got this error while testing the mapping -
Runtime exception when processing target-field mapping /ns0:MT_<<>>_Output/I<<>>; root message: Exception:[java.lang.NullPointerException: while trying to invoke the method com.sap.aii.mapping.api.DynamicConfiguration.get(com.sap.aii.mapping.api.DynamicConfigurationKey) of a null object loaded from a local variable at slot 2] in class <<>> method getSourceFileName[com.sap.aii.mappingtool.tf7.rt.Context@5b04fc0f]
See error logs for details  

Hi Satish - You declared "conf" twice.
DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
UDF -
String filename    = "";
DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
DynamicConfigurationKey key = DynamicConfigurationKey.create( "http:/"+"/sap.com/xi/XI/System/File","FileName");
filename = conf.get(key);
return filename;
And did you define the variable slot 2 in any of your UDF's?
The above UDF return the filename and you should handle the sub string later..

Similar Messages

  • When importing photos with iBooks Gallery widget, is anyone aware of a technique for simultaneously importing the photo's description (or jpeg file name) and writing it into the iBook Author caption field for the imported photo?

    When importing photos with the iBooks Author Gallery widget, is anyone aware of a technique for simultaneously importing the photo's description (or jpeg file name) and writing it into the iBook Author caption field for the corresponding imported photo? I have 4,800 stills to import and can't imagine it's necessary to copy and paste the description for each.

    As always, feel free to use the 'Provide iBooks Author Feedback' menu item for features you'd like added in the future, etc.
    http://www.apple.com/feedback/ibooks-author.html
    As for AS, I'm not sure anyone has sniffed iBA's dictionary yet...google is you friend for hot prospects, I'm sure

  • Read in file name + path using command line arguments

    Hi guys,
    I am trying to use command line arguments to read in the name of two files. The code below works as long as the files are on the class path.
    public class cmdLineArguments {
         public static void main(String[] args) {
              String xmlFile1 = args[0];
                    String xmlFile2 = args[1];
              System.out.println ("\nXmlFile1: " + args[0] + "\nXmlFile2: " + args[1]);
    }I would like to be able to read files that are not on the class path as well by entering their full path along with their names.
    In other words, It works if I type:
    C:\Documents and Settings\user\workspace\CmdLineArgs\src>java cmdLineArgs file1.xml file2.xmlbut not if I type:
    C:\Documents and Settings\user\workspace\CmdLineArgs\src>java cmdLineArgs c:\Documents and Settings\user\desktop\file1.xml c:\Documents and Settings\user\desktop\file2.xmlWould anyone please explain how I can edit the code to make it work? I guess I could take them both as a String, modify them manually (add a \ to it etc) but is there an easier way to do it? Even a reference to a tutorial, article etc about this would be very much appreciated.
    Also, any idea why a code would compile and run fine in Eclipse but would create an error from command line?
    Thanks a lot.

    You need to learn about cmd.exe which is used to process the command line. The arguments passed to any program is the command line split at white space so your command line arguments of
    c:\Documents and Settings\user\desktop\file1.xml c:\Documents and Settings\user\desktop\file2.xmlis turned into an array of
    "c:\Documents", "and", "Settings\user\desktop\file1.xml", "c:\Documents", "and", "Settings\user\desktop\file2.xml"In other words instead of 2 arguments you actually have 6.
    To get round this the file names need to be quoted
    java cmdLineArgs "c:\Documents and Settings\user\desktop\file1.xml" "c:\Documents and Settings\user\desktop\file2.xml"

  • How to read a file name and send it a particular reciever

    Hi,
    I have a scenario, where i am receiving a a file and based on the file name i have to decide who is the receiver and send it to that particular receiver.I do not have to do any mapping.
    can someone suggest me how can I achieve this.
    Thanks in advance.

    HI This may help you.Let me know if not.
    Step by Step Guide: XML File 2 XML File Scenario: Part I
    Step by Step Guide: XML File 2 XML File Scenario: Part II
    Converting XML to PDF using XI
    Introduction to simple(File-XI-File)scenario and complete walk through for starters(Part1)
    Introduction to simple (File-XI-File)scenario and complete walk through for starters(Part2)
    "JAVA MAPPING", an alternate way of reading a CSV file
    Dynamic File Name using XI 3.0 SP12 Part - I
    Dynamic file name(XSLT Mapping with Java Enhancement) using XI 3.0 SP12 Part -II
    Push Data to MVC Architectured application using XI
    How to send any data (even binary) through XI, without using the Integration Repository
    XI in the role of a FTP
    The specified item was not found.
    The specified item was not found.
    The specified item was not found.
    The specified item was not found.

  • Finding File Name And Using It To Place The Graphic Using VBscript

    I'm trying to find a file name (example, <place:E:\logo.tif>) in each text frame if it's there, then remove the text from the frame and then place the file in the frame. This is to get around the feature missing from InDesign that is in PageMaker that allowed you to import inline graphics using tagged text. Below is what I have come up with so far. The file name is currently hard coded in the example below.
    Thanks,
    Archie
    For I = 1 to cInt(myMountNumber)
    Set myTextFrames = myDocument.TextFrames
    Set myCurrentFrame = myTextFrames.Item(I)
    If myCurrentFrame.Texts.ItemByRange (1,7).Contents = "<Place:" Then
    Set myLastCharacter = myCurrentFrame.Characters.Item(-2)
    myCurrentFrame.Texts.ItemByRange (1,myLastCharacter).Item(1).Contents = ""
    myCurrentFrame.InsertionPoints.Item(1).Place ("E:\sxs\pm65\Sundco.jpg")
    myCurrentFrame.Fit idFitOptions.idProportionally
    End If
    Next

    ' For I = 1 to cInt(myMountNumber)<br />For I = 1 to myDoc.TextFrames.Counts<br />' I think your myMountNumber is equal to TextFramesCount<br /><br />' Set myTextFrames = myDocument.TextFrames<br />' Set myCurrentFrame = myTextFrames.Item(I)<br />' you don't need to get reference to ALL TextFrames in EACH iteration<br /><br />Set myCurrentFrame = myDocument.TextFrames.Item(I)<br />' get reference to Ith TextFrame in document<br /><br />' If myCurrentFrame.Texts.ItemByRange (1,7).Contents = "<Place:" Then<br />If left(myCurrentFrame.Texts.Item(1).Contents,7) = "<Place:" Then<br />' looks better and should be faster<br /><br />   ' Set myLastCharacter = myCurrentFrame.Characters.Item(-2)<br />   ' myCurrentFrame.Texts.ItemByRange (1,myLastCharacter).Item(1).Contents = ""<br />   ' you don't need these lines - you will delete contents in PLACE line<br />   <br />   ' myCurrentFrame.InsertionPoints.Item(1).Place ("E:\sxs\pm65\Sundco.jpg")<br /><br />   myFile = Mid(myCurrentFrame.Texts.Item(1),8)<br />   ' get all after "<Place:"<br /><br />   myFile = Split(myFile,">")(0) ' get all to ">"<br />   ' small trick ;) when split - get array - but we can use (0) to refere to first element<br /><br />   myCurrentFrame.Texts.Item(1).Place(myFile)<br />   myCurrentFrame.Fit idFitOptions.idProportionally<br />End If<br /><br />Next<br /><br />and I don't think that iterating TextFrames collection is good way ...<br />you should iterate Stories collection and refer to first TextFrame - unles you are sure what you are doing ;) and you have Stories where each TextFrame will have image inside ...<br /><br />robin<br /><br />-- <br />www.adobescripts.com

  • DMS - file name and extension

    Hi everybody,
    I will appreciate if somebody could tell me how to read the file name and extension of already uploaded to DMS document (a function module will be best but name of db table is ok too). Is this information stored in SAP DB at all?
    Thanks
    Ogniana

    Check
    http://help.sap.com/saphelp_erp2004/helpdata/en/c6/893d55449311d1893e0000e8323c4f/content.htm
    Regards,
    Santosh

  • How can I have uploaded pictures to iPhone or iPad be sorted by file name. Used to be able to based on their folders, but it no longer works and puts pictures in random order, I guess by date, which doesn't work for me. Need them by file name.

    Using windows. In the past I was able to have the picutres sorted in files and by file name and that is how they showed in the phone or pad. Not long ago one of the itune updates changed so it sorted by date and the the another update changed so it went by file name. Well when I got a new computer and updated itunes it won't load pictures in correct order. Is there an option I'm missing or is this an option that Apple should have for how you want pictures sorted?

    SELECT     datapoint,
               sub_total,
               section
    FROM       report_table
    WHERE      datapoint IN
                   (SELECT   datapoint
                    FROM     report_table
                    WHERE    section IN ('027', '038', '042', '044', '006', '008', '011', '022', '023')
                    AND      report_name = :selected_report_name
                    GROUP BY datapoint
                    HAVING SUM(CASE WHEN section IN ('027', '038', '042', '0440') THEN 1 ELSE 0 END)
                        <> SUM(CASE WHEN section IN ('008', '011', '022', '023') THEN 1 ELSE 0 END))
    ORDER BY   datapoint;

  • Make "File name" and "Files of type" fields read-only in JFileChooser

    I try to make the "File name" and "Files of type" fields read-only in JFileChooser dialog. Anybody
    knows how to do? Thanks.

    You mean so the user can't choose the name of the file to open or save? Not much point in even using a JFileChooser, then, is there? Or did I misunderstand the question?

  • WCF Service and Sharepoint Form library : How i can read a access a form libray and query a item from file name and read form xml in WCF service ?

    WCF Service and Sharepoint Form library : How i can read or access a form libray and query a item from file name and read form xml in WCF service ?
    Ahsan Ranjha

    Hi,
    In SharePoint 2013, we can take use of REST API or Client Object Model to access the SharePoint objects like Form Library.
    SharePoint 2013 REST API
    http://msdn.microsoft.com/en-us/library/office/dn450841(v=office.15).aspx
    http://blogs.technet.com/b/fromthefield/archive/2013/09/05/working-with-sharepoint-list-data-odata-rest-and-javascript.aspx
    SharePoint 2013 Client Object Model
    http://msdn.microsoft.com/en-us/library/office/fp179912(v=office.15).aspx
    http://msdn.microsoft.com/en-us/library/office/jj193041(v=office.15).aspx
    With the retrieved file, we can then use XmlDocument object to parse it and get the values you want:
    http://weblogs.asp.net/jimjackson/opening-and-reading-an-xml-file-in-a-document-library
    http://stackoverflow.com/questions/1968809/programatically-edit-infopath-form-fields
    Best regards
    Patrick Liang
    TechNet Community Support

  • I can not download any files using Safari ? when I choose to download application file the URL include the file name and stop responding. Any help??

    I can not download any files using Safari ? when I choose to download application file the URL include the file name and stop responding. Any help??

    Please read this whole message before doing anything.
    This procedure is a test, not a solution. Don’t be disappointed when you find that nothing has changed after you complete it.
    Step 1
    The purpose of this step is to determine whether the problem is localized to your user account.
    Enable guest logins* and log in as Guest. For instructions, launch the System Preferences application, select Help from the menu bar, and enter “Set up a guest account” (without the quotes) in the search box.
    While logged in as Guest, you won’t have access to any of your personal files or settings. Applications will behave as if you were running them for the first time. Don’t be alarmed by this; it’s normal. If you need any passwords or other personal data in order to complete the test, memorize, print, or write them down before you begin.
    Test while logged in as Guest. Same problem(s)?
    After testing, log out of the guest account and, in your own account, disable it if you wish. Any files you created in the guest account will be deleted automatically when you log out of it.
    *Note: If you’ve activated “Find My Mac” or FileVault in Mac OS X 10.7 or later, then you can’t enable the Guest account. The Guest login created by “Find My Mac” is not the same. Create a new account in which to test, and delete it, including its home folder, after testing.
    Step 2
    The purpose of this step is to determine whether the problem is caused by third-party system modifications that load automatically at startup or login.
    Disconnect all wired peripherals except those needed for the test, and remove all aftermarket expansion cards. Boot in safe mode* and log in to the account with the problem. The instructions provided by Apple are as follows:
    Be sure your Mac is shut down.
    Press the power button.
    Immediately after you hear the startup tone, hold the Shift key. The Shift key should be held as soon as possible after the startup tone, but not before the tone.
    Release the Shift key when you see the gray Apple icon and the progress indicator (looks like a spinning gear).
    Safe mode is much slower to boot and run than normal, and some things won’t work at all, including wireless networking on certain Macs.
    The login screen appears even if you usually log in automatically. You must know your login password in order to log in. If you’ve forgotten the password, you will need to reset it before you begin.
    *Note: If FileVault is enabled under Mac OS X 10.7 or later, you can’t boot in safe mode.
    Test while in safe mode. Same problem(s)?
    After testing, reboot as usual (i.e., not in safe mode) and verify that you still have the problem. Post the results of steps 1 and 2.

  • Dynamic File Name and File size

    Hi All
    I need some help in calling Dynamic File Name and Dynamic File size of a file in my adapter Module.
    Could you please provided some help on the same?
    I have tried the same through UDF it is working. Could anyone provide me the steps for the same
    Regards
    Abhishek Mahajan

    Hi,
    You can use the already available adapter module "DynamicConfigurationBean". Have this adapter module at the top of the module list in CC.
    Have the parameter value as insert http://sap.com/xi/XI/System/File FileName and http://sap.com/xi/XI/System/File SourceFileSize (corresponding to the key names)
    For more info:
    http://help.sap.com/saphelp_nw04/helpdata/en/45/da2239feb22e98e10000000a155369/frameset.htm
    There is also a SAP note available for the same....dont remember the note number:(.....
    Regards,
    Abhishek.

  • Pdf portfolio source file name and date in file details

    Is it possible to import the source file name and extension as well as the source file created date in the portfolio file details?  Need to document source to portfolio in working with 3rd parties that will only have the original source.  Need to document what was converted into pdf as not all files in a directory will successfully convert to pdf.  Sometimes need to convert 100's of files.  Manual entry is inefficient.  the file names and modified dates are displayed on the Combine Files dialog.  is there a way to capture the detail on that page?

    I don't need the detail of when the pdf was added to the portfolio.  I
    need know which dwg or jpg or word file was converted and the original
    created date of that file for control of information.
    That is impossible; sorry. For some *very specific* types of conversion to PDF the pdfx:SourceModified XMP tag will be set to show the last-modification date of the source file (for example DOCX files converted using MS Word), but there will never be a human-readable record of the source filename or its creation date unless you have manually added them as document XMP properties after conversion (this is what the "Custom Properties" dialog is for). To embed source data automatically would raise no end of privacy and security problems for customers, who most certainly do NOT want their recipients seeing details of internal documents.
    Without writing a plugin there's no access to the internal workflow of the Combine Files dialog, so you cannot use a script to read the names and dates of the files *before* conversion and store them automatically in the new PDF Portfolio's Fields array.

  • How to read dynamic file names in RSEINB00?

    Hi, ABAP Gurus,
    actually I'm a PI Consultant. Now I have a scenario to use the report RSEINB00.
    In the Applicaton Server i put ASCII IDocs with the following name convension: <static name>+<time stemple>:
    SAPIDOC20111127-224128-952.txt
    SAPIDOC20111127-224129-115.txt
    I created a new port in WE21 and the Outbound file and Inbound fiel tabs haben the same configration:
    physical directory: /ABC/DEV100/inbound/
    Function module: EDI_PATH_CREATE_DATE_TIME
    Inbound file: SAPIDOC.txt
    To execute the report RSEINB00 I must give the complete file name and port. It is not convenient.
    My target is, with a job to run RSEINB00 once daily to read all files with name "SAPIDOC + <time stemple>" full automatically.
    Is it possible? how to figure it out?
    thanks a lot in advance! <removed by moderator>.
    Regards
    Rene
    Edited by: Thomas Zloch on Nov 29, 2011 5:23 PM

    with the extension of the standard report RSEINB00 i solved this problem. here is some code:
    DATA:
      dir_name  LIKE  epsf-epsdirnam,
      file_mask LIKE  epsf-epsfilnam,
      g_message_fields LIKE edimessage.
    DATA:
      filename LIKE  edi_path-pthnam,
      filename2 LIKE edi_path-pthnam,
      myport TYPE EDIPO-PORT.
    DATA: h_EDIDC     LIKE EDIDC.
    DATA:
      wa TYPE file_table.
    DATA:
      t_dir_list TYPE STANDARD TABLE OF epsfili WITH HEADER LINE,
      itab TYPE table of file_table WITH HEADER LINE.
    *The directoy, where the Markant ASCII IDocs are droped by XI.
    dir_name = '<.../inbound>'.
    *File mask of ASCII IDocs.
    file_mask = 'XYIDOC.'.
    *File port.
    myport = '<Portname>'.
    CALL FUNCTION 'EPS_GET_DIRECTORY_LISTING'
      EXPORTING
        dir_name               = dir_name
        file_mask              = file_mask
      TABLES
        dir_list               = t_dir_list
      EXCEPTIONS
        invalid_eps_subdir     = 1
        sapgparam_failed       = 2
        build_directory_failed = 3
        no_authorization       = 4
        read_directory_failed  = 5
        too_many_read_errors   = 6
        empty_directory_list   = 7
        OTHERS                 = 8.
    IF sy-subrc <> 0.
      MESSAGE e600(fr) WITH 'No ASCII IDoc exits'.
    ENDIF.
    "BREAK-POINT.
    *The old ASCII IDocs are stored in a dataset and copied with new file name sent_<original name>
    LOOP AT t_dir_list.
      CONCATENATE dir_name '/' t_dir_list-name INTO filename.
      CONCATENATE dir_name '/sent_' t_dir_list-name INTO filename2.
    open dataset filename for input in text mode.
    open dataset filename2 for output in text mode.
    if sy-subrc = 0.
      do.
        read dataset filename into wa.
          if sy-subrc <> 0.
           exit.
          endif.
      transfer wa to filename2.
         append wa to itab.
           enddo.
    endif.
    close dataset filename.
    *loop at itab into wa.
    transfer wa to filename2.
    *endloop.
    close dataset filename2.
      PERFORM inbound_processing USING filename.
    ENDLOOP.
    *&      Form  inbound_processing
    FORM inbound_processing USING filename TYPE edi_path-pthnam.
    do inbound processing from file
      CALL FUNCTION 'IDOC_INBOUND_FROM_FILE'
        EXPORTING
          file_name            = filename
          port                 = myport
        EXCEPTIONS
          file_open_failed     = 1
          marker_to_be_deleted = 2
          read_file_failed     = 3
          idoc_not_stored      = 4
          file_delete_failed   = 5
          marker_modify_failed = 6
          event_create_failed  = 7
          first_record_invalid = 8
          invalid_record       = 9
          OTHERS               = 10.
      IF sy-subrc <> 0.
    fill message fields for exception handling from system fields
        MOVE-CORRESPONDING sy TO g_message_fields.
    error handling using the 3.0 business workflow
        CALL FUNCTION 'IDOC_ERROR_WORKFLOW_START'
          EXPORTING
            docnum                  = 0
            eventcode               = 'EDIM'
            mess                    = g_message_fields
          EXCEPTIONS
            no_entry_in_tede5       = 0
            error_in_start_workflow = 0
            OTHERS                  = 0.
    do not care for exceptions here
        COMMIT WORK.
    append message for RFC
        MESSAGE ID     g_message_fields-msgid
                TYPE   'A'
                NUMBER g_message_fields-msgno
                WITH   g_message_fields-msgv1 g_message_fields-msgv2
                       g_message_fields-msgv3 g_message_fields-msgv4.
      ENDIF.
    ENDFORM.                    "inbound_processing

  • File name and path should be passed as parameter

    hi all,
    i am writing a set of statements into the text file. But i have to pass the file name and also path as a user enterable parameter.
    please suggest me to proceed further.
    for ex: i am storing it as
    output:=text_io.fopen(c:abc\def\out.txt','w');
    right now i am giving like this and storing the data, but now i have to allow file name and path as user parameter.
    please suggest me.
    Thanks..

    Hi,
    for ex: i am storing it as
    output:=text_io.fopen(c:abc\def\out.txt','w');
    right now i am giving like this and storing the data, but now i have to allow file name and path as user parameter.
    please suggest me.Well, how hard can it be?
    You have to get those two parameters from your application into two variables, say "v_filename" and "v_pathname", and then create the file just the same way using the variables to construct the full path :
    output:=text_io.fopen(v_pathname || '\' || v_filename,'w');

  • File Name and File Content  not gettinng passed from Proxy to Business Serv

    Hi All ,
    I have a requirement in OSB , where i need to pick the file from remote Source and FTP the files to Remote Target .Below are the steps which i did to achieve this.
    1.Created a FTP Adapter in JDeveloper to Get the files from Source and a FTP Adpater to Put the files to Target.Inboth the adapters i have choose 'Shema is Opaque'
    2.Imported the wsdl and jca file to OSB
    3.Generated Proxy Service (PS ) and Business service (BS) out of Step 2
    4.I edited the Message flow such a way that , the PS is routed to invoke the BS
    Aslo i assigned $inbound/ctx:transport/ctx:request/tp:headers/jca:jca.file.FileName to a variable 'FileName' in PS
    and in BS service i passed $outbound/ctx:transport/ctx:request/tp:headers/jca:jca.ftp.FileName = 'FileName'
    When i tried to activate my session , the file that is getting written to the target has 0 byte.Also , the file name is also not getting passed from PS to BS
    Can some one help me with the steps on how to use the Xpath , so as to pass the file name and file body from proxy servive to business service.
    Thanks
    John

     I search multiple shares to find a common file name then create a single output file. I will be doing this search and file creation
    for 5-10 different file names. If there is a better way .. certainly open for suggestions. It's working but having issue with
    the cmd file for every file and folder I check. It puts this error out for each run of the process.
      Error message in LOG file:
    Get-ChildItem : Cannot find path 'F:\powershell\-SearchFor' because it does not exist.
     Thanks.
    I tried your code with little changes and saved in Temp folder.
    My CMD file has the below code
    PowerShell C:\Temp\Untitled1.ps1
    It worked.
    Regards Chen V [MCTS SharePoint 2010]

Maybe you are looking for

  • How do I use the built-in audio input with AU Lab?

    I just tried AU Lab for the first time, and I can't select an audio input. The "Create New Document" window lets me choose "Built-in Output", but the pulldown for Input Source is greyed out. The area under the "Input" button says, "Audio Input Not Su

  • Using adjustment layers to only one layer

    I know how to use an adjustment layer - it goes directly over the layer I'm editing and I'm able to edit the colour (such as hue etc). The trouble is, anything below that adjustment layer then gets affected. Is there any way I am able to make this ad

  • IS THERE AN ADD ON THAT LISTS YOUTUBE PLAYLISTS IN ALPHABETICAL ORDER?

    I WANT TO GO INTO MY YOUTUBE PLAYLIST AND BE ABLE TO MAKE THE LIST ALPHABETICAL!!! IS THERE AN ADD-ON FOR THIS? OR DOES ANYONE KNOW HOW TO MAKE THIS HAPPEN. HAVE MANY VIDEOS AND I'M TIRED OF TRYING TO FIND WHAT I WANT. ALPHABETICAL LISTING IS VERY QU

  • Clean install / time machine / reinstall

    Just came back from Genius bar where we did a clean install & reinstalled my apps only.  When I came home I 'entered' Time Machine (top left); selected most recent backup (from Genius Bar this morning) & let it run.  Came back; laptop was asleep; my

  • Best Views to Lovs

    Dear All sometimes i use View Objects based on EOS to be used in List of values, and sometimes i use View Objects in expert Mode (View Object without EO), which one better any why ? thanks