Skip to Content
author's profile photo Former Member
Former Member

example of find itab

Hi Guru's,

can anybody explains me and give me a sample program of below syntax please?

i want to know how exactly it works?

please can anybody help me?

FIND IN TABLE itab

Syntax

FIND [{FIRST OCCURRENCE}|{ALL OCCURRENCES} OF] pattern

IN TABLE itab [table_range]

[IN {BYTE|CHARACTER} MODE]

[{RESPECTING|IGNORING} CASE]

[MATCH COUNT mcnt]

{ {[MATCH LINE mlin]

[MATCH OFFSET moff]

[MATCH LENGTH mlen]}

| [RESULTS result_tab|result_wa] }

[SUBMATCHES s1 s2 ...].

Thanks & Regards

Priyalatha

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 03, 2007 at 11:08 AM

    Hi hope this can help you

    Example

    DATA: text TYPE STRING.

    text = 'Everyone knows this'.

    <b>FIND 'know' IN text.</b>

    The search was successful. The field sy-subrc is set to 0.

    System values

    sy-subrc = 0

    The search string was found in the target field.

    sy-subrc = 4

    The search string was not found in the target field.

    sy-subrc = 8

    This return value occurs only in systems with a multi-byte code page. The content of the search string in this case is an invalid multi-byte string.

    Depending on whether byte or character string processing is carried out, the operands can only be byte-type or character-type.

    <b>... MATCH OFFSET off.</b>

    Effect

    If the search string p is found in the target field c, the position in the string where it first occurred is stored in off.

    Example

    DATA:

    c TYPE STRING,

    p(2) TYPE C,

    off TYPE I.

    c = 'Everyone knows this'.

    p = 'ne'.

    FIND p IN c MATCH OFFSET off.

    After the search, off = 7 and sy-subrc = 0.

    <b> MATCH LENGTH len.</b>

    Effect

    The length of the search string p is stored in the field len.

    Example

    DATA:

    c TYPE STRING,

    p(2) TYPE C,

    off TYPE I,

    len TYPE I.

    c = 'Everyone knows this'.

    p = 'ne'.

    FIND p IN c MATCH OFFSET off MATCH LENGTH len.

    After the search, sy-subrc = 0, off = 7, len = 2.

    REWARD POINTS IF USEFUL

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Dec 03, 2007 at 11:13 AM

    Hi,

    Refer these statements

    DATA: text TYPE STRING.

    text = 'Everyone knows this'.

    FIND 'know' IN text.

    DATA:

    c TYPE STRING,

    p(2) TYPE C.

    c = 'Everyone knows this'.

    p = 'NO'.

    FIND p IN c IGNORING CASE.

    DATA:

    c TYPE STRING,

    p(2) TYPE C.

    c = 'Everyone knows this'.

    p = 'NO'.

    FIND p IN c RESPECTING CASE.

    DATA:

    c TYPE STRING,

    p(2) TYPE C,

    off TYPE I.

    c = 'Everyone knows this'.

    p = 'ne'.

    FIND p IN c MATCH OFFSET off.

    DATA:

    c TYPE STRING,

    p(2) TYPE C,

    off TYPE I,

    len TYPE I.

    c = 'Everyone knows this'.

    p = 'ne'.

    FIND p IN c MATCH OFFSET off MATCH LENGTH len.

    Regards,

    Prashant

    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.