Skip to Content

SHIFT statement

Hi,

I have a string value like this. /usr/sap/temp/test.txt .

I want the text before the last slash / .

I mean, I want /usr/sap/temp into one variable.

There can be any number of slash / symbols in the main text. But, I need only the text before the last slash /. I think, we have to use SHIFT statement to do this. But, I am not able to get it. Can someone help me on the same. it is quite urgent. Please share your thoughts.

Thanks & Regards,

Paddu.

Edited by: Paddu K on Feb 13, 2008 7:45 PM

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • Posted on Feb 13, 2008 at 01:34 PM

    Hi,

    Check FM SO_SPLIT_FILE_AND_PATH

    Thanks

    Lakshman

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Feb 13, 2008 at 01:39 PM

    Try using SPLIT statement.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Apr 08, 2008 at 03:44 PM

    Hi,

    Try this one,It will work

    DO.
            FIND '\' IN SECTION OFFSET l_offset OF p_file MATCH OFFSET l_off
                                                          MATCH LENGTH l_length .
            IF sy-subrc EQ 0.
              l_offset = l_off + l_length .
            ELSE.
              p_file = p_file(l_offset).
              EXIT.
            ENDIF.
          ENDDO.

    in the above code p_file is the file path.

    Thanks,

    Balaji.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.