FM for getting teh file name with path

Hi guys,
Is there an fm getting the file name with path given the physical path and file name? Thanks!

Hi Mark,
Function Module WS_FILENAME_GET is obsolete, dont use it.
Use the Method file_open_dialog of  class cl_gui_frontend_services as given below.
DATA:
    lt_filetable TYPE filetable,
    lf_rc        TYPE i,
    lv_filename(50) TYPE c,
    lv_fileext(3) TYPE c,
    ls_file TYPE file_table,
    lv_file TYPE localfile,
    lv_title TYPE string.
  lv_title = sy-title.
  lv_progname = sy-cprog.
  CALL METHOD cl_gui_frontend_services=>file_open_dialog
    EXPORTING
      window_title            = lv_title
      file_filter             = '*.txt'
      multiselection          = abap_false
    CHANGING
      file_table              = lt_filetable
      rc                      = lf_rc
    EXCEPTIONS
      file_open_dialog_failed = 1
      cntl_error              = 2
      error_no_gui            = 3
      not_supported_by_gui    = 4
      OTHERS                  = 5.
  IF sy-subrc <> 0.
    MESSAGE ID sy-msgid TYPE 'S' NUMBER sy-msgno
               DISPLAY LIKE 'E'
               WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    EXIT.
  ENDIF.
* Number of selected filed must be equal to one.
  CHECK lf_rc = 1.
* Access selected file
  READ TABLE lt_filetable INTO ls_file INDEX 1.
  CHECK sy-subrc = 0.
  lv_file = ls_file-filename.
  SPLIT lv_file AT '.' INTO lv_filename lv_fileext.
Revert back if you need clarifications.
Regards
Karthik D

