1 / 10

Introduction ABAP Strings

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)

blanca
Télécharger la présentation

Introduction ABAP Strings

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Introduction ABAP Strings

  2. Introduction (Strings) • There are three character-based data types • cstores 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

  3. String Declaration (Example) • Declare a two character string • DATA state TYPE c LENGTH 2. • TYPE LIKE and VALUE keywords continue to apply • DATA state TYPE c LENGTH 2 VALUE ‘nv’.

  4. 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

  5. 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

  6. String Operations (SHIFT) • SHIFT varname [BY n PLACES] [mode] • Where mode is LEFT, RIGHT, or CIRCULAR • If n is omitted, the default value is 1 • If mode is omitted, the default mode is LEFT • Optional clause • DELETING [LEADING | TRAILING] str

  7. String Operations (REPLACE) • REPLACE string1 IN varname WITH string2 • Replaces string1 WITH string2

  8. String Operations (CONDENSE) • Deletes redundant spaces from a string • Leading spaces are deleted • NO-GAPS removes all spaces • CONDENSE c [NO-GAPS]

  9. String Operations (CONCATENATE) • CONCATENATE c1 … cn INTO c [SEPARATED BY] s • Concatenates the list of strings into an output string • s is inserted as the character seperator

  10. 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.

More Related