String Operations:
String is the variable
length data type
Dynamic memory management is
used internally i.e the memory allocation at the run time according to the
current field content
Note: we can’t declare the
string variable through PARAMETER
PARAMETER p_name type
String. Is not allowed because the system can’t understand how big it is
Difference between the
character and string:
Character
|
String
|
Data: v1 type cahr50.
V1 = ‘Career it’.
Here memory is always
allocated for 50 characters irrespective of number of characters should be
stored currently
|
Data:v1 type string.
V1 = ‘Career it’.
Here memory is allocate
for ‘Career it’ only because always string size depends on number of
characters should be stored currently
|
CONCATENATE: to join more than one substring into one variable
Syntax:
CONCATENATE <String1> <string2>………<string N> into <str> separated by <Separator>
Ex :
*&---------------------------------------------------------------------*
*& Report Z_STRING_OPERATIONS
*& Serkan AKKAVAK
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
REPORT Z_STRING_OPERATIONS NO STANDARD PAGE HEADING.
*//declare varibles
data :str1 type string.
*//concatenating the strings
CONCATENATE 'Career it' 'Ammerpet' 'hyd' INTO str1 SEPARATED BY ','.
*//Displaying output
write:/ str1.
CONCATENATE <String1> <string2>………<string N> into <str> separated by <Separator>
Ex :
*&---------------------------------------------------------------------*
*& Report Z_STRING_OPERATIONS
*& Serkan AKKAVAK
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
REPORT Z_STRING_OPERATIONS NO STANDARD PAGE HEADING.
*//declare varibles
data :str1 type string.
*//concatenating the strings
CONCATENATE 'Career it' 'Ammerpet' 'hyd' INTO str1 SEPARATED BY ','.
*//Displaying output
write:/ str1.
Serkan AKKAVAK
Computer Engineer
serkurumsal@yandex.com
Social Plugin