CONDENSER: replace the sequence of spaces into one space
Ex: CONDENSER ‘Career                it’.
Result: Career it
Ex: CONDENSER ‘Career                it’ NO-GAPS.
Result: Careerit
TRANSLATE: to translate to UPPER / LOWER case
*&---------------------------------------------------------------------*
*& Report  Z_STRING_OPERATIONS
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*

REPORT  Z_STRING_OPERATIONS NO STANDARD PAGE HEADING.
*//declare varibles
data :str1 type string.
* Assigning values to those variables
str1 = 'career it'.

*//Traslate the string into Uppercase
TRANSLATE str1 TO UPPER CASE.
*//Displaying output
write:/ str1.
 
 
REPLACE:
Syntax :
REPLACE <str1> with <str2> into <str>.
*&---------------------------------------------------------------------*
*& Report  Z_STRING_OPERATIONS
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*

REPORT  Z_STRING_OPERATIONS NO STANDARD PAGE HEADING.
*//declare varibles
data :str1 type string,
      str2 
type string,
      str3 
TYPE string.
* Assigning values to those variables
str1 = 
'c'.
str2 = 
'i'.
str3 = 
'Career it'.

*//Replaceing the stings
REPLACE  str2 WITH str1 INTO str3.
*//Displaying output
write:/ str3.

SPLIT: to split the main string into substrings at the given separator
SPLIT <String> AT <separator> into <str1> <str2>…….<str N>.
*//declare varibles
data :v_id TYPE char20,
      v_name 
TYPE char20,
      v_place 
TYPE char20,
      v_city 
TYPE char20.
*//Calling the split
SPLIT 'c001, Careerit, ammerpet, hyd ' at ',' INTO v_id v_name v_place v_city.
*//Displaying output
write: v_id, v_name, V_place, v_city.

SHIFT: By default shift to left by one place
SHIFT <str> <LEFT/RIGHT/CIRCULAR> by <N> places. (N>0)
SHIFT <str> LEFT DELETING LEADING <CHAR>
SHIFT <str> RIGHT DELECTING TRAILING <CHAR>.

SEARCH: searches for the required main string in the main string
SEARCH <str> FOR <str1>.
SEARCH string1 FOR string2 STARTING AT position1 ENDING AT position 2.
-       position1 and position2 are starting ending line of internal tables.



Comparing strings:
                Operator
Description
                   CO
Contains only
                   CN
Contains not only
                   CA
Contains any
                   NA
Contains not only
                   CS
Contains String
                    NS
Contains no String
                    CP
Matches pattern
                    NP
Does not Matches pattern

CO(Contains only):
IF <str1> CO <str2>.
Is TRUE if string1 contains only the characters from string2 the comparison is case sensitive including spaces
If the comparison  is true then the system field SY-FDPOS contains the length of string1
If it is false then SY-FDPOS contains the offset of the first character of string1 that does not occur in string2
 
Examples:
 
         'AABB' co 'AB' True
         'ABCD' co 'ABC' False
         'AABB' cn 'AB' False
         'ABCD' cn 'ABC' True
         'AXCZ' ca 'AB' True
         'ABCD' ca 'XYZ' False
         'AXCZ' na 'ABC' False
         'ABCD' na 'XYZ' True 


 

Serkan AKKAVAK
Computer Engineer
serkurumsal@yandex.com