Skip to Content
Author's profile photo Horst Keller

Reminder: ABAP Built-in Functions

The ABAP language offers so many features that you easily can lose track of them all. A recent discussion showed that. The task is some operation on a character string and the question was how to achieve that. The first answer was to do it with regular expressions, and I guess I would have answered the same. Regular expression are general and powerful and you can achieve almost anything you want in finding and replacing characters in strings. They can be easily tested with programs DEMO_REGEX and DEMO_REGEX_TOY. Because of that one can easily forget that there are other more simple and performant means for accomplishing many fundamental tasks. Another answer pointed that out: There is a wealth of built-in functions available in ABAP, especially for string processing, that can be used for many requirements. Those functions can be nested and can use expression (especially string and regular expressions) as operands. If you do not want to break a butterfly on a wheel, built-in functions can help you in many cases to achieve your results.

As a reminder I copied the overview of the built-in functions from the documentation below. Check also the examples in the respective sections of the documentation.

Built-in Functions – Overview


The following tables show the predefined functions by purpose. Predefined functions are generally processing functions or description functions.

  • A processing function performs general processing and returns a return code according to its purpose.
  • A description function determines a property of an argument and usually returns this property as a numeric value.

Furthermore, there are logical functions that either are boolean functions that evaluate a logical expression or predicate functions that return a truth value.

Logical Functions


Function Meaning
boolc, boolx, xsdbool Boolean functions
contains, contains_any_of, contains_any_not_of Predicate functions for strings
matches Predicate function for strings
line_exists Predicate function for internal tables

More


Numeric Functions


Function Meaning
abs, ceil, floor, frac, sign, trunc General numeric functions
ipow Integer power function
nmax, nmin Numeric extremum functions
acos, asin, atan, cos, sin, tan, cosh, sinh, tanh, exp, log, log10, sqrt Floating point functions
round, rescale Rounding functions

More


String Functions


Function Meaning
charlen, dbmaxlen, numofchar, strlen Length functions
char_off Length function
cmax, cmin Character-like extremum value functions
count, count_any_of, count_any_not_of Search functions
distance Similarity function
condense Condense function
concat_lines_of Concatenation function
escape Escape function
find, find_end, find_any_of, find_any_not_of Search functions
insert Insert function
match Substring function
repeat Repeat function
replace Replace function
reverse Reverse function
Segment Segment function
shift_left, shift_right Shift functions
substring, substring_after, substring_from, substring_before, substring_to Substring functions
to_upper, to_lower, to_mixed, from_mixed Case functions
translate Translation function

More


Byte String Functions


Function Meaning
xstrlen Length function
bit-set Bit function

More


Table Functions


Function Meaning
lines Row function
line_index Index function

More

Assigned Tags

      4 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Peter Inotai
      Peter Inotai

      Hi Horst,

      Very nice overview. Thanks!

      Is there an overview regarding in which release/SP they are available? For string processing I'm kind of sure about 7.02.

      For the rest I'm not sure if we have it or when it's available. Is there a better way than checking release specific changes?

      Thanks,

      Peter

      Author's profile photo Horst Keller
      Horst Keller
      Blog Post Author

      Is there a better way than checking release specific changes?


      Unfortunately no. One of the things that I'm aware of but kicking down the road ...

      Author's profile photo Peter Inotai
      Peter Inotai

      OK, thanks.

      Author's profile photo Pavlo Astashonok
      Pavlo Astashonok

      Yes, it is one of the ugly things of ABAP: we cannot check in which release the certain syntax element got deprecated and when it became available first. And for cloud releases there is a very handy search tool which allows filtering easily. Why on-prem ABAP developers are so discriminated? 🙂