Preview

Sap Abap- Usage of String and Xstring

Good Essays
Open Document
Open Document
1366 Words
Grammar
Grammar
Plagiarism
Plagiarism
Writing
Writing
Score
Score
Sap Abap- Usage of String and Xstring
what it is, how and when to use each piece of code. First, let’s understand String Handling.

What, How, When to Use a String

A String is a variable length data type which is used to store any length of data. Variable length fields are used because they save space.
Example:
Raj is 3 characters long, Vemuri Rajgopal is 14 character long. With fixed-length fields, you need to define each field to be long enough to hold the longest name. This would waste space for records that had short names. In variable length fields it stores the exact length of the string. • String, can store any number of characters. String will allocate the memory at runtime which is also called as dynamic memory allocation, will allocate the memory as per the size of the string. Strings cannot be declared using parameters as the memory of allocation is dynamic. • RFC(Remote Function Call) type for string is RFC_String. RFC is a interface for communication between a SAP system and other SAP or third party compatible system. • The XSD type for string is xsd:string. • To convert a string to xstring we use the function module scms_string_to_xstring
Syntax:
DATA [()] TYPE [DECIMALS ]… [VALUE ].
Example:
DATA : V_NAME TYPE STRING.
V_NAME = ‘RAJ’.
Memory is allocated only for RAJ, which always depends on the number of characters stored currently.
Advantages of using a String: • Efficient management of string storage space. • String values are stored separately from variables in memory.
Operations Of Strings: • Concatenate : To club more than one sub string into one main string.
Syntax :
Concatenate ….. into separated by a .
Example :
Concatenate ‘code’ ‘excellence’ into s_name separated by ‘,’.
Output : code,excellence • Condense : Replaces sequence of spaces into one space.
Syntax :
Condense ‘ ’.
Example:
1. Condense ‘code excellence’.
- All the blanks in the above example are converted into a single

You May Also Find These Documents Helpful