Skip to Content

How to use "FIND FIRST OCURRENCE...." with a very long text

When I store a certain text in variable p_texto -> FIND FIRST OCURRENCE is ok; sy-subrc = 0.

When Instead of assigning a text I read a long text from an excel into p_texto variable ->

FIND FIRST OCURRENCE is not working; sy-subrc = 4.

DATA: p_texto(5000).

DATA: posicion TYPE match_result.

p_texto = 'HI THIS IS THE FIRST LINE#AND THIS ONE THE SECOND LINE'.

FIND FIRST OCCURRENCE OF '#' IN p_texto RESULTS posicion.

How could I manage this problem?

Thank you very much in advance.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Dec 13, 2011 at 01:12 PM

    Hi Jarizkuren ,

    in your text, string "#" is the rapresentation of characters that cannot be displayed in sap.

    Probably you should search for

    CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB

    CL_ABAP_CHAR_UTILITIES=>NEWLINE

    CL_ABAP_CHAR_UTILITIES=>CR_LF

    regards

    Andrea

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Dec 13, 2011 at 01:57 PM

    HI Jari,

    I think you can try using FIND FIRST OCCURANCE......IN BYTE MODE instead of default character mode.

    And for this, the pattern you are searching and the data object from you want to search has to be Byte-Like.

    Thanks,

    Anishek Kumar

    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.