How to get filename from selected directory

Helle experts,
I've a string variable from a directory with following content:
G:\SAP_R3_MRSS\SAP_MRS\FAVORIT.PDF
now I just want to select the filename, in this case FAVORIT.TXT
How can I do this ? The directory/filename may vary.
Some ideas ?
Thanks
Gerd

Eric's split is probably the best way, but if you need a way to break the path into drive, path, and file, you could use a standard, well-used regular expression:
PROGRAM zzfile.
DATA:
   g_regex     TYPE string VALUE '\b((?#drive)[a-z]):\\((?#folder)[^/:*?"<>|\r\n]*\\)?((?#file)[^\\/:*?"<>|\r\n]*)',
   g_path_file TYPE string VALUE 'G:\SAP_R3_MRSS\SAP_MRS\FAVORIT.PDF',
   g_drive     TYPE string,
   g_path      TYPE string,
   g_file      TYPE string.
FIND FIRST OCCURRENCE OF REGEX g_regex IN g_path_file SUBMATCHES g_drive g_path g_file IGNORING CASE.
IF sy-subrc = 0.
*  WRITE g_drive.
*  WRITE g_path.
  WRITE g_file.
ENDIF.

Similar Messages

  • How to get FILENAME from FILE PATH

    does anyone know how to get filename from a file path for example
    FILE PATH: C:\Project\uploadbean\web\uploads\Button.txt
    returns
    FILENAME: Button.txt

    @BalusC
    ust for a reference cause i'm new in JSP This has nothing to do with JSP, but with basic knowledge of an essential API. I have given you the link to the File API. Are you saying that you refused to read the API documentation, which clearly explains you how to use the File and shows which methods are all available to you undereach the straightforward getName() method, and expecting that the others may chew the answers for you? Loser.

  • How to get filename from mail attachment

    Hi all,
    I have a XI scenario Mail->XI->RFC. I have created my own adapter module which handle all attachments from incoming mail.
    Everything work fine, but in my module I try to get information about filename of mail attachment. I use getContentType() metod to get the filename but this method return only the mimetype of the document. The getDescription() method return olny string "mail attachment". I need to get the original filename of the attachment or at least the file extension. 
    Is it possible to get the whole filename from mail attachment?
    Thanks
    Peter

    Hi,
    You can tryout with adapter modules . You can make use of following Adapter attributes also -
    http://help.sap.com/saphelp_nw2004s/helpdata/en/ad/bf93409c663228e10000000a1550b0/content.htm
    Similar discussion-
    Email attachment file names
    PayloadSwapBean-
    /people/michal.krawczyk2/blog/2005/12/18/xi-sender-mail-adapter--payloadswapbean--step-by-step
    Regards,
    Moorthy

  • How to get attribute from select

    Hello
    I have a problem getting the value from my select-field from my form in my servlet.
    I can get the values from the textareas and the textfileds but not from my select. If i mail the same form i get the selected value, but not when i try to get this in my servlet.
    To get the other values i use:
    String subcategory = (String) request.getAttribute("subcategory");
    Is there any other way to get the values from select (or radiobuttons) ?

    don't you think you should use request.getParameter("XXX")?
    And if your can select multiple items , then use request.getParameters("SSS"). Note that this method return arrray of String.

  • How to get fieldnames from Select * query ?

    How can I get the fieldnames returned with a SELECT * query ?
    When I use GetFieldName or GetFieldOriginalName I only get fieldnames of "*".

    You should use the fields collection, in the OraDynaset object.
    All you need to do is :
    for i = 0 to Recordset.Fields.Count -1
    debug.print Recordset.Fields(i).name
    debug.print Recordset.Fields(i).OriginalName 'this will print the field's name before an alias
    next i

  • How to get event from selected JTable row

    Whenever a JTable row is selected, i want to get an event to get the row index of the selected row and read the row data. Which listenere do i have to implement and where is the correspoinding addXXXListener() method in JTable?

    here ya go...
    <table>.getSelectionModel().addListSelectionListener(...);Josh Castagno
    http://www.jdc-software.com

  • How to get the default selection color from JTable

    Hi, there,
    I have a question for how to get the default selection color from JTable. I am currently implementing the customized table cell renderer, but I do want to set the selection color in the table exactly the same of default table cell renderer. The JTable.getSelectionBackgroup() did not works for me, it returned dark blue which made the text in the table unreadable. Anyone know how to get the window's default selection color?
    Thanks,
    -Jenny

    The windows default selection color is dark blue. Try selecting any text on this page. The difference is that the text gets changed to a white font so you can actually see the text.
    If you don't like the default colors that Java uses then use the UIManager to change the defaults. The following program shows all the properties controlled by the UIManager:
    http://www.discoverteenergy.com/files/ShowUIDefaults.java
    Any of the properties can be changed for the entire application by using:
    UIManager.put( "propertyName", value );

  • Get ID from selected row in data table

    Hi!
    Does someone know how to get ID from row on which I click a button or link?
    getRowData() doesnt work!
    Or any other method in jsp or just something to get the ID from selected row?
    Thanks!!!

    Hi,
    I have a table with 3 columns, where column 1 represents the key, column 2 represents the data and column 3 displays the "details"-button. If you use
    String key =(String)outputText1.getValue();
    the variable key contains the key value of the row of the column in which the "details"-button was clicked. (outputText1 is the Output Text field of the first column).
    Problem with this is that the key Value must be displayed in the table but maybe it works if the OutputText Field is not rendered, too. If anyone has another (maybe nicer) solution for the problem i would be pleased to see it here.

  • How to get file from server while click on link

    Hi,
    i created on link and i gave one server path to select file from server but while clickinng on link it no displaying any thing.
    following is the Destination url that i gave for the item.
    /u08/app/appvis/xxex/inst/xxex_apps/xxrbe/logs/appl/conc/log/
    please tell me how to get file from server while click on link.

    Ok I got your requirement now.
    If you are getting file names from view attribute then you should not be adding destination URI property for the link.
    Instead you can use OADataBoundValueViewObject API.
    Try below code in your controller processRequest method:
    I am assuming that you are using classic table.
    Also in below example it considers OAMessageStyleText and you can replace it with link item if you want.
    OATableBean tableBean =
    (OATableBean)webBean.findChildRecursive("<table item id>");
    OAMessageStyledTextBean m= (OAMessageStyledTextBean)tableBean.findChildRecursive("<message styled text in table item id>");
    OADataBoundValueViewObject tip1 = new OADataBoundValueViewObject(m, "/u08/app/appvis/xxex/inst/xxex_apps/xxrbe/logs/appl/conc/log/"+"<vo attr name which stores file name for each row>");
    m.setAttributeValue(oracle.cabo.ui.UIConstants.DESTINATION_ATTR, tip1);
    Regards,
    Sandeep M.

  • How to get value from list item

    Hi all,
    How to get value from list item?
    I have a problem with the List Item object
    in the Oracle forms.
    How can I retrieve the selected item from
    a list ?
    I didn't find any function like 'list.GET_
    SELECTED_ITEM()'...
    thanks
    Bala

    Hello,
    You get the value as for any other Forms item:
    :value := :block.list_tem ;Francois

  • How to get the full image directory when i upload the image to web page???

    hai, how to get the full image directory when i upload the image to web page???
    here is the example:
    <form action="uploadfile.jsp" method="post">
    image<input type="file" name="image" />
    <input type="submit" value="submit"/>
    <%
    String s=request.getParameter("image");
    %>
    <%=s%>
    </form>
    i upload the image from C:\image\center.gif. i use request.getParameter just can get the image name like "center.gif". Can anybody help me how to get the full path name. Thanks a lot..

    There is no need to get the path. It is also fairly pointless as the server cannot access the client's local file system.
    Carefully read this article how you can upload files the right way: http://balusc.blogspot.com/2007/11/multipartfilter.html

  • How to get photos from iphoto back onto an SD card. I have a MacBook Pro with a built in SC card slot.

    How to get photos from iPhoto back onto a SD card. I have a MacBook Pro with built in SD card slot. I have tried "Export" but this does not work.

    It's best to export the photos to a folder and then drag the folder onto the memory card.  Memory cards are usually formatted for PCs, FAT 32, which doesn't permit more than a limited number of files in the root directory. Putting the photos in a folder gets around that limitation.
    OT

  • How to get key from MDX Query

    Hi All,
    how to get key from mdx query ?
    example :
    SELECT [Measures].[67822GFASOU7KUT6FKHSQ34FV] ON COLUMNS NON EMPTY CROSSJOIN([ZCOMPANY].MEMBERS, [ZMILL].MEMBERS) ON ROWS FROM ZODS_GL/ZODS_GL_001
    the result from this mdx query are zcompany text and zmill text, how to get company key and mill key ?
    Regards
    JeiMing

    hi Jeiming,
    to get key in mdx, you can try something like
    [ZCOMPANY].[LEVEL01].MEMBERS
    properties [ZCOMPANY].[2ZCOMPANY]
    following threads may useful
    Extracting texts with MDX
    MDX Statement - display only keys for characterstics and their dis. attrib.
    hope this helps.

  • How to get data from three tables (A,B,C) having one to many relation between A and B .and having one to many reation between b and c

    i have  three tables A,B,C.  there is one to many relation between A and B. and one to many relation existed between table b and c . how will get data from these three tables

    check if this helps:
    select * --you can always frame your column set
    from tableA a
    left join tableB b on a.aid=b.aid
    left join tableC c on c.bid=b.bid
    This is just a general query. However, we can help you a lot more, if you can post the DDL + sample data and required output.
    Thanks,
    Jay
    <If the post was helpful mark as 'Helpful' and if the post answered your query, mark as 'Answered'>

  • How to get day from Week Number

    Hi all,
    how to get date from the week number when the day is MONDAY.
    like : week num =33
    how get the date of the day MONDAY from this..

    SQL> select
      to_char(d,'YYYY') y,
      w,
      trunc((trunc(d,'Y')+w*7-date '1000-01-01')/7)*7+date '1000-01-01' monday
    from
    (select sysdate d, 33 w from dual);
    Y             W MONDAY
    2005         33 15.08.2005Message was edited by:
    Laurent Schneider
    I wrote an article which may help you to get out of the mess with weeks that start on friday, saturday, sunday, monday
    http://laurentschneider.blogspot.com/2005/07/tochar-d.html

