UDF for getting File Name and updating in target as reference value

Dear All,
I am working on File-PI-RFC interface. In one of the columns of RFC, I need to pass the File Name as reference.
Kindly guide me on which UDF can be used for this requirement.
Regards,
NJ

Hi Nishu Jain,
Basically my requirement to get Filename in idoc segments in order to validate the posting at month end.
Its an File to idoc scenario- GL Posting.
Please check attached UDF and it gives error. Kindly help. Thanks

Similar Messages

  • Get file name and path from  adf inputFile

    Hi,
    I use adf's inputFile component. I need to get the file name and filePath. Does anyone knows how to do that?
    Thanks in advance

    You may bind the value to an UploadedFile object and get the name from this object.
    You may use a valueChangeListener backin bean method or a managed bean.
    Here the code i just write for something similar. Note that i'm not able to test it because of a bug in 10.1.3.1 with inputFile and web.xml parameters. I still waiting for the patch.
    public void uploadedFile(ValueChangeEvent valueChangeEvent) throws IOException,
    Exception {
    final int BUFFER = 2048;
    byte data[] = new byte[BUFFER];
    int currentByte;
    String fileName;
    UploadedFile uploadedFile =
    (UploadedFile)valueChangeEvent.getNewValue();
    if (uploadedFile != null) {
    String mimeType = uploadedFile.getContentType();
    if (mimeType == "application/x-zip-compressed") {
    // get the uploaded file as a zip file
    ZipFile zipFile = new ZipFile(uploadedFile.getFilename());
    // verify the zip archive contains only one entry
    if (zipFile.size() != 1) {
    FacesContext context =
    FacesContext.getCurrentInstance();
    ResourceBundle errorMessage =
    ResourceBundle.getBundle(context.getApplication().getMessageBundle());
    Exception ZipFileContentException =
    new Exception(errorMessage.getString("error.fileUpload.zipFileContent.moreThanOneEntry").replace("{0}",
    String.valueOf(zipFile.size())));
    throw ZipFileContentException;
    // get the entries in the zip file even it is only one
    Enumeration zipFileEntries = zipFile.entries();
    // Process each entry
    while (zipFileEntries.hasMoreElements()) {
    // grab a zip file entry
    ZipEntry entry =
    (ZipEntry)zipFileEntries.nextElement();
    // check the entry is not a directory
    if (entry.isDirectory()) {
    Exception ZipFileContentException =
    new Exception(JSFUtils.getStringFromBundle("error.fileUpload.zipFileContent.isDirectoryInsteadFile"));
    throw ZipFileContentException;
    File destFile = new File(entry.getName());
    Magic magic = new Magic();
    // getMagicMatch accepts Files or byte[],
    // which is nice if you want to test streams
    MagicMatch match = magic.getMagicMatch(destFile, true);
    if (match.getMimeType() != "application/xml") {
    Exception ZipFileContentException =
    new Exception(JSFUtils.getStringFromBundle("error.fileUpload.isNotXMLFile").replace("{0}",
    match.getMimeType()));
    throw ZipFileContentException;
    //TODO get the repository directory from classification-param.xml
    BufferedInputStream is =
    new BufferedInputStream(zipFile.getInputStream(entry));
    FileOutputStream fos = new FileOutputStream(destFile);
    BufferedOutputStream dest =
    new BufferedOutputStream(fos, BUFFER);
    // read and write until last byte is encountered
    while ((currentByte = is.read(data, 0, BUFFER)) !=
    -1) {
    dest.write(data, 0, currentByte);
    dest.flush();
    dest.close();
    is.close();
    zipFile.close();
    } else if (mimeType == "application/xml") {
    String currentEntry = uploadedFile.getFilename();
    File destFile = new File(currentEntry);
    BufferedInputStream is =
    new BufferedInputStream(uploadedFile.getInputStream());
    FileOutputStream fos = new FileOutputStream(destFile);
    BufferedOutputStream dest =
    new BufferedOutputStream(fos, BUFFER);
    // read and write until last byte is encountered
    while ((currentByte = is.read(data, 0, BUFFER)) != -1) {
    dest.write(data, 0, currentByte);
    dest.flush();
    dest.close();
    is.close();
    } else {
    Exception ZipFileContentException =
    new Exception(JSFUtils.getStringFromBundle("error.fileUpload.isNotXMLFile").replace("{0}",
    mimeType));
    throw ZipFileContentException;
    }

  • How to get file name and set it as static text in a dialog

    Hi,
    I m new to InDesign Programming.
    I have a menu that creates a dialog with different controls in it.
    The dialog will appear only if there is an open file. I need to display the name of the open file as a static text in the dialog. I know to get the name of the current file but don't know how to pass this each time the dialog is opened.
    Can someone help me in doing this?
    I m using InDesign CS3 in MAC OS.
    Thank You.

    those are the methods, but you can't use getCharacterEncoding(), actually, cuz it seems it's not necessarily filled in.. or at least that might be on some servers only, like Tomcat 4. As for encodings, you need to do a search for character encoding names and use the appropriate one.

  • Need to get file name and directory back from file adapter - WRITE

    I am using the file adapter to write a file. I want to log the file name of the file we just created. Since we use a precise timestamp in the file name, I can't accurately guess.
    I have an invoke in my BPEL process to the file adapter. My first try was to assign the jca.file.FileName property to a variable, but it never comes back. I looked around and saw plenty of ways to SET the file name for a write and GET the file name for a read, but no GET file name for WRITE.
    Anyone have a solution?
    Thanks in advance!

    I think I got your point... You can tell FileAdapter the filename to write, but if you don't then FileAdapter can not tell you the filename that it wrote... I think it is pretty possible Oracle didn't implement the latter, as the write operation is probably asynchronous and the filename is calculated later on...
    If what you want is just log, you may achieve your requirement by increasing verbosity on Adapter logs... Have a look at the link bellow...
    http://docs.oracle.com/cd/E15586_01/integration.1111/e10226/ad_mon.htm#CJHHBBID
    Otherwise, the solution for you will be to calculate filename yourself, and that will be a little bit of reinventing the wheel... But at least you will know the filename...
    Cheers,
    Vlad

  • Ho to get file name and full path of a local file

    I want to be able to get the file name and it's full path of
    a local file. I was thinking of using "FileReference" but
    FileReference doesn't permint accessing the local file path. Can
    anyone suggest a way of doing this.
    Thanks

    You will have to create 2 different versions.
    See this example we have created using JSystem
    http://jsystem.flashjester.com
    Download the example file provided.
    Hope this helps.
    Regards
    FlashJester Support Team
    e. - [email protected]
    w. - www.flashjester.com
    "This has been one of the most impressive and thoroughly
    pleasant
    experiences of customer support I have ever come across -
    astounding!"
    Director - hedgeapple

  • UDF for Changing File Name

    Hi Experts,
    I am working on one scenrio, where i am fetching the file name dynamically by adapter module.
    Now, the file name needs to be checked for the following conditions:
    BOOKING_REF_DELIVERYNO_WB.pdf
    BOOKING_REF_DELIVERYNO_BOLCOPY.PDF
    DELIVERYNO_AWB.PDF
    Depending upon the type of file being picked up by PI from the mail box,following needs to be done:
    1.time stamp needs to be added ..
    ex..
    for file SO10162239_123_458_BOLCOPY.pdf--> the file name must be changed to :
    SO10162239_X2100_20101206_123_458_BOLCOPY.pdf.
    Please suggest if this can be done by graphical mapping ?
    Thanks,
    Sushama

    hi,
    I am using following UDF..
    FileName->ParseFile>getNykFilename>concat--
    Current date->                                                                   concat> Trim> FileName
                               concat----
    |
    constatnt[.pdf]--->
    UDF for parse file:
    String[] sarray;
    String regex = "\"";
    String retstring;
    String fname;
    int l= raw.length();
    try {
         sarray = raw.split(regex, 3);
         retstring = sarray[1];
                            fname=sarray[l-1];
            if( fname=="WB")
    raw.concat("_X2100_");
    else if (fname=="BOLCOPY")
    raw.concat("_X2101_");
    else if (fname=="AWB")
    raw.concat("_X2102_");
    } catch (Exception e) {
         retstring = "no_att_name_found.err";
    return retstring;
    UDF for getNykFileName:
    String[] sarray;
    String regex = "[_]";
    String retstring;
    if(!orgName.endsWith(".err")){
    try {
         sarray = orgName.split(regex, 3);
         retstring = sarray[0];
    } catch (Exception e) {
         retstring = "nyk_filename.err";
    return retstring;
    }else{
         return orgName;
    But, its not working..
    Its giving the file name as:
    no_att_name_found.err20101206 for the input file : 801243209_81473641_wb.pdf
    Display queue result for parsefileName:
    "no_att_name_found.err"
    Please suggest.
    Thanks,
    Suahama

  • Getting file name and date taken to appear in thumbnails

    How do I get my thumbnails in Media to show the file name of each photo and also the date taken? Right clicking on the thumbnail reflects that the "show file info" box is checked. I have Elements 11 (was using Elements 6) and the operating system in Windows 7 and the photos are in jpeg format.
    Thanks in advance for your assistance.
    L

    Click the menu:
    View >> Details
    Move the zoom slider slightly to the right to see more details under each thumbnail.

  • Get file name and received date & time

    Hello experts,
    We are loading around 10 source files(xml) on regular basis to Target table. I have to capture source filename & received datetime of those files and status of file whether it loaded successfully or not(I can care take care of status of file).  I want to automate this process using BODS and load filename, datetime and status data into one database table.
    For you information: File name looks like QAS_Wareneingang_20140328-190006-438.     ( from file name  ..190006-438 number is random number they are generating) and Date and time is constant for that day eg: 28.03.2014  19:00
    Could you please help me...
    Thanks & regards
    Mohan

    Thank you Arun for your kind help...
    I found a solution to find and move all related filenames with timestamp to  file_names.txt file using the batch script below.
    @echo on
    cd /D G:\BAUR
    dir /n Auslagerung* > G:\Dev_Users\BAUR\file_names.txt
    exit
    After that I used the above file as source and formatted using query transform in BODS.

  • UDF for Reciver file name.

    Hi Can any one provide me UDFfor following Requirement.
    My source file name is like this XXXX081090001 and i want reciver file name as XXXXMT940.
    Where MT940 is constant and XXXX is first 4 digits of Source file name.
    Note that First four digits of Source file name can change.
    Example :- Source file name ABC081090001 -
    Target should be ABCMT940
           and if  Source file name is XYZ091100002 -
    Target should be XYZMT940.
    Thanks in advance....

    Hi,
    try this one...
    DynamicConfiguration conf = (DynamicConfiguration)
    container.getTransformationParameters().get
    (StreamTransformationConstants.DYNAMIC_CONFIGURATION);
    DynamicConfigurationKey key = DynamicConfigurationKey.create
    ("http://sap.com/xi/XI/System/File","FileName");
    String input = conf.get(key);
    String s1 = input.substring(0,4);
    String s2 = "MT940";
    String newfile = s1.concat(s2);
    conf.put(key,newfile);
    return (newfile);
    Consider to set "Filename" in the Adapter Specific Message Attributes in FileAdapter.
    Regards,
    Ralph

  • FM for getting First name and last name in HR

    Dear all,
      can anyone tell me the Functrion module for getting <b>first name</b> and <b>last name</b> in HR.
    Regards,
    Vineel

    Hi Vineel,
                   Use FM
                        <b> HRWPC_GET_EMPLOYEE_NAME</b>
                         <b>   HR_TMW_GET_EMPLOYEE_NAME</b>
    Reward points if helpful.
    Regards,
    Hemant

  • Information about file Id, Logical file name and Physical file name

    Hi All,
    I am testing one program. Selection screen has 3 parameters, File Id, Logical File Name and Physical file name. In Physical File name, i am giving complete file name with path. But it is giving error. Please tell me, what is File id and what all information i need to enter for logical file name and physical file name.
    Thanks
    Puneet Aggarwal

    hi,
    try using this for filename.
    parameters : p_file like rlgrap-filename.
    Thanks,
    Gaurav

  • HT4972 I am trying to update ipod touch from ios 4.3.2 to ios 6.1.3.  I have it connected to my computer, and the summary in itunes indicates the update is available.  However, when I click "update", it opens Windows Explorer and waits for a file name to

    I am trying to update ipod touch from ios 4.3.2 to ios 6.1.3.  I have it connected to my computer, and the summary in itunes indicates the update is available.  However, when I click "update", it opens Windows Explorer and waits for a file name to open.

    I am not at that computer now, but I did check via windows update & with the check updates menu choice in the itunes program  - neither indicated a newer version of itunes is available. (it is a vista computer).
    The itunes software on the computer displays my ipod & the current ios (4.3.2), and indicates a newer ios is available (6.1.3). When I choose "update", I am taken to Windows Exploer and prompted to choose a file to open. it is as if the "update" button has the incorrect code attached to it.
    The ipod is working, but there are several app I would like to install, but I can't with the current ooperating system.

  • I'm trying to "open"-get to a site--Ichoose Firefox as application; the next screen is another appication and asks for a file name. What do I do? I never get any further.

    I'm trying to get to "www.enoriver.org." A window appears asking me to choose an application--I choose Firefox. Then another window opens titled "Another Application" and asks for a file name at the botto0m of page. I choose Firefox from the list of files, paste it into the bar, hit "enter"--nothing happens. What do I do?

    Hi Leo! If you can stop these down load managers, you will be my hero.
    Dokie!!
    PS I have tried my best to warn members here on the forum, but I haven't got a lot of support so far.
    I have my figers crossed that the new team will get-er-done

  • HT4906 I want to download the new updates I think to the 10.9 but our mac was given to us and when it comes to the last page it asks for the user name and password but this mac was wiped clean. How do I find out this info so I can get iPhoto?

    I want to download the new updates I think to the 10.9 but our mac was given to us and when it comes to the last page it asks for the user name and password but this mac was wiped clean. How do I find out this info so I can get iPhoto? To be honest I'm not even sure what type of Mac I have and don't know how to find out what kind it is
    I'd also like to make address labels and don't know where to find that either

    You would make address lables with the Contacts app.
    If you don't have the user name and password used to set up the machine then you need to purchase the apps for yourself.

  • 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..

Maybe you are looking for

  • Problem with 3.1.2

    Yesterday I updated my iphone to the lastest version (iPhone OS 3.1.2), then I went to bed so i turned it off. And today I turned it on and it appeared me a strange screen that said me sth like "The SIM cad is blocked", but it let me to insert the PI

  • FLV that won't display

    I created a DW CS5.5 file, (code is below) I embedded an FLV that won't play once the page is on the webserver, although in DW Liveview mode it plays fine. Please advise what I need to change to make this play on the server. The live page link:  www.

  • MacBook- Plastic on base breaking/cracking off

    I have noticed many people with the early edition of MacBooks reporting that the plastic breaks off the base on each side of the track pad... I too have the same problem. It appears that the small plastic supports above the screen hit the base and we

  • "Unavailable Master Images Cannot be Relocated." error; Reconnect no help.

    Seeking help with strange behavior in Aperture that elicited a shrug from the Genius Bar at the local Apple store. They suggested I post a question in this forum. I'm using referenced files in Aperture. When trying to move some of them to a different

  • Flash won't play in Safari

    Since installing Mountain Lion, Safari will not load latest Flash updates. Everything is new and updated. Uninstalls, restarting and everything dove. Really want to switch to Safari full-time since Firefox has been getting sluggish...but cannot get F