SAP ABAP provides a wide range of string handling operations to manipulate and process character data. Below are some of the most commonly used string manipulation keywords and functions, along with syntax and examples.
1️⃣ SHIFT
The SHIFT
keyword shifts the characters of a string to the left or right, removing leading or trailing characters.
πΉ Syntax:
πΉ Example:
Output: 1000
π Note: The size of the string variable must match the size of the actual string value.
2️⃣ TRANSLATE
The TRANSLATE
keyword changes the case of characters in a string (uppercase to lowercase and vice-versa).
πΉ Syntax:
πΉ Example:
Output: satya
3️⃣ REPLACE
The REPLACE
keyword substitutes part of a string with another string.
πΉ Syntax:
πΉ Example:
Output: one thousand dollars
4️⃣ STRLEN
The STRLEN
function returns the length of a string.
πΉ Syntax:
πΉ Example:
Output: 5
5️⃣ OFFSET Functionality
Access specific characters or substrings using offset and length.
πΉ Examples:
π This is useful for substring operations.
6️⃣ SPLIT
The SPLIT
keyword breaks a string into multiple parts using a delimiter.
πΉ Syntax:
πΉ Example:
Output:
7️⃣ CONCATENATE
The CONCATENATE
keyword joins two or more strings into one, with or without separators.
πΉ Syntax:
πΉ Example 1:
Output: 20.09.2014
πΉ Example 2:
Output: 20.09.2014
8️⃣ CONDENSE
The CONDENSE
keyword removes unnecessary spaces in a string. When used with NO-GAPS
, it removes all spaces.
πΉ Syntax:
πΉ Example:
Output: satyanarayana
π Assignment
Print the following pattern:
π‘ Use nested loops and concatenation to generate the pattern.
No comments:
Post a Comment