Maybe you are looking for

  • Struts class not found for war file

    Hello, I am tring to deploy my struts web application in weblogic 8.1. I have all the library files in web-inf\lib directory. It gave me the error that class not found for some class in struts library. The console also told me the classpath. But I ca

  • Trouble publishing an album on MobileMe - Help requested

    I have Aperture 2.1.3 and I have been trying to upload images to an MobileMe album. Every time I select the images and create a new MobileMe album, the activity window shows the publishing in progress and suddenly goes to 100%. problem is the upload

  • Solaris Cluter 3.2 for SAP

    Hello All, My SAP production environment needs to be running under Solaris Cluster 3.2. I am thinking of T5440 servers - 2 in number and StorageTek 6140. The agents available for SAP on Solaris Cluster 3.2 are: Sun Cluster HA for SAP (failover or sca

  • Portal URL's

    How do I change the servername Portal uses to build the <a href> URLs? I have created a VirtualHost for my Portal server, configured the Site-to-Server in my WebCache but when I got to my VirtualHost URL, I get the Portal page, but all the links use

  • FaceTime on iMac says "failed"

    FaceTime on iMac says "failed". NOw this app worked fine about a week ago and now I need to work it doesn't. I hav ebeen through all the preferences and everything checks out. Whenever I call my wife, my Dad, my work colleagues it just says failed im