SAP CASE FUNCTIONS



Get Example source ABAP code based on a different SAP table
  


• to_lower ABAP_FUNCTION
• to_upper ABAP_FUNCTION
• to_mixed ABAP_FUNCTION
• from_mixed ABAP_FUNCTION
• sep to_mixed function
• case to_mixed function
• min to_mixed function
• sep from_mixed function
• case from_mixed function
• min from_mixed function

ABAP_STRINGFUNC - to_upper, to_lower,to_mixed, from_mixed

ABAP_SYNTAX
1. ... to_upper( $[val =$] text ) ...
2. ... to_lower( $[val =$] text ) ...
3. ... to_mixed( $[val =$] text $[sep = sep$] $[case = case$] $[min = min$] ) ...
4. ... from_mixed( $[val =$] text $[sep = sep$] $[case = case$] $[min = min$] ) ...

What does it do?
These built-in functions return the character string from text after it has been converted in accordance with the following case rules:
The function to_upper transforms all letters in the character string to uppercase letters.
The function to_lower transforms all letters in the character string to lowercase letters.
The function to_mixed transforms all letters in the character string to lowercase letters from the second position. Then, from left to right from the second position, it removes occurrences of the first character specified in sep from the character string and transforms the next letter to an uppercase letter. The default value for separator sep is an underscore (_). If case is not specified, the first character of the string remains unchanged. If case is specified and the first character of case is an uppercase letter, the first character in the string is also uppercase and otherwise lowercase. A positive number can be passed to min to specify a minimum number of characters that must appear before a separator from the start of the string or since the last replacement so that it works as described. The default value for min is 1.
The function from_mixed inserts the first character specified in sep before each uppercase letter from left to right and from the second position. The default value for separator sep is an underscore (_). If case is not specified or if the first character in case is an uppercase letter, the entire string is transformed to uppercase, otherwise to lowercase. A positive number can be passed to min to specify a minimum number of characters that must appear before an uppercase letter from the start of the string or since the last insert so that a separator is inserted. The default value for min is 1.
sep is a character-like expression position. If they have a fixed length, trailing blanks are ignored. min is a numeric expression position of type i. case expects a character-like data object with fixed length. val = can be omitted only if none of the optional arguments are specified. If sep is an empty string or if min is negative, an exception of class CX_SY_STRG_PAR_VAL is raised.
The return value has the type string.



Latest notes:

The functions to_mixed and from_mixed are intended for transforming standard ABAP naming conventions for names with underscores to standard Java naming conventions with uppercase and lowercase letters (Mixed Case Style and Camel Case Style) and vice versa.
NON_V5_HINTS
ABAP_HINT_END

ABAP_EXAMPLE_VX5
Outputs the Latin alphabet in lowercase letters.
ABEXA 00849
ABAP_EXAMPLE_END

ABAP_EXAMPLE_ABEXA
String Functions, to_mixed and from_mixed
ABAP_EXAMPLE_END



Runtime Exceptions



Catchable Exceptions
CX_SY_STRG_PAR_VAL
Reason for error:
The separator in sep is empty or the minimum number in min is negative.
Runtime error:
STRG_ILLEGAL_PAR