Академический Документы
Профессиональный Документы
Культура Документы
ABAP/4 Programming
Fall 1998
CSU Chico
SAP AG
Overview
Introduction Declaration
Data Types
elementary complex
CSU Chico
SAP AG
Data Objects
Data Object
Fixed
Variable
CSU Chico
SAP AG
Data Objects
Data Object
Fixed
Variable
Literals
Constants
CSU Chico
SAP AG
CSU Chico
SAP AG
Hierarchy
Table is made up of Records(s) is made up of have a structure Field(s) is made up of characters have a type
CSU Chico
SAP AG
CSU Chico
SAP AG
Normal Scope
Line 1 2 Program DATA A, B, C Write A Write F Form DATA X, Y, Z Write A Write F Form DATA D, E, F Write A Write F
3 4
According to normal rules of scope, which Write statements are legal and which are not?
5 6
CSU Chico
SAP AG
Data Types
Pre-defined (p,i,f,c,n,d,t,x)
User defined
Elementary
Structured
Structured type
Table type
CSU Chico
SAP AG
Data Types
Pre-defined (p,i,f,c,n,d,t,x)
User defined
Elementary
Structured
Structured type
Table type
CSU Chico
SAP AG
Pre-defined Types
(with default length and value)
Character
c n Numbers
i p f
00000000 left
CSU Chico
SAP AG
Data Types
Pre-defined (p,i,f,c,n,d,t,x)
User defined
Elementary
Structured
Structured type
Table type
CSU Chico
SAP AG
existing fields
CSU Chico
SAP AG
END OF rec-name
CSU Chico
SAP AG
Similar Declarations
Data: customer_name(25) type c, vendor_name(25) type c.
CSU Chico
SAP AG
CSU Chico
SAP AG
Character: C vs N
C = justifies left and has trailing blanks N = justifies right and has leading zeroes
CSU Chico
SAP AG
CSU Chico
SAP AG
Numbers
i - cannot have explicit length
CSU Chico
SAP AG
CSU Chico
SAP AG
01/01/60
12/01/97 01/20/00
19600101
19971201 20000120
CSU Chico
SAP AG
Computations on Dates
DATA my_date LIKE sy-datum. MOVE 19580420 to my_date.
my_date = my_date - 1.
Write:\ my_date.
Displays 19580419
CSU Chico
SAP AG
1 9
sy-datum(0)
8 0
sy-datum(6)
CSU Chico
SAP AG
Parameter Statement
Parameter statement creates a set of variable fields which are presented to the user for input on the selection screen. PARAMETERS var TYPE type [DEFAULT value]
CSU Chico
SAP AG
Data Types
Pre-defined (p,i,f,c,n,d,t,x)
User defined
Elementary
Structured
Structured type
Table type
CSU Chico
SAP AG
Records
records or structures are called field strings in ABAP use BEGIN OF and END OF
nesting is allowed
use TYPES command
CSU Chico
SAP AG
CSU Chico
SAP AG
state(10) type c,
zip type I, END OF ADDRESS.
CSU Chico
SAP AG
state(10) type c,
zip type I, END OF ADDRESS. DATA: Old_Address TYPE Address, New_Address TYPE Address.
Old_Address-Zip Old_Address-City
CSU Chico
SAP AG
Data Types
Pre-defined (p,i,f,c,n,d,t,x)
User defined
Elementary
Structured
Structured type
Table type
CSU Chico
SAP AG
Creating Tables
Use the occurs statement not necessary to identify the amount, may use zero (0).
Format
TYPES tablename TYPE type OCCURS 0. Example TYPES Address_Table TYPE ADDRESS OCCURS 0.
Really creates the structure which will be allocated and maintained dynamically.
CSU Chico
SAP AG
Declarative Statements
DATA TYPE
CONSTANTS
PARAMETERS
CSU Chico
SAP AG
Assignments
Create program(s) to
demonstrate the justification difference between the n and c types determine whether or not our system has a rounding error in the fixed point arithmetic
find the difference between the current date and your birthday
prove that one day before 01/01/98 is 12/31/97 using the ABAP date types
use the parameter statement to interactively ask for two dates and display the difference between them.
CSU Chico
SAP AG