Docsity

Fields and Variables - Advanced Business Application Programming - Lecture Slides, Slides of Computer Programming

Partial preview of the text

Download Fields and Variables - Advanced Business Application Programming - Lecture Slides and more Slides Computer Programming in PDF only on Docsity!

Introduction ABAP

Fields and Variables

Fields (Introduction)

 In ABAP, fields (or data objects) are named locations in memory  Variables store data that might change  Constants store data that does not change  As before, fields are declared with the DATA keyword

 KEEP IN MIND THAT ABAP IS A „BUSINESS‟

PROGRAMMING LANGUAGE

Fields (Characteristics)

 They nave a name  A defined length  And a data type  And possibly a length  And possibly an initial value

Fields (Primary Data Types)

Packed Numbers (Example)

DATA packed16 TYPE P LENGTH 7 DECIMALS 2. packed16 = '12121219.12'. WRITE packed16.

 Produces

LIKE

 Declare a variable having the dame data type as another variable  Makes it easier to change data types

DATA demo16instance1 LIKE packed16. DATA demo16instance2 LIKE packed16.

Arithmetic (Type Conversion)

 Looks like any other arithmetic expression (plus the space requirements)  SAP calls this compatible and convertible data types  Compatible types have the same data type, field type, …  Comparable types are converted using conversion rules (See handout)

Type Coercion (1)

 The following produces “1” because the result is rounded to an int

Numeric

Overflow

Outcome