Similar Messages

  • How to get uploaded file name and path in BefExportToDat event script

    I would like to get hold of the uploaded file name and full path in the event script "BefExportToDat", as I need to extract values from particular fields. However I have not yet found a way to do this.
    - The input variable "strFile" returns the .Dat file path in the Outbox, to which it is about to export the data. This is no use to me.
    - The API variable RES.PstrFilename is returning nothing
    I am using RES.PstrFilename in the "BefFileImport" event script in a different FDM application and it works fine, however I need to find a way to get this to work in the "BefExportToDat" event script.
    Please let me know how this might be achieved.

    I am looking through the API calls in FDM Workbench, but cannot see the table (tPOVPartitions) you mentioned listed. Is this the correct name? And do I just use the function listed in the object browser to run the query?
    Furthermore (going back to my initial thoughts of using strFile), it appears that although the variable contains the .Dat filename and path, the actual file is non-existent when "BefExportToDat" is executed:
    Error:
    Error: Export failed.
    Detail: File not found.
    This would make sense, but it does make the variable "strFile" a little pointless since one cannot make use of the file in this particular event script. Do you please have any thoughts on this?

  • QT v10.0 "save for web" creates file names with spaces?

    I find it strange that the additional exported files from "save for web" (iPhone, etc) auto exports files with spaces in the file names. Not only that, but changing the file names breaks the javascript.
    I work on a server that denies permission to files with spaces in the file names. I know it's a bit archaic - but it's also a long standing tennent of "good HTML" to creates files with a hyphen or underscore instead of a space.
    Is this something that can be addressed in the next update?

    If your using cs5 or cs6 you might try Image Processor Pro which seems to use underscores
    and has a save for web option.
    Dr Browns Services 2.31
    http://www.russellbrown.com/scripts.html

  • Getting jar file name with wrapper

    Hi,
    I'm using [java service wrapper|http://wrapper.tanukisoftware.org/] to launch my project,
    with the command
    File jarFile = new File(main.class.getProtectionDomain().getCodeSource()
              .getLocation().toString());witch opens the jar file name, this command returns the following
    file:C:/wrapper/../lib/project.jar
    this string raises the exception java.lang.IllegalArgumentException: URI is not hierarchical
    Is there any other why to get the application jar name ?, thanks

    Hi, the is the answer of my previous question
         public static String getJarNameURI () {
             String pathrojar = main.class.getProtectionDomain().getCodeSource()
                     .getLocation().toString();
             if (pathrojar.charAt(5) != '/')
                pathrojar = pathrojar.replace(":", ":/");
             return URI.create(pathrojar).normalize().toString();
    File jarFile = new File(getJarNameURI ());

  • How to get a file name with file description

    Hi guys!
    I'm receiving the error message : Too many file open. So, i want the file name opened by process in /proc/PID/fd.
    Now, how can i do this ?
    Thanks!

    Hi guys!
    I'm receiving the error message : Too many file open.
    So, i want the file name opened by process in
    /proc/PID/fd.
    Now, how can i do this ?The easiest way is to use pfiles(1) on the process. Alternatively, on Solaris 10, look in /proc/PID/path...
    - Bryan
    Bryan Cantrill, Solaris Kernel Development. http://blogs.sun.com/bmc

  • Can i set a default file name with path when using IOpenFileDialog?

    At present, if i use
    IDFile xmlDataFile("C:\\a.txt");
    openFileDialog->DoDialog(&xmlDataFile, resultFiles, kFalse, &title);
    It use "C:\" as its default folder, but the file name box is empty, what i want is to show "a.txt" as its default file name.
    It looks like there is no such api to set a default in  IOpenFileDialog.
    Am i right?

    At present, if i use
    IDFile xmlDataFile("C:\\a.txt");
    openFileDialog->DoDialog(&xmlDataFile, resultFiles, kFalse, &title);
    It use "C:\" as its default folder, but the file name box is empty, what i want is to show "a.txt" as its default file name.
    It looks like there is no such api to set a default in  IOpenFileDialog.
    Am i right?

  • Newb needs help opening file browser and getting full file name and path.

    Ok, so I'm a TOTAL newb here, but I have managed to get it to open a file browser but all I can seem to get it to do is give me the NAME of the selected file *eg. selectedFile.name* I also need the path of the file as in C:\example\file.mp3.
    The program I'm making plays an MP3 of your choice at a certain time, like an alarm clock. But I got tired of entering the file path of the MP3 EACH time so I wanted to have a browse feature.
    Ideas... help... thanks...
    Nicholas

    you'll need to use air to get the path.

  • I am using OSX 10.9.5 and Outlook Web App for emails. When I download an attachment it replaces the space in the file name with   - how can I change this?

    I am using OSX 10.9.5 and Outlook Web App for emails. When I download an attachment it replaces the space in the file name with %20  - how can I change this?

    Click on the below link :
    https://get.adobe.com/flashplayer/otherversions/
    Step 1: select Mac OS  X 10.6-`0.`0
    Step 2 : Safari and FIrefox
    Then click on " Download Now"  button.

  • 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 find PG.xml file name and path associated with a FUNCTION

    Hi,
    I am having a function:IRC_VIS_HOME_PAGE with Web HTML value as below:
    OA.jsp?akRegionCode=IRC_VIS_HOME_PAGE&akRegionApplicationId=800&OAPB=IRC_BRAND
    How to find PG.xml file name and path assoicated with above funtion.
    Thanks,
    ashok

    Ashok,
    Function IRC_VIS_HOME_PAGE will have 2 parameter defined for it which are OASF and OAHP where
    OASF=<SelectedFunctionName> - this tells the Framework to select this function in the given "Home Page" menu context.
    OAHP=<HomePageMenuName> - this is used ONLY with the OASF parameter, and it is used to establish the current menu context. It should point to a "Home Page" menu.
    --Shiv                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Get the pc name with domain name and add it to my properties file using commands

    i want to get the pc name with domain name and add it to my properties file using powershell  .
    sid

    function Get-Environment{
    [environment]|Get-Member -Static -MemberType Properties |
    ForEach-Object{
    if($_.Name -ne 'StackTrace'){
    $v=[scriptblock]::Create("[environment]::$($_.Name)").Invoke()
    New-Object PsCustomObject -Property ([ordered]@{Name=$_.Name;Value=$v[0]})
    Get-Environment
    Get-Environment | Out-String | Out-File environment.txt
    ¯\_(ツ)_/¯

  • MimeBodyPart.getFileName() returns file name with directory path.

    Hi
    The documentation says getFileName() returns filename ,not including directory components. But it is returning
    path like Eserv generic/mails/a.html. Can it return a full path in some mail servers?
    Please respond.
    Thanks

    The documentation says getFileName() returns filename ,not including directory components.I think you must be misinterpreting the documentation. Where did you read that?
    The getFileName method returns whatever the sender sent as a file name. The send should
    send only a simple file name, with no directory components, but they can send anything, and
    you should protect against abuse before using such a file name.

  • When I open up an e-mail attachment a box pops up PRINT TO FILE below that line OUTPUT FILE NAME with an empty line for the file name vs. simply going to my default printer?

    when I open up an e-mail attachment a box pops up PRINT TO FILE below that line OUTPUT FILE NAME with an empty line for the file name vs. simply going to my default printer?

    Make sure that '''''Print to File''''' isn't selected in the native print dialog box ''(see screenshot below)'' middle-right, and make sure your Printer is selected at the top of that dialog box.
    ''I'm a little confused why an email attachment would need to go directly to the printer, but that's what you asked about.''

  • Problem with getting the file name and type from OAMessageFileUploadBean

    Hi Tapash,
    I am trying the code below to get the file name and mime type from OAMessageFileUploadBean,
    DataObject fileUploadData = (DataObject)pageContext.getNamedDataObject("Documents");
    String uFileName = (String)fileUploadData.selectValue(null, "UPLOAD_FILE_NAME");
    String contentType = fileUploadData.selectValue(null, "UPLOAD_FILE_MIME_TYPE");
    But this piece of code gives errors saying that selectValue selectValue(null, java.lang.String) not found in class oracle.svc.DataObject
    Any ideas? why this code is giving error?
    Can i handle the event of browse button for OAMessageFileUploadBean?
    Regards,
    Nagesh Manda.

    Try using class oracle.cabo.ui.data.DataObject
    --Shiv                                                                                                                                                                                                       

  • I cannot open files in excel with error message "The file name or path contains invalid characters

    I cannot open files in excel with error message "The file name or path contains invalid characters

    Found the solution. The hardrive name was changed to "/" which is not a recognised file path character. So I changed the name to "Mac" then I was able to already open all files in excel and word

Maybe you are looking for

  • All clips have to be rendered

    Everytime I log and capture a clip and try to play it in the sequence....it says the clips are unrendered....they haven't had effects applied or anything...where can I control render settings?

  • Domain creation too much time

    Hi Guys, I am trying to create a domain in my windows 7 with following components. Oracle database 11.2.0.1 RCU 11.1.1.5 weblogic 10.3.6 IDM suite 11.1.1.5 Trying to create domain using Oracle\Middleware\Oracle_IDM1\bin\config.bat and domain creation

  • Bank Account Reconciliation

    FI Experts, client do not have a clearing accoutn set-up for outgoign checks, therefore I am reconciling account manually first, before I introduce them to teh clearing accoutn. I  updated the encashment field for all outstanding checks, now I need t

  • CAD desktop Freezing

    Had a user that had a call showing up in Agent Desktop but did not disconnect after she hung up.  She tried high ligting the call and hitting the drop button but that did not work and ended up closing out of Agent Desktop so she could take calls. The

  • Vendor providing both Raw Materials & Service

    Hi, We have defined different Vendor Account Groups & Reconciliation Accounts for Raw Materials Vendor & Service Vendor. But there is a Vendor which is providing us both Raw Materials & Service. Should we created one Vendor Code for the vendor with e