Ansicht
Dokumentation

ABENCOUNT_FUNCTIONS - COUNT FUNCTIONS

ABENCOUNT_FUNCTIONS - COUNT FUNCTIONS

TXBHW - Original Tax Base Amount in Local Currency   CL_GUI_FRONTEND_SERVICES - Frontend Services  
This documentation is copyright by SAP AG.
SAP E-Book

- count, count_...

1. ... count( val = text ${ sub = substring$}$|${ pcre = regex$} $[case = case$]
             $[ off = off$] $[len = len$] ) ...

2. ... count_any_of( val = text  sub = substring
                    $[off = off$] $[len = len$] ) ...

3. ... count_any_not_of( val = text  sub = substring
                        $[off = off$] $[len = len$] ) ...


Effect

The built-in search functions count and count_... search text in the same way as the corresponding search functions find and find_..., either in the entire string text or in a subarea defined using off and len for characters specified in substring or for a match with a regular expression specified in regex. Instead of an offset, they return the number of all occurrences.

If the argument pcre is used, regex must contain a PCRE regular expression. A regular expression in PCRE syntax is compiled in an extended mode: Most unescaped whitespace (blanks and line breaks) of the pattern are ignored outside character classes and comments can be placed behind #. In order to include whitespace and # in a pattern, they must be escaped or the extended mode must be switched of with (?-x) in the regular expression.

The return value has the type i.

Note

Besides pcre, also the obsolete argument regex can be used. Then an obsolete POSIX regular expression must be passed.

The result of the following function calls is 1, 3, and 6.

Example

The result of the first counting is 2 because the PCRE regular expression handles the surrogate pair in the character string as two characters by default. When counting with a regular expression that is introduced with (*UTF), the result is 1, because the surrogate pair is interpreted as one UTF-16 character.

String Functions, count, find and match

Exceptions

Catchable Exceptions

CX_SY_RANGE_OUT_OF_BOUNDS

  • Cause: Illegal offset or length specified in off and len.
    Runtime Error: STRING_OFFSET_TOO_LARGE

CX_SY_REGEX_TOO_COMPLEX

CX_SY_STRG_PAR_VAL

  • Cause: Substring in sub or regular expression in regex is empty or occurrence in occ is 0.
    Runtime Error: STRG_ILLEGAL_PAR





CL_GUI_FRONTEND_SERVICES - Frontend Services   Vendor Master (General Section)  
This documentation is copyright by SAP AG.

Length: 6340 Date: 20240420 Time: 073429     sap01-206 ( 68 ms )