Docsity

ABAP Strings: Declaration, Conversion, Operations, and Examples, Slides of Computer Programming

Partial preview of the text

Download ABAP Strings: Declaration, Conversion, Operations, and Examples and more Slides Computer Programming in PDF only on Docsity!

Introduction ABAP

Strings

Introduction (Strings)

 There are three character-based data types

 c stores character fields of a fixed length

 n stores numeric character fields of a fixed

length

 Fields that contain only number but are not

really numeric (telephone number)

 Data is right aligned and leading zeros are

inserted

 string stores variable length strings

String Conversion

 When converting a character string „c‟ to a „n‟

string, only the digits are copied

 The field is right justified

 The field is padded with leading zeros

String Operations

 Remember that this is a business language

 Strings are “padded” into fixed-length string

fields

 We can move characters in a string (SHIFT)

 Replace substrings (REPLACE)

 Pack and concatenate strings

 Split strings

String Operations (REPLACE)

 REPLACE string1 IN varname WITH string  Replaces string1 WITH string

String Operations

(CONDENSE)

 Deletes redundant spaces from a string

 Leading spaces are deleted

 NO-GAPS removes all spaces

 CONDENSE c [NO-GAPS]

String Operations (SPLIT)

 SPLIT c AT del INTO c1 … cn

 Splits string c using the delimiter del into a list

of variables

 Ok, this is hokey. We need to provide enough

output fields for the record.