ABAPFIND_ITAB - FIND ITAB

rdisp/max_wprun_time - Maximum work process run time   RFUMSV00 - Advance Return for Tax on Sales/Purchases  
This documentation is copyright by SAP AG.

FIND IN TABLE itab

Short Reference



Syntax

FIND [{FIRST OCCURRENCE}|{ALL OCCURRENCES} OF] pattern
  IN TABLE itab [table_range]
  [IN {CHARACTER|BYTE} MODE]
  [find_options]
.

Effect

The program searches the internal table itab line by line for the character- or byte string defined in pattern. itab is afunctional operand position.

itab must be a standard table without secondary table keys. The lines of the table must be either byte-type or character-type, dependingon which of the additions CHARACTER or BYTE MODE is used. The search does not recognize character- or byte strings that span more than one line of the table.

With the addition table_range,the search range can be restricted to the table. The addition MATCH LINE The remaining additionshave the same meaning for the search in the individual table rows as the statement FINDfor elementary character- and byte strings. If the further addition MATCH LINE is used, the row number of a match position is returned.

The search is ended when the search string is found for the first time or when all search strings in the search range have been found, or if the end of the search range is reached. The search result is made available by setting sy-subrc.

When character strings are processed, the closing blanks are taken into account for line types of fixed length.

Note

Searching with FIND IN TABLE is more effective than performing a LOOPand searching in each row with FIND.

System fields

sy-subrcExplanation
0The search string was found at least once in the search range.
4The search string was not found in the search range.

The values of sy-tabix and sy-fdpos are not changed.

Example

Search for all occurrences of Donald's nephews in an internal table and save the results in the table results.

DATA: itab    TYPE TABLE OF string,
      results TYPE match_result_tab.

...

FIND ALL OCCURRENCES OF REGEX '\b(Huey|Dewey|Louie)\b'
  IN TABLE itab
  RESPECTING CASE
  RESULTS results.

Exceptions

Catchable Exceptions

CX_SY_RANGE_OUT_OF_BOUNDS

  • Cause: Impermissible offset or length specification in the addition SECTION OF.
    Runtime Error: REFI_WRONG_SECTION (catchable)

CX_SY_TAB_RANGE_OUT_OF_BOUNDS

  • Cause: Impermissible offset or length specification in the addition FROM... OFFSET ... TO OFFSET.
    Runtime Error: INVALID_TABLE_RANGE

CX_SY_INVALID_REGEX

  • Cause: Impermissible expression after the addition REGEX.
    Runtime Error: INVALID_REGEX







PERFORM Short Reference   CPI1466 during Backup  
This documentation is copyright by SAP AG.


Length: 5443 Date: 20120522 Time: 055440     triton ( 182 ms )