Download presentation
Presentation is loading. Please wait.
Published byRoss Newson Modified over 10 years ago
1
1 ABAP Basics III Northern Arizona University College of Business
2
2 Types It is possible to define new data types. These are known as user-defined types. New types are defined using the Types statement.
3
3 Types The syntax is identical to the Data statement.
4
4 Types Types: Bank_Acct(28)Type C. Data: Ckecking_AcctType Bank_Acct. Savings_AcctType Bank_Acct.
5
5 Types TypesBegin of Demo_Type, D_IDType I, D_Name(20)Type C, End of Demo_Type. Data: Old_Demo Type Demo_Type, New_Demo Type Demo_Type.
6
6 Formatting Format Intensified. Write ‘Whatever’. Format Reset.
7
7 Formatting Format Inverse. Write ‘Whatever’. Format Reset.
8
8 Formatting Format Color 3. “ 0-7 Write ‘Whatever’. Format Reset.
9
9 Arithmetic Operators +add -Subtract * multiply /divide **exponential Divinteger quotient of division Modinteger remainder of division
10
10 Compute Statement Compute Result = A + B. Result = A + B. Result = (A + B) / C.
11
11 Add Statement Add 1 to Counter. or Counter = Counter + 1. Add F1 then F2 until F9 giving Result.
12
12 Character Data – Offset & Length Data: F1(6)Type C value ‘abcdef’. F2(6)Type C value ‘ ‘. Move ‘x’ to F1+2. “will space fill Move ‘x’ to F1+2(1). “no space fill Move F1+0(3) to F2.
13
13 Character Data – Shift Data: F1(6)Type C value ‘abcdef’. Shift F1. “shifts left Shift F1 circular. Shift F1 right. Shift F1 by 4 places.
14
14 Character Data – Replace Data: F1(7) Type C value ‘XXX-NAU’. Replace ‘XXX’ with ‘CBA’ into F1. The strings are case sensitive.
15
15 Character Data – Search Data: F1(7) Type C value ‘CBA-NAU’. Search F1 for‘CBA*’. Sy-subrc = 0 (match) or 4 (no match).
16
16 Case Statement The Case statement is used when there is a given set of values in a field.
17
17 Case Statement DataField1Type I. Case Field1. When 1. Write ‘The value is 1’. When 2. Write ‘The value is 2’. When Others. Write ‘The value is greater than 2’. EndCase.
18
18 Case Statement DataField1(1)Type C. Case Field1. When ‘a’. Write ‘The value is a’. When ‘b’. Write ‘The value is b’. When Others. Write ‘The value is greater than b’. EndCase.
19
19 Case Statement Case sy-subrc. When 0. Write ‘The value is zero’. When Others. Write ‘The value is not zero’. EndCase.
20
20 If Statement IfA = B. Whatever = 0. EndIf.
21
21 If Statement IfA = B. Whatever = 0. Else. Whatever = 1. EndIf.
22
22 If Statement IfA < 50. Whatever = 0. ElseIf A = 50. Whatever = 1. Else. Whatever = 2. EndIf.
23
23 Logical Operators >GT <LT >=GE => <=LE =< =EQ <>NE ><
24
24 Logical Operators Is Initial Between value1 And value 2 COcontains only CAcontains any CScontains string CPcontains pattern
25
25 If Statement If W_Field is Initial. IfNot ( W_Field is Initial ). IfW_Field is between 10 and 20.
26
26 If Statement DataW_Field(6)type C Value ‘abcdef’. If W_Field CO ‘abcdef’. “only IfW_Field CA ‘a’. “any IFW_Field CS ‘bc’. “string IFW_Field CP ‘*b+d*’ “pattern
27
27 Looping Do Loop While Loop Loop
28
28 Do Loop Used when a fixed number of iterations is known. Do 10 times...... EndDo.
29
29 Do Loop Data Cnttype I value 10. Do Cnt times. Write: / ‘the loop count is: ‘, sy-index. EndDo.
30
30 Sy-Index Sy-Index automatically stores the loop pass number.
31
31 Do Loop - Exit Data Cnttype I value 10. Do Cnt times. Write: / ‘the loop count is: ‘, sy-index. If sy-index = 5. Exit. EndIf. EndDo.
32
32 While Loop Data: Cnttype I value 0, Limit type Ivalue 10. While Cnt < Limit. Cnt = Cnt + 1. Write: / ‘the loop count is: ‘, Cnt. EndWhile.
33
33 Loop The Loop statement is used with internal tables. Loop...... EndLoop.
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.