• You are here:
  • Home »
  • ABAP »

Stop SAP ABAP parameter values converting to uppercase

Advertisements

You may have noticed that with a standard ABAP parameter which is type char/text/string always converts the entered value to uppercase. So if the user enters the text in Uppercase, lowercase or a mixture of both it will always get converted to UPPERCASE.

Advertisements

For example, using the standard ABAP parameter code

PARAMETERS: p_val(20) TYPE c,
            p_val2 TYPE string.

If the user enters the following text into the parameters:

It will be stored in the parameter field all in upper case

Advertisements

How to fix the ABAP parameter always converting to uppercase

The solution to this is very simple, you just need to add the “LOWER CASE” keyword to the parameter declaration

Advertisements
i.e.
PARAMETERS: p_val(20) TYPE c LOWERCASE,
            p_val2 TYPE string LOWERCASE.

Advertisements

The LOWER CASE keyword also allows uppercase

But note just because you add the LOWER CASE keyword it still allows uppercase entry. In-fact it will store the value in exactly the same case as it is entered by the user.

So if they enter the text like this with a mix of upper and lower case characters

When you look at the parameter value via debug it will contain the text exactly as the user entered it.

Advertisements