Skip to content

ABAP Keyword Documentation →  ABAP − Reference →  Processing Internal Data →  Character String and Byte String Processing →  Expressions and Functions for String Processing →  String Functions →  Processing Functions for Character-Like Arguments 

repeat - Repeat Function

Other versions: 7.31 | 7.40 | 7.54

Syntax


... repeat( val = text  occ = occ ) ...

Effect

This function returns a character string that contains the content of text as many times as specified in occ. If text is an empty string or if occ contains the value 0, an empty string is returned.

occ is a numeric expression position of type i. If the value of occ is negative, an exception of the class CX_SY_STRG_PAR_VAL is raised.

The return code has the type string.


Note

The parameter occ has a different meaning here than in functions used for searching.


Example

The function repeat is used to create a string with ten blanks.

DATA(result) = repeat( val = ` ` occ = 10 ). 

Exceptions

Handleable Exceptions

CX_SY_STRG_PAR_VAL

  • Cause: Occurrences in occ are less than 0.
    Runtime error: STRG_ILLEGAL_PAR