In SAP ABAP, you can convert a string to lowercase using the TO LOWER CASE statement or the TRANSLATE statement. Here are the different methods to achieve this:

1. Using TO LOWER CASE (ABAP 7.40 and Above)

The TO LOWER CASE statement is the simplest and most straightforward way to convert a string to lowercase in ABAP 7.40 and higher versions.

DATA: lv_string TYPE string VALUE 'HELLO ABAP'.
lv_string = lv_string TO LOWER CASE.
WRITE: lv_string. " Output: hello abap

2. Using TRANSLATE (Older ABAP Versions)

For versions earlier than ABAP 7.40, you can use the TRANSLATE statement to convert the string to lowercase.

DATA: lv_string TYPE string VALUE 'HELLO ABAP'.
TRANSLATE lv_string TO LOWER CASE.
WRITE: lv_string. " Output: hello abap

3. Using cl_abap_codepage (For Code Page Specific Lowercase Conversion)

If you’re working with non-ASCII characters or need to handle code-page specific conversions, you can use the class cl_abap_codepage.

DATA: lv_string TYPE string VALUE 'HELLO ABAP',
lv_lowercase TYPE string.
lv_lowercase = cl_abap_codepage=>convert_to( iv_value = lv_string iv_direction = 'U' ). " To lowercase
WRITE: lv_lowercase. " Output: hello abap

Best Practices

MethodBest ForVersion
TO LOWER CASESimple conversion to lowercaseABAP 7.40 and later
TRANSLATE TO LOWER CASEOlder ABAP versionsPre-ABAP 7.40
cl_abap_codepageCode page specific lowercase conversionHandling non-ASCII chars