12-03-2007 10:14 AM
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
12-03-2007 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
12-03-2007 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
12-03-2007 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
12-03-2007 11:58 AM
Hi prashant,
can u tell me what is sinificance of ignorance case and respecting case in below statements?
FIND p IN c IGNORING CASE.
FIND p IN c RESPECTING CASE.
Thanks & Regards
Priyalatha