Regarding finding of word in a string of Application Server Path

Hi All,
I have issue related to finding a certain <b>file name(S)</b> from given <b>Application Server Path</b>.
Here is the actual issue:
In my Selection-Screen i have one field by the name of <b>Application Server Path</b> - /pw/data/erp/D5S/pp/down/eppi0720.txt
Like wise he might enter diffrent file name(s) (or) diffrent pat(s) as per requirement.
Here my requirement is i need to find file discarding path in to one variable - Remember path might also differ also file name might also differ.
Is there any <b>Keyword/Command</b> by which we can findout only <b>filename</b> from the <b>path</b>!
I think with <b>'/'</b> operator we can solve this issue.
If any body knows solution please post.
Thanks in advance.
Thanks & Regards,
Rayeez.

Hi,
use fm EPS_GET_DIRECTORY_LISTING'
example:
CALL FUNCTION 'EPS_GET_DIRECTORY_LISTING'
       DESTINATION                   q
       EXPORTING
            dir_name               = folder
            file_mask              = mask
       IMPORTING
            file_counter           = cnt_file
            error_counter          = err_file
       TABLES
            dir_list               = dir_list
Andreas

Similar Messages

  • To find a word in a string.

    Please, is there a way to find a word in a string?
    For exemple:
    The string contains... "Hello World Java Sun"
    I need to find the word "Java", and I'd like to do not compair char by char... I'd like to do it faster than one by one...
    Is there a way? How should I do? I was thinking to use something like substring... but even it... I need to compair char by char... (or I didn't?)
    Thanks a lot

    go to search engine and learn the String class it will help u in the future.
         indexOf
    public int indexOf(String str)
        Returns the index within this string of the first occurrence of the specified substring. The integer returned is the smallest value k such that:
             this.startsWith(str, k)
        is true.
        Parameters:
            str - any string.
        Returns:
            if the string argument occurs as a substring within this object, then the index of the first character of the first such substring is returned; if it does not occur as a substring, -1 is returned

  • Finding a word within a string

    Hey everyone,
    Just having a little trouble with something.
    I'm trying to find a word -- that is, not a substring, an actual word as defined by the english language -- within a string.
    For example I don't want "hell" to be found in "hello".. only "hello" to be found.
    Currently i've got two strings, one is the sentance (String input), and one is the word to be found in the sentance (String word). I need the program to find the WORD, and then go back and search for the word again and again and again until it reaches the end of the string.
    This is what I've got thus far:
              for(i = 0; i < input.length(); i++)
                   // This statement checks the string "input" for the string "word" starting at offset 0 (as this is what the variable was first defined as)
                   if(input.indexOf(word, offset) >= 0)
                        // If it finds the word at all, this line increases the offset ahead of this word so it doesn't simply find the same word again
                        offset = offset + (input.indexOf(word)) + (word.length());
                        times++;
              }At the moment this searches for the sub-string, not the WORD which is what I would like it to do.
    What's the easiest way of going about this? I've been fiddling around trying to add extra sections to the if statement, for example
    if((input.indexOf(word, offset) >= 0) && (input.charAt(offset +1) == 32))(32 as in the ASCII character for a space, which would do what I wanted it to do)
    But I eventually get errors because at some stage or another the charAt is going to be higher than the actual length of the String. Plus, this only looks if there's a space next to the word - a word can be valid if it has a ! next to it for example, or a comma...
    Thanks for any help :)
    viddy

    I think there's a word boundary marker in regex. So it'd be "\\w+hello\\w+" or whatever the marker is, to be used with a Pattern instance.

  • Regarding reading data from a file in the application server.

    Hello Everyone,
    My question is:
    The file in the application server consists of data with header, detail and trail out of which the detail contains the main information. The detail again contains the data in the form of a continuous string and again some spaces corresponding to a single record. I need to split the data in the internal table in such a way so that the first few characters get into field-1 of the target internal table. Again I need to consider the spaces for accessing the data for filling up in field-2. How do I decide on the 'Split' statement and specially when the whole string has to be taken care of as contatining data in a single string format without space and again some data after some spaces corresponding to a single record.
    Your help is very much needed. Thanks to all the experts in advance.

    Hi
      This is the sample code I was used for the similar requirement.
    DATA: single_line TYPE string .
    v_file_listings = pa_filn1.
    IF v_file_listings IS INITIAL .
    MESSAGE e039 WITH v_file_listings.
    ENDIF.
    *-- read file, split lines into fields and put data into table
    OPEN DATASET v_file_listings FOR INPUT IN TEXT MODE ENCODING NON-UNICODE. "Opening the files
    IF sy-subrc EQ 0.
    DO.
    READ DATASET v_file_listings INTO single_line. "Reading the content of file into line
    IF sy-subrc = 0.
    IF sy-index > 1. "skip header-line
    SPLIT "Split the content of line into work area
    single_line
    AT k_split
    INTO
    wa_listings-kschl " Condition type
    wa_listings-tabname16 " Condition table name
    wa_listings-vkorg " Sales organisation
    wa_listings-kunnr " sold-to party numberor ship-to party number
    wa_listings-matnr " Material Number
    wa_listings-kodatab " Valid-from date
    wa_listings-kodatb1. " Valid-to date
    APPEND wa_listings TO itab_listings. "Appending Work Area to internal table
    ENDIF.
    ELSE.
    EXIT.
    ENDIF.
    v_count1 = sy-tabix.
    ENDDO.
    Regards,
    Sreeram

  • Regarding tranfer of exel file from Presentation to Application server

    Hi,
    I want to transfer <b>excel file</b> in presentation server [Desktop] to Application server[<b>AL11</b>].
    I have made use of F.M <b>C13Z_FRONT_END_TO_APPL</b>, But it is showing the data in AL11 as some junk characters.
    Where as when i transfer a Text file to AL11 using above F.M it is showing the data correctly.
    How can solve this issue!
    I need to transfer <b>Excel file</b> data in <b>Presentation Server</b> to <b>Application Server</b> with tab delimeter.
    Can any body give the solution for the same!
    Thanks in advance.
    Thanks,
    Deep.

    Dear Deep,
    Please go though the following lines of code:
    D A T A D E C L A R A T I O N *
    TABLES: ANEP,
    BKPF.
    TYPES: BEGIN OF TY_TABDATA,
    MANDT LIKE SY-MANDT, " Client
    ZSLNUM LIKE ZSHIFTDEPN-ZSLNUM, " Serial Number
    ZASSET LIKE ZSHIFTDEPN-ZASSET, " Original asset that was transferred
    ZYEAR LIKE ZSHIFTDEPN-ZYEAR, " Fiscal Year
    ZPERIOD LIKE ZSHIFTDEPN-ZPERIOD, " Fiscal Period
    ZSHIFT1 LIKE ZSHIFTDEPN-ZSHIFT1, " Shift No. 1
    ZSHIFT2 LIKE ZSHIFTDEPN-ZSHIFT1, " Shift No. 2
    ZSHIFT3 LIKE ZSHIFTDEPN-ZSHIFT1, " Shift No. 3
    END OF TY_TABDATA.
    Declaration of the Internal Table with Header Line comprising of the uploaded data.
    DATA: BEGIN OF IT_FILE_UPLOAD OCCURS 0.
    INCLUDE STRUCTURE ALSMEX_TABLINE. " Rows for Table with Excel Data
    DATA: END OF IT_FILE_UPLOAD.
    S E L E C T I O N - S C R E E N *
    SELECTION-SCREEN: BEGIN OF BLOCK B1 WITH FRAME,
    BEGIN OF BLOCK B2 WITH FRAME.
    PARAMETERS: P_FNAME LIKE RLGRAP-FILENAME OBLIGATORY.
    SELECTION-SCREEN: END OF BLOCK B2,
    END OF BLOCK B1.
    E V E N T : AT S E L E C T I O N - S C R E E N *
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FNAME.
    CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
    EXPORTING
    PROGRAM_NAME = SYST-REPID
    DYNPRO_NUMBER = SYST-DYNNR
    FIELD_NAME = ' '
    STATIC = 'X'
    MASK = '.'
    CHANGING
    FILE_NAME = P_FNAME
    EXCEPTIONS
    MASK_TOO_LONG = 1
    OTHERS = 2
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    E V E N T : S T A R T - O F - S E L E C T I O N *
    START-OF-SELECTION.
    Upload Excel file into Internal Table.
    PERFORM UPLOAD_EXCEL_FILE.
    Organize the uploaded data into another Internal Table.
    PERFORM ORGANIZE_UPLOADED_DATA.
    E V E N T : E N D - O F - S E L E C T I O N *
    END-OF-SELECTION.
    *& Form UPLOAD_EXCEL_FILE
    text
    --> p1 text
    <-- p2 text
    FORM UPLOAD_EXCEL_FILE .
    CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
    EXPORTING
    FILENAME = P_FNAME
    I_BEGIN_COL = 1
    I_BEGIN_ROW = 3
    I_END_COL = 7
    I_END_ROW = 32000
    TABLES
    INTERN = IT_FILE_UPLOAD
    EXCEPTIONS
    INCONSISTENT_PARAMETERS = 1
    UPLOAD_OLE = 2
    OTHERS = 3
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    ENDFORM. " UPLOAD_EXCEL_FILE
    *& Form ORGANIZE_UPLOADED_DATA
    text
    --> p1 text
    <-- p2 text
    FORM ORGANIZE_UPLOADED_DATA .
    SORT IT_FILE_UPLOAD BY ROW
    COL.
    LOOP AT IT_FILE_UPLOAD.
    CASE IT_FILE_UPLOAD-COL.
    WHEN 1.
    WA_TABDATA-ZSLNUM = IT_FILE_UPLOAD-VALUE.
    WHEN 2.
    WA_TABDATA-ZASSET = IT_FILE_UPLOAD-VALUE.
    WHEN 3.
    WA_TABDATA-ZYEAR = IT_FILE_UPLOAD-VALUE.
    WHEN 4.
    WA_TABDATA-ZPERIOD = IT_FILE_UPLOAD-VALUE.
    WHEN 5.
    WA_TABDATA-ZSHIFT1 = IT_FILE_UPLOAD-VALUE.
    WHEN 6.
    WA_TABDATA-ZSHIFT2 = IT_FILE_UPLOAD-VALUE.
    WHEN 7.
    WA_TABDATA-ZSHIFT3 = IT_FILE_UPLOAD-VALUE.
    ENDCASE.
    AT END OF ROW.
    WA_TABDATA-MANDT = SY-MANDT.
    APPEND WA_TABDATA TO IT_TABDATA.
    CLEAR: WA_TABDATA.
    ENDAT.
    ENDLOOP.
    ENDFORM. " ORGANIZE_UPLOADED_DATA
    In the subroutine --> ORGANIZE_UPLOADED_DATA, data are organized as per the structure declared above.
    Regards,
    Abir
    Don't forget to award points *

  • How to find the sessions connected to oracle through application server?

    Hi all,
    i want to restrict my application server users from the deletion of the data in my database.
    for this i was try to find out the application name from v$session but it is showing some application names and some blanks. i need to find out the application server name, so that i can restrict the users in product user profile.
    is there any view to find the sessions and applications which are connected to oracle database?
    Thanks,
    Sandeep

    hi pavan,
    Even whne the privileges are revoked, the java application(users) can able to delete data in the database schema through the java application.
    please suggest me on this?
    --sandeep                                                                                                                                                                                                                                                                                                                                                                                                       

  • Regarding moving files b/w folders in the Application server

    Hi,
    I need to move the file from one folder(main folder) of the application server to another (eg, archive, error) with certain conditions. When I try to move file from main folder to archive folder, it is working fine (.txt). The file along with the contents are moving, but when I try to move the file from main folder to error folder (.err), though the file has moved, the contents are not showing (though the file is erased from the main folder). I have used the function module
    SXPG_COMMAND_EXECUTE for performing these actions.  Can any one suggest as to why the contents are not showing.
    LEAR:  lv_mv_command_exitcode,
              lv_mv_command_arguments,
              lv_dummy_string.
      CONCATENATE is_dir_list-fullname iv_error_file INTO lv_mv_command_arguments
      SEPARATED BY space.
      REFRESH lt_mv_command_stdout.
      CALL FUNCTION 'SXPG_COMMAND_EXECUTE'
        EXPORTING
          commandname                   = 'ZMV'
          additional_parameters         = lv_mv_command_arguments
        IMPORTING
          exitcode                      = lv_mv_command_exitcode
        TABLES
          exec_protocol                 = lt_mv_command_stdout
        EXCEPTIONS
          no_permission                 = 1
          command_not_found             = 2
          parameters_too_long           = 3
          security_risk                 = 4
          wrong_check_call_interface    = 5
          program_start_error           = 6
          program_termination_error     = 7
          x_error                       = 8
          parameter_expected            = 9
          too_many_parameters           = 10
          illegal_command               = 11
          wrong_asynchronous_parameters = 12
          cant_enq_tbtco_entry          = 13
          jobcount_generation_error     = 14
          OTHERS                        = 15.
      IF sy-subrc <> 0 OR lv_mv_command_exitcode <> 0.
        CONCATENATE 'Error in File'
                    iv_basefile
                    'but,not moved to Error folder.'
        INTO lv_dummy_string SEPARATED BY space.
        WRITE: / lv_dummy_string.
        IF sy-batch = c_flag_on.
          MESSAGE e054 WITH iv_basefile.
        ENDIF.
      ELSE.
        CONCATENATE 'Error in File,'
                    iv_basefile
                    'moved to Error folder.'
        INTO lv_dummy_string SEPARATED BY space.
        WRITE: / lv_dummy_string.
        IF sy-batch = c_flag_on.
          MESSAGE s055 WITH iv_basefile.
        ENDIF.
    Regards,
    John

    Hi,
    Here what I found was, if the file is empty, then the system is not moving the empty file to the destination , but if the file is not empty it is copying the contents and the corresponding folder to the destination folder. My intent is to copy the folder even if the contents of the folder is empty to the destination folder and delete the old file.
    regards,
    John

  • Issue with the Maximum lenght string on application server file

    Hi,
    I have one internal table which cotains aroung 200 fields. The total lenght of the all fields is around 2000 charr.
    I am using open data, transfer and close data set to put my file on application server.
    I am looping at my internal table and then transfering the data on server file.
    The problem is that after generating the file on application server i couldnt see all the fields. i can see only around 500 char.
    not all the data.
    Does there is maximum limit on the number of char on application serevr.
    or there is complete record but we cant see,
    kindly help.

    Hi Sachin,
    As Rainer said you cannot see the full length of row in AL11. The visible length is restricted. If you want to re-confirm whether all data are in. Then download the file from application server to your local system and see the contents. It will be to 2000 characters which you passed.
    Hope this helps.

  • Regarding the uploading the pdf file to the application server

    hi,
    iam getting this error while uploading the pdf file to the applicatioin server.
    "There was an error while trying to parse an image"
    to convert smartform into PDF file we ll use convert_otf FM.
    If see that FM data ll be stored in it_tline structure ok.
    For sending to application server we ll use
    OPEN DATASET p_arch for OUTPUT IN TEXT MODE ENCODING DEFAULT IGNORING CONVERSION ERRORS.
      LOOP AT it_tline.
      TRANSFER it_tline to p_arch.
      ENDLOOP.
      CLOSE DATASET p_arch.
    Ok
    For getting data from internal table we ll use
    OPEN DATASET p_arch FOR INPUT IN TEXT MODE ENCODING DEFAULT IGNORING CONVERSION ERRORS
    do.
      READ DATASET p_arch INTO it_tline.
      if sy-subrc = 0.
        APPEND it_tline.
        ELSE .
          exit.
          endif.
      enddo.
    CLOSE DATASET p_arch.
          LOOP AT it_tline.
        TRANSLATE it_tline USING '~'.
        CONCATENATE wa_buffer it_tline INTO wa_buffer.
      ENDLOOP.
      TRANSLATE wa_buffer USING '~'.
      DO.
        i_record = wa_buffer.
        APPEND i_record.
        SHIFT wa_buffer LEFT BY 255 PLACES.
        IF wa_buffer IS INITIAL.
          EXIT.
        ENDIF.
      ENDDO.
    Attachment
      REFRESH:
        i_reclist,
        i_objtxt,
        i_objbin,
        i_objpack.
      CLEAR wa_objhead.
      i_objbin[] = i_record[].
    Create Message Body
    Title and Description
      i_objtxt = 'COMMERCIAL INVOICE'.
      APPEND i_objtxt.
      DESCRIBE TABLE i_objtxt LINES v_lines_txt.
      READ TABLE i_objtxt INDEX v_lines_txt.
      wa_doc_chng-obj_name   = 'COMMERCIAL INVOICE'.
      wa_doc_chng-expiry_dat = sy-datum + 10.
      wa_doc_chng-obj_descr  = 'COMMERCIAL INVOICE'.
      wa_doc_chng-sensitivty = 'F'.
      wa_doc_chng-doc_size   = v_lines_txt * 255.
      CLEAR i_objpack-transf_bin.
      i_objpack-head_start = 1.
      i_objpack-head_num   = 0.
      i_objpack-body_start = 1.
      i_objpack-body_num   = v_lines_txt.
      i_objpack-doc_type   = 'RAW'.
      APPEND i_objpack.
    Attachment
    (pdf-Attachment)
      i_objpack-transf_bin = 'X'.
      i_objpack-head_start = 1.
      i_objpack-head_num   = 0.
      i_objpack-body_start = 1.
      DESCRIBE TABLE i_objbin LINES v_lines_bin.
      READ TABLE i_objbin INDEX v_lines_bin.
      i_objpack-doc_size =  v_lines_bin * 255 .
      i_objpack-body_num  = v_lines_bin.
      i_objpack-doc_type  = 'PDF'.
      i_objpack-obj_name  = 'COMMERCIAL INVOICE'.
      i_objpack-obj_descr = 'COMMERCIAL INVOICE'.
      APPEND i_objpack.
    BREAK-POINT.
      IF it_adr6[] IS NOT INITIAL.
        LOOP AT it_adr6 INTO wa_adr6.
          CLEAR i_reclist.
          i_reclist-receiver = wa_adr6-smtp_addr.
          i_reclist-rec_type = 'U'.
          i_reclist-com_type = 'INT'.
          APPEND i_reclist.
        ENDLOOP.
        CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
          EXPORTING
            document_data = wa_doc_chng
            put_in_outbox = 'X'
          TABLES
            packing_list  = i_objpack
            object_header = wa_objhead
            contents_bin  = i_objbin
            contents_txt  = i_objtxt
            receivers     = i_reclist.
      ENDIF.
    The above error I am getting.
    Please give your suggestions
    Thanks in advance

    U can use this code
    Reward if useful
    REPORT  ZMN_PDF_UPLOAD.
    data: begin of itab occurs 0,
    field(256),
    end of itab.
    data: dsn(100) value '\usr\sap\DEV\DVEBMGS00\work\testpdf',
    length like sy-tabix,
    lengthn like sy-tabix.
    call function 'GUI_UPLOAD'
    exporting
    filename = 'c:\temp\test.pdf'
    filetype = 'BIN'
    importing
    filelength = length
    tables
    data_tab = itab.
    open dataset dsn for output in binary mode.
    loop at itab.
    transfer itab-field to dsn.
    endloop.
    close dataset dsn.
    clear itab.
    refresh itab.
    *To crosscheck if it went well
    open dataset dsn for input in binary mode.
    do.
    read dataset dsn into itab-field.
    if sy-subrc = 0.
    append itab.
    else.
    exit.
    endif.
    enddo.
    call function 'GUI_DOWNLOAD'
    exporting
    filename = 'c:\temp\testn.pdf'
    filetype = 'BIN'
    bin_filesize = length
    importing
    filelength = lengthn
    tables
    data_tab = itab.
    *Or
    *Use the TCode
    *CG3Z or CG3Y
    *for downloading to Application Server.

  • How to find versions of application server components to apply patches

    Hi,
    I have Oracle Application server 10.1.2.0.2 installed in my linux box.
    under metalink.oracle.com
    1. i read documentation Doc ID: 420061.1 in metalink about patches and i did find one patch# 5922120 for my application middletier.
    but when i did a metalink search i did see some patches for my database version which were not critical
    so if they are not critical and if my application server is working fine then do i need to apply these patches.
    My application server version is 10.1.2.0.2
    and my apalication server infrastructure version is 10.1.0.4.2
    during my metalink searches i found the following patches which were uner normal priority. they are:
    patch numbers: 5127390, 5094712, 5605377
    Can someone guide me.
    Bottom line is: do i need to apply these patches unless they are critical and they are requred for my applications.
    Also i have one more basic question is
    How do i find out individual component versions in my application server like Portal, discoverer, EM, EM agent, etc?
    Thanks in advance,
    Philip.
    Message was edited by:
    [email protected]

    Philip,
    You have a similar environment to ours. We actually have two Oracle environments: 91) 10gDB 10.1.0.5 / 10gAS 9.0.4.3, and (2) 10gDB 10.2.0.3 / 10gAS 10.1.2.0.3.
    In regards to what patches, I look at two items: the latest patchset for DB and AS, and the Critical Patch Updates(CPU). Often, the CPU will drive what patchset you will need to be at. For example, with the CPU April 2007, we had to move to patchset 3 for our AS (9.0.4.3) since that is the only 10gAS R1 that Oracle provided CPU patches.
    As far as version ID, I have not found one single area to acquire this. For Portal, you can invoke Portal, http://host/pls/portal, logon as 'portal', then Administer, Global Settings, and at the bottom of the page is the version.
    For other products like Forms and Discover, you can find the version when the tool is invoked.
    Not quite as nice as the DB side where dba_registry will give you all the goodies.
    Regards,
    John

  • Exchange 2010 Application server email source finding

    Hi Team,
    From Exchange server I want to find out all email traffic generated from Application server where SMTP configured as HUB transport server.
    Problem is that i want to remove anonymous permissions set on receive connect so prior i want to find out all application server IPs, add them into receive connector permissions.

    Hi,
    If you want to find all application server IPs, you can follow the steps below.
    1. Locate the receive connector which you configure for relay.
    2. Right-click and choose Properties.
    3. Click Network tab, under "Receive mail from remote servers that have these IP addresses", they are application server IPs.
    If they are IP range, you can find application server IP address via Internet headers.
    Best regards,
    Belinda
    Belinda Ma
    TechNet Community Support

  • Regarding Application server file path browsing

    Hi All,
    I have a issue regarding Application Server File Path browsing.
    Actually in my selection-screen i will declare a parameter as <b>Application Server File Path</b> now when i press F4 in that field it should be able to browse through <b>Application Server Path's</b>.
    Just like <b>F4_FILENAME</b> in the case of <b>Presentation Server File Path</b> Browsing.
    Can anybody solve my issue.
    Thanks in advance.
    Thanks & Regards,
    Rayeez.

    Hi Shaik,
    Just copy and paste:
    Here is the code for retrieving list of files contained within specific Application server directory(SAP).
    PARAMETER: p_fdir type pfeflnamel DEFAULT '/usr/sap/tmp'.
    data: begin of it_filedir occurs 10.
    include structure salfldir.
    data: end of it_filedir.
    START-OF-SELECTION.
    Get Current Directory Listing for OUT Dir
    call function 'RZL_READ_DIR_LOCAL'
    exporting
    name = p_fdir
    tables
    file_tbl = it_filedir.
    List of files are contained within table it_filedir
    loop at it_filedir.
    write: / it_filedir-NAME.
    endloop.
    Hope this will help you.
    Let me know incase of any concerns.
    EDIT:
    There are few FM for ur refernce :
    RZL_READ_DIR_LOCAL
    SUBST_GET_FILE_LIST Return table with file list for the given directory (pattern allowed)
    F4_DXFILENAME_TOPRECURSION Popup to select one file from the given application server directory
    TH_SERVER_LIST Returns list of application servers.
    EPS_GET_DIRECTORY_LISTING – Lists filenames from the application server .
    Cheers
    Sunny
    Rewrd points, if found helpful
    Message was edited by: Sunny

  • Here's how to find the right word in a string

    I needed to find the rightmost word in a string. I didn't find a simple formula in these forums, but I now have one, so I wanted to share it. Hope you find it useful.
    Assuming that the string is in cell A1, the following will return the rightmost word in the string:
    RIGHT(A1,LEN(A1)-FIND("*",SUBSTITUTE(A1," ","*",LEN(A1)-LEN(SUBSTITUTE(A1," ","")))))

    I found the problem. Whatever character was being used in the substitution was parsed out by the forum parser. I replaced it with "œ" (option q on my keyboard).
    =RIGHT(A1,LEN(A1)-FIND("œ",SUBSTITUTE(A1," ","œ",LEN(A1)-LEN(SUBSTITUTE(A1," ","")))))
    Still needs an error check for a single-word "sentence" and to remove the trailing period but it does seem to work. Pretty slick.
    Message was edited by: Badunit
    I see below that the problem was fixed by the OP.
    Message was edited by: Badunit

  • Index of word in a String

    How can I find the index of a word in a String?
    E.g.
    String a = "This is a book";
    In this the index of word "is" is 5 not 2.
    A word is a sequence of char separated from other char sequences by a one of " \t\n\r\f", i.e. the default StringTokenized delimiters.
    Regards,
    Lokesh

    Yes something like this.
    This is how I solved it
      private static final String WORD_DELIM = " \t\n\r\f,.;:";
      private int getIndexOfWord(String str, String text) {
        StringTokenizer tokenizer     = new StringTokenizer(str, WORD_DELIM, true);
        String token;
        StringBuffer previousContents = new StringBuffer();
        while(tokenizer.hasMoreTokens()) {
          token = tokenizer.nextToken();
          if(startsWithWord(text, token)) {
            break;
          previousContents.append(token);
        if(previousContents.length() == 0) {
          return -1;
        } else {
          return previousContents.length();
      private boolean startsWithWord(String word, String token) {
        //The token must start with "word"
        if(!token.startsWith(word)) {
          return false;
        //Now rplace all delimiters by blanks
        int delimCount = WORD_DELIM.length();
        char c;
        for(int i = delimCount - 1; i >= 0; i--) {
          c     = WORD_DELIM.charAt(i);
          token = token.replace(c, ' ');
        //Finally get rid of the blanks.
        token = token.trim();
        if(token.equals(word)) {
          return true;
        return false;

  • Replace complete words by another string

    Hi,
    I'm searching for a possibility to replace complete words inside a string.
    For example I want to replace "quick" by "slow":
    "The <b>quick</b> brown fox is running quicker then the slow brown fox".
    The result shall be:
    "The <b>slow</b> brown fox is running quicker then the slow brown fox".
    The problem is, that the built in "Replace"-Method would also replace "quicker" by "browner".
    Furthermore, words beetween different signs (e.g. , . ; : - ! " ? ') shall also be found as complete word.
    I already searched for a FM but didn't find anything. Regular expressesions are also not possible because we are running on 6.40.
    Maybe anybody can help me with a simple FM or something else.
    Best regards,
    Stefan

    Hi Stefan,
    There is a crude way of doing this....with lots of loops..
    You can use the SPLIT statement
    SPLIT dobj AT sep INTO
          { {result1 result2 ...} | {TABLE result_tab} }
          [IN {CHARACTER|BYTE} MODE].
    and break the sentence into words using space as delimiter. Once you have all the words in a internal table, you can loop through it and compare each word with the word you want.
    This will solve the problem, but will not be performant enough.
    Regards,
    Vinodh

Maybe you are looking for

  • Why can't I get this for iPhone, you don't do much for iphones

    Why isnt firefox desktop available for iPhone. ???

  • Where did my photo library go

    So was on vacation during update, came back 2 weeks later, cannot find all the photos I had on my Mac, does anybody know why and more importantly how can I retrieve them?

  • Sudden restart Macbook - TransmitDisk?

    Hi, My MacBook just rebooted. Does anybody knows what the problem could be? Is this the TransmitDisk app? Below is the error report: Interval Since Last Panic Report:  738739 sec Panics Since Last Report:          1 Anonymous UUID:                   

  • BIG PDF Files when printing to PDF in PowerPoint

    Using the internal Print to PDF function in OSX, i get HUGE files (e.g. a 400K PPT document printed in normal quality to PDF gets as big as 21 MB). Compressing the file with PDFShrink brings it down to 7MB - still far to big to send Handouts to my St

  • How to block inventory at sales order level

    Hi to all,             i am using sapb1 2005 pl36 i want to block invetory at sales order level means what i want, if any user create sales order of item1 if instock qty of that item1 is 10 and commited is 10 then availabale inventory is 0 nos .means