Вы находитесь на странице: 1из 335

SAP R/3

/4



/4

SAP R/3

/4
" SAP R/3 /4" -
/4.
SAP, ,
, R/3
.
,
. :



Dictionary

/

/4
Development

SAP

/4

/,
R/3

/

,
-

Development Workbench
/4, ,
, ,
, Logical
Database, .
Remote Function Call
OLE Automation.
,
/4 Query
, R/3.

:
- -
SAP /4 Language Group
/4 Development Workbench.

""
WWW.LORY-PRESS.RU

I
1

xvii

/4
/4

/4

, ()
Dictionary

4
4
4
6
6
6
8
11
11
11
12
13

/4
Development Workbench

15

Repository
Data Modeler

Workbench Organizer

16
18
19
19
20

/4

21

,
/4




R/3





22
22
22
23
23
23
25
27
28
29
29
29
32

II

33

35



?


()


/4



Dictionary
Dictionary













type-pool




, ,



,

36
36
37
38
38
39
39
39
39
40
41
41
41
41
42
42
43
44
44
45

47
48
49
49
51
53
55
56
57
58
58
59
60
60
62
63
64
65
66
68

69
70
73
73
74
75
77
77
78

III


Move ()
Compute ()












79
81
82
82
83
83
84
85
86
87
88
89
89
90
90
91

93

94
96
96
97
98
98
100

:
:

10








101
102
103
103
104
105
105
106
108

109
110
110
111
112
113
115
115
118
120
121
122
123

IV

11

select


where






Select-Options

where


select
Dictionary



select
, /4 Dictionary
for all entries

12

















13

insert

125
127
128
129
129
130
131
131
131
132
132
132
132
133
133
133
134
134
135
135
135
136
136

137
138
138
139
139
139
140
141
142
142
144
145
147
147
147
148
148
149
150
151

153
154
154
155

13

insert


update



modify

delete

14









15
Logical Databases

,



get
: select Logical Databases

get



: start-of-selection end-of-selection

16


(Select-Options)
Select-Options select

153
154
154
155
156
156
156
157
158
158
158

159
160
161
161
161
162
162
162
163
164

165

167
168
168
169
171
172
173
173
173
174
175
175
176
176
176

177
178
179
179

1 7



: at line-selection
: at user-command





GUI


hide
get cursor

,


()

18

-
Development Workbench
submit



/4

,




,

VI
1 9

181
182
182
183
183

185
186
186
187
188
190
190
191
192
192
194
194
194
195
195
197
200
201
203
204
204
205
206
207
207
208
208
209
210
210
211
212

213
215
216
218
219
220

Fullscreen Editor




process before output
process after input

GUI


GUI

220
220
222
223
225
226
226
227
229
229
232
233
234

20 ,

235

21

241

(LUW)






call transaction 'SAAB'.



Update Task

R/3

22

236
236
237
238
239
240
240

242
242
243
244
244
244
244
246
246
247
247
248
248

249
250
250
252
253
254
255
256
256
257
257
258

Dictionary
, -





call screen


VII
23


sort
read table

Open SQL

24 Field Symbol
Field Symbol
assign
Field Symbol

25



VIII
26





R/3

258
258
259
260
260
260
261
261
261
263

265
267
268
268
268
270
270
272
272
274

275
276
276
277
278
280

281
282
282
283
284
285

287
289
290
291
291
292
292
293
295

27


RFC



28 OLE
OLE
/4



297
298
298
299
299
300
300
302
303

305
306
306
306
307
308
309

311

R/3

313


/4 Query

317

Logical Databases
/4 Query
/4

/4 Query
/4 Query

/4
Development Workbench


Include





(Use List)


318
318
319
319
319
320

323
324
324
325
325
326
327
328
329
329


(Tasks)
(Change Requests)

/4

/4
R/3 /4
CD-ROM.
.

331
332

334
335

337
338
342
342


R/3 SAP
, (Financial Accounting), (Controlling), (Logistics) (Human Resources).
R/3 , /, . R/3
. R/3
,
. R/3 , : . Fortune 500,
, American Airlines, Chevron, IBM, Mercedes Microsoft,
R/3.
R/3 /4,
SAP. R/3 /4.
,
. R/3, ,
-. R/3 . /4 /, R/3.
(Remote Function Call) , R/3 . /4 . , /4
SQL ( SQL Open SQL). SQL
R/3 ,
. , , .
R/3 .
/4 Development Workbench
/. R/3,
. , Dictionary .
/4 Repository
. Repository (Dictionary), , , . (Dictionary)
(Repository) , /4 Development Workbench.


, /4
/ : , , . R/3 ,
R/3.
, /4
. ,
.
,
.
.
, .
R/S, . ,
" /4".
, , /4. /4.

xviii

3.0 R/S. , , , ,
R/3.


I /4,
/4 Development Workbench, , . 1 , . ,
.
, /4. 2
. /4 Development Workbench ,
,
. Repository Information System
, Dictionary, , . 3 Workbench /4 Editor.
II , /4 . 4 ( ) .
:
. 5 /4, 6
Data Modeler, Dictionary .
, . /4,
, . 7 8 .
9 . 10
( ) . /4
, .
/4 , .
IV , ,
. 11 Open SQL ,
" " .
12
/4. (13 14)
, .
V (reports) ,
, .
Logical Database ( ) . .
Logical Database. 15
Logical Database. 16 .
17,
.
/4 , VI. (, ) 19.
20 /4. , , /4
, 21. 22
(GUI), .
,
.
VII . 23 . 24 Field
Symbols, 25 ,
.
VIII ,
. 26
. /4 Remote Function Call ( ). RFC

xix

27. ,
/4 OLE OLE Automation.
. R/3, - /4 Query.
Development Workbench. D . /4, .

,
. , , ,
. ,
. , .
, :

, .
,
- .
, .

CD-ROM,
CD-ROM ,
. .
.
CD-ROM /4, .
, CD-ROM ,
PowerPoint, ,
R/3. , ,
R/3, , .
CD-ROM ,
R/3 -, .

I
/4
1. /4
2. /4 Development Workbench
3. /4

/4




/4

/ V B A P / 4 (Advanced Business Application Programming 4GL) , SAP. R/3.


R/3 /4.
, R/3.
/4 ,
, R/3. ,
, .. . , , ,
. /4 ,
Development Workbench,
. /4
/, R/3, ,
Remote Function Call (RFC), . ,
, /4, , )' . /4
R/3.

/4
/4. /4, , , ,
.


, , , /4, , .
:
, , ,
. /4 . .
/4 , . , . ,
( , ), ,

. ,

data type i.
data y type i .
:

data type i ,
type i.

, ()
Dictionary
, /4
(, , ) ( ), . ,
/4 Dictionary,
. , .
, .

/4

/4 , . ,
customer_name character 25 :
data customer_name(25) type .
/4 types. , :
types t_name(25) type .
data cu8tomer_name type t_name.
t_name type , 25.
customer_name t_name. t_name
.
. 4.

(references) ,
, .. .
,
.
like. vendor_name customer_name:
data customer_name l i k e vendor_name.
records () internal tables ( ) /4
, .
, .
/4 .
. , , booking,
. :
data: begin of booking,
id(4) type c,
flight_data type d,
name like customer_name,
end of booking.
, begin of, : id, flight_data
name ( customer_name ). end of. ,
. , , (-) . , flight_data
, : bookings-flight_data.
occurs ( )
Occurs Parameter . Occurs Parameter
, .
, Occurs Parameter,
.
, booking_table, ,
, booking:
data booking_table like booking occurs 100.
, . with header line ( ) data, , .
/4 . 12.

/4 Dictionary , . , ,
Dictionary. like, ,
Dictionary .
0 Dictionary . 5.


/4.
, , . .

move
. /4 : move to .
, /4
. /4 , , .
write ,
. , '/4 is easy.' :
write '/4 is e a s y . ' .
(
, ) .
.
, . Repository
. .

/4 , , .
, . , ,
. , . , ,
, , , , . at line selection:
at line selection.
r i t e ' This is displayed after double-clicking a l i n e ' .
, , .. ,
, ,
. .
if/else/endif ,
case/when/endcase
. do/enddo, while/endwhile
. , ,
, .


/4 : . /4 ,
, .
( , ).
.
, . , . raise.
, .
, .
form/endform, perform. using changing,
:
perform calc using al
changing a2.

/4

writ: a2.
form c a l c using
1 l i k e a l
changing
2 l i k e a2.
f2 = 1 + (f2 * 17) .
ndform.
function/endfunction, call
{unction. .


/4 SQL (
SQL Open SQL). /4, Open SQL,
, R/3 .
, " " . , , ,
, :
tables customers,
data all__customers
l i k e customers o c c u r s 100
with header l i n e .
select * from customers i n t o t a b l e a l l _ c u s t o m e r s .
loop at a l l _ c u a t o m e r a ,
w r i t e : / all_customers-name.
endloop.
where, , , . ,
/4 select.
/4 (insert, update,
modify delete), , . "" ( ). , ..
.
, .
export import
( ).
sort . loop/endloop, where. /4
: read table ,
. , ,
. , .
, "" at/endat. .
,
. myjftights
, . .
(, *, .)
* Database table with flight data
tables flights. * Internal table for flights
data my_flights like flights occurs 10 with header line. * Statistical data
data sum_occupied__seats like my_flights-seatsocc. * Heading the flights from
the database
select * from flights into table my_flights
order by primary key.
* Displaying the number of occupied seats on each flight
* with headers and subtotals for each carrier
loop at my_flights.

at new carrid.
new-page.
write / my_flighte-carrid.
clear sum_occupied_saats.
endat
add my_flights-aeataocc to sum_occupied_seats.
write / my_flights-eeataocc.
at end of carrid.
write / sum_occupied_seats.
endat.
endloop.
! , . like ,
, .
, .


(report) /4 , ,

. /4 Query,
, (. 1.1). ,
,
select Logical Database, . Logical Database
, . Logical
Database , .

. 1.1

/4

Query
/4. select . 11, Logical Databases 15.
Logical Databases
, /4 .

/4

. 1.2

Select-Options

, Logical Database. , Logical Database


.
/4 .
.
Select-Options (. 1.2). , ,
select:
tables customers.
data all_customers
l i k e customers occurs 100
with header l i n e .
s e l e c t - o p t i o n s sname for customers-name.
s e l e c t * from customers i n t o t a b l e all_customers
where name in sname.
, ,
.
, .
/4 ,
(GUI).
, Dictionary,
. , ; ,
. . : -
(layout) (flow logic).

, , , ,
, . Dictionary , drag-anddrop, .
, , ,
{ ) . ,
. ,
,
input. ,
.

10

Ha . 1,3 , , . 1.4 .
/4 ,
, . /4 Development Workbench
/.
R/3.
, , /4
.
Logical Unit of Work (LUW).

. 1.3

. 1.4


/4

, LUW
. , , LUW,
, LUW .
.
.


/4
. .. /4 Repository. Dictionary
. /4 , , .
/4, . -,
. -, Dictionary
, . , . , , ,
R/3. ,
. R/3 /4 (.. R/3).
, . , .
/3 . .


/4 , . ,
. ,
. ,
, , .
, , :

, , Dictionary

, write

, ,




/4 :
Dictionary

(Logical Databases) ,

11

12

Dictionary . , ,
Dictionary, tables. like
, ,
Dictionary. ,
, Dictionary typepools ( type-pool). Dictionary , , ,
.
/4 Development Workbench
, , , . ,
, . , , .
, ,
, .

. , , .
. ,
, . /4 Development Workbench , (
).
Remote Function Call (RFC). RFC
R/3. ,
.
, Logical Databases
. , Logical Database, , . , , (Logical Database).

,
, . -,
Dictionary,
.
. -,
- . , , Logical Database, , .


R/3 / . , /4, .
/4 , .
( ) .
Remote Function Call :
R/3, R/3 SAP R/2 ,
R/3 , C/C++ Visual Basic. RFC
, . , ,
.
Open Object Interface /4 OLE Automation. .
/4 : (, R/3 CORBA).
Open Object Interface OLE . 28.

/4

13

/4 , , .
/4 ( ),
.
Dictionary ,
.
Logical Databases ,
.
/4.
Development Workbench /4.

2 . 65

/4 Development
Workbench
Workbench

Repository

Data Modeler

Workbench Organizer

16


, , . /4
/4 Development Workbench. (
) /. Development
Workbench , ,
. /4 ,
Workbench R/3
. Workbench,
/4 .
/4 Development Workbench R/3.
. SAP Workbench, ,
-.
Development Workbench (. 2.1) :
( ) Object Browser
/4
Repository, Dictionary
Data Modeler
Query
Workbench Organizer

Workbench Repository.

. 2.1
Development
Workbench

Repository
/4 Repository () :

Dictionary

/4 Development Workbench

17

. 2.2

Repository

1- /4
2 - Dictionary
3-

4 -

5 -
6 -
7 -
8 -




GUI
, ,
,

/4
Repository Dictionary, , , . , , (
). Dictionary,
Dictionary , , , like
. Dictionary
, .
Dictionary . 5.

Repository . Repository Information System
, , , . ,
Use Lists, , ( ) . ,
,
Use List , . Use List
Dictionary , .
(Object Browser) Workbench
Repository .
:
Repository . ,
,
Dictionary (. 2.3).
, Dictionary , Data Modeler .

18

. 2.3
Repository

Data Modeler
Data Modeler, , . ( -)
. " " , , Dictionary.
Repository , Dictionary " " (
) . , Dictionary , , .
Dictionary,
.
, . (, ).
. Data Modeler . ,
(. 2.4).

. 2.4

/4 Development Workbench

19

Data Modeler . 6.


Workbench . ,
.
, /4 (Editor) (Syntax Check),
. . , (. 2.5).

. 2.5

Syntax Check

Syntax Check , . , ,
. Syntax Check , .
(
), , ,
, . , Workbench .
. .

Workbench Organizer
Development Workbench
, .

. R/3
. .
Workbench Organizer
.

20

,
.
,
, , . , , , , .
Workbench Organizer , ,
(. 2.6).

2.6

Workbench Organizer . D.

/4 Development Workbench , Dictionary, Data Modeler Workbench Organizer.



, .
/4 Workbench,
.

/4.

/4
/4

Editor

22

P/4 Development Workbench, . ,


Development Workbench /4. ,
, . /4 Editor, , ,
Syntax Check, .

,
/4
/4 , . ( ), .
:
report abaptes t.
write ' Customer l i s t ' .
abaptest. report. Customer list. /4 : Check /4
Editor. , Syntax Check .
. " ".


/4:
"",

/4, write report
( ) (*)
" " ,
. ,
w r i t e 'Customer' ' s Name'
: Customer's Name.
/4 , . ,
write , ,
:
w r i t e 'Customer l i s t ' a t 10.
, . .
"" (*) " "
.
. ,
. : ,
.


,
w r i t e 'Customer l i s t ' .
w r i t e 'Booking' .

/4

23

, , , :
write:
'Customer l i s t ' ,
' Booking' .
, .
, .


/4 , . :
w r i t e 'X'.
WRITE

'X'.

wRiTe

'X'.

. ,
w r i t e ' ' .
, .
.
: .


/4 R/3.
.

R/3
R/3 R/S.
(Iogon) (. 5.1).
Client (), R/3 ,
, .
:
. . Language ()
(, ),

. 3.1
(Logon)
R/3

24

. 3.2
(Start)
R/3

. " " .
Enter (), ,
R/3. Continue (Start)
, R/S (. 3.2):
Logistics (). Accounting () Human Resource ( ).
.
Start .
, . 8.3.
. (. 3.4), , ,
.

. 3.3

/4

25

. 3.4


(Application)

, , . : .


/4 : .
.
1. (Start) Tools > /4 Workbench.
2. /4 Development Workbench.
Object Browser.
3. . Program (),
(, ABAPTEST) Display (. 3.5).
4. , .
, Yes ().
5. , TOP Include.
, - Enter.
TOP Include . .
6. , . 3.6. Title
() My first /4, T () 1 ( , on-line), Application () S ( ). . .
7 . , Save () .

26

. 3.5

ABAPTEST

. 3.6

ABAPTEST

8. Maintain Object Catalog Entry ( ),


(, ). Local Object ( ),
(. 3.7), (Attributes).
, , .
Include.
Include , , , Repository
. , , include.

/4

27

. 3.7


(Local Object)

. , Include . Include TOP Include


, ,
. , Include, , TOP Include .
1, ,
( ).
, I Include
, (. 19).
( 1 ), Include, ,
.
S ( )
(Application). R/3.
: F (Financial Accounting ),
(Human Resources Planning ) (Materials Management - ).
/4 Development Workbench , , . Maintain Object Catalog Entry , ( ) (..
, ). , . , , .
i
.


.
1. (Attributes) Source Code ( ) Application (. . 3.6).
/4 Editor.
2. Editor , . report -

28

.
report :
writ* 'Customer l i s t ' .
, . 3.8.
3* , Save ().

. 3.8


, (Editor),
, , , .
. .
1. Editor report Select
().
2. write ( ) Select.
(),
(. 3.9).
3. Cut (),
( ). , Insert From Buffer ( ). ( Copy To Buffer (
) ,
). .
,
Cut Copy To Buffer. Duplicate
Line. , .
,
. , , , .

X, Y Z, Block/Clipboard (/ ). R/3.
R/S Copy To Clipboard (
) Block/Clipboard.
, .

/4

29

. 3.9

,
Lower Case ( ) Upper Case ( ).
, .
1. Editor :
Settings () > Editor Mode ( ).
2. Mode () PC Mode Without Line Numbering (
) Display () Lower Case (
).
. ,

.


Editor
. , write, . Help
(). , . Help /4 Key Word (
/4) (. ).

(. 3.11). Help.


Syntax Check
. Check (),
. .
.
. 3.12 , . Syntax Check
(, num), Correct () .
, .

30

. 3.10

/4 Help

. 3.11

write

1. . , No syntax errors found ( ).


2 . , Program () > Execute
().
3 . 'Customer list', write.
(. 3.13).
: /4 .

/4

. 3.12
,


Syntax Check

. 3.13

31

32

/4 .
. , , .
.
(:) (,).
Syntax Check ,
.
Editor.
.

II

4.
5. Dictionary
6.

/4

/4

36

/4 : , , .

. ,
(). Dictionary .
/4 Dictionary . 5.
, , , .
, , .
. 12.

/4 , . data.
. 1
customer. , ,
. 1 , 25 ;
. /4
:
(, , , )
( Dictionary)
( Dictionary)
, ", () Dictionary" 1.
, , , .. .
data, ,
() (25):
d a t a : customer_name (25) t y p e ,
vendor_name (25)
type .
like (. ,
). vendor_name customer_name:
25. , customer_name vendor_name:
d a t a : customer_name (25) t y p e ,
vendor__name l i k e customer_name,
, 1 t_name
25 . ,
t_name, vendor_name customer_name,
;
t y p e s t_name(25) t y p e .
d a t a : customer_name t y p e t_name,
vendor_name t y p e t_name.

?
.
, ,

37

, .. , . ( )
, .. .
( ), , ,
"", "" . ,
, . ,
.
, like type
, /4 Dictionary R/S.
Dictionary , , .
, .
Dictionary,
. /4 Dictionary ,
, .
Dictionary like. ( , Dictionary
.) like ,
, .
, /4
Reid-Symbols (. 23).


, ,
, . ,
, . ,
like .


/4 :
Characters
: ( )
(, ).
Numbers
: i ( ),
( ) f ( ).
Date
: d ().
Time
: t ().
Hexadecimal
: ().
data :
d a t a : name (25) type ,
zip_code (5) type n,
counter type 1 value 1.
, .
name 25, zip_code 5. data ,
/4 .
, value (-)
. value counter. , ,
. , (.. ), i 0.
. 4.1.

38

4
4.1

'

p
f

0.0

000000'

'00'

. ,
flag , address_flag, 'X'. flag , address_flag . , (type) , ,
(data), :
t y p e s f l a g type .

data address_flag type flag value 'X' .

( )
. , , ..
value:

constants: company_name (3) type value 'SAP' ,


nax_aounter type i value 9999.

; , ,
(, ). ,
, , .
:

data counter type i value max_counter.


max_counter, 9999.
( ), types,
data constants, ,
, ,
.
, .


, /4 .
, a n , .

()
, , ().
, . :

data:

name(25) type ,
city(25),
flag/
single_character value 'A' .

city flag , .
flag , (, 1). , 64 .
. data

39

, , .
,
( )
( ):
data language(2) value '/4' .
language , 4 /4 .

( ) , , ,
0123456789. , . , , , ( ZIP), , ..
, 0 .
, ,
. :
data cuetomar_id (8) type n.
eustomer_id=' 1234' .
write cuetomer_id.
00001254. , 1234
( ).
1,
0000 4.

/4 : ,
.

i ,
:
data:
cus tomer_number type i ,
loop_counter type i .
4 , ,
. -2^ 2^-1. 0, :
data word_leng"th type i value 17.

( ) . . :
( 31 )


, .
:
data numbar_of_mosquitoQB type p.
, 0.
8 , 15 (+ -).
, (
):
-999,999,999,999,999 + 999,999,999,999,999.
, ,
(,
).

40

. ,
, ,
. , :
data airbg_pric typ p d a c i a a l e 2.
airbag_price ( )
. : 0.00.
, 16, S1 :
data paakd_16 (16) type p.
packed_16 S1 .
:
(2-1).
, * , 8.
. ,
, 16.
) /4 ,
.


( f) . , age_of_earth, , 123108
(.. , 12, 8):
data g_of_*rth type f valu ' 1231+8'.
:
d a t a : f l type f,
typ* f,
f3 typa f.
f l - 1.
f2 - ' - 1 2 . 3 4 5 6 7 ' .
3 - ' -765E04' .
0, data
. 1-307 17.
f, , 22.
, .
f ,
, , , :
fl - ( ' 1 . 0 ' / ' 3 . 0 ' ) * ' 3 . 0 ' .
,
" eq:
if fl - '1' .
, ( - '1'), .

if ' 0 . 9 9 9 9 9 9 9 9 9 9 ' < fl and fl < ' 1 . 0 0 0 0 0 0 0 0 0 1 . '
, . .
, , , ,
.
, .

41

(date) d . : YYYYMMDD (Y , , D ). : 00000000.


/4 date,
. date,
write:
date today type d.
* Get a c t u a l date from system f i e l d sy-datum and display it
today = sy-datum.
write today.
today. , sy-datum today,
write. "
". ,
: 12 31 1999. , : 31 12 1999.
write 10:
write (10) today,
12/31/1999, - 31/12/1999.
,
write (. 8) Dictionary /4 (. 5).
,
, date.
(ultimo):

date ultimo type d.


* Set v a r i a b l e to f i r s t day of c u r r e n t month.
ultimo = sy-datum.
ultimo+6(2) - ' 0 1 ' .
* Set v a r i a b l e to l a s t day of previous month.
s u b t r a c t 1 from ultimo.
date
. , , , , .
date . 7 8.

6 HHMMSS (, , ). , write
Dictionary.

( ) . ,

1111000010001001:
data x s t r i n g ( 2 ) type value 'F089' .
, 0 F . ,
2 2.


/4. , /4
( ) : . ,
. ,
.

42

( ) , ,
/4.

/4
( ) ( ), data begin of data end of. ,
. : (id), (name) (telephone):

data;

begin of customer,
id (8) type n,
name(25) ,
telephone(12),
end of customer.

customer data begin of :


, ( ).
data end of.
, ,

:
data vendor l i k e customer.
customer-id = '87654321' .
customer- = 'Edison'.
customer-telephone = '111-111-1111'.
move customer to vendor.

like vendor,
, customer. .
, .. customer
vendor.
constant,
. , , , :

constants: begin of path,


root(3) value ' a : \ ' ,
home_dir(5) value 'homeV,
end of path,

constants begin of path,


.
. :\


, , , .
" " . (
) . ,
. ,
, " ", -.
occurs (
), , . Occurs Parameter. ,
, , ,
customer. , 100:

data all_customers l i k e customer occurs 100.


data all_customers, customer.
, 100 .

43

(Occurs Parameter)
.
/4 . ,

.

,
customer. , . personal_data:
types: begin of personal_data,
name(25),
city(25),
street(30),
end of personal_data.
, , people, :
data people type personal_data occurs 300.
(, ) . header line ( ) data,
. header line , , .
, .
. 12.

.
, temporary view ( ).
(, ""
), .



/4 :
1. (, )
Dictionary.
2. ( ) begin of/end of.
3. occurs.
, , , , .. ,
, , , , .. , (personal_data)
address, city street:
types: begin of address,
city(25),
street(30) ,
end of address,
begin of person,
name(25),
address type address,
end of person.
data receiver type person.

44

person .
:
receiver-name ' Smith' ,
r e c e i v e r - a d d r e s e - c i t y 'Big City' .
r e c e i v e r - a d d r e s s - s t r e e t 'Main S t r e e t ' .
. ,
, (person) .
:
types : begin of phone__f ax_mmbers,
country_code (3) type n,
area__code (3) type n,
number (10) type n,
end of phone_f _,
begin of employee,
name(25),
phone type phone_fax_numbers occurs 10,
fax type phone_fax__number s occurs 5,
end of employee.
data employees type employee occurs 100.

phone_fax_numbers , . employee . data


employees employee. employees
.


data .
; Include, .
, (. 10).
, . , abc abc
, .
(.. ,
data) . , Include, . ( )
Dictionary, /4.
Dictionary . 5.

"" () :
1. Dictionary.
2. ,
.
3. .

, .


/4 , ,
. Dictionary sy -

45

. , sydatum . . , sy-tabix
, ( .
12).
Editor, Help sy,
.
.

data.
type.
( ) constants.
, Dictionary ,
, like type.
(record) , :
data begin of, data end of.
.
occurs, , Occurs Parameter ( ).
.
.
: Dictionary,
.
,
Dictionary /4.

3 . 65

Dictionary
Dictionary


48


. ,
, . , ,
, .
/4
Dictionary. Dictionary
, Repository. ,
, ,
. Dictionary .
,
, , .
,
, , . , I
BLUE, . , Dictionary
( ) .
, ,
Dictionary, .
, . ,
I Dictionary BLUE.
, ,
,
, . R/3
.

Dictionary
Dictionary
:
1.
2.
3.
.
, ,
. , . ,
customer , Dictionary
.
,
. , , , "" . , ,
(. 5.1).
"" ( ),
. ,
, . , R./3 Company code ( ), . ,
character. , ( )
, , " ". ,
, , , .
"" . ""
, .
, . ,
R/3 Sending company code ( -) Receiving
company code ( -). , , " -

Dictionary

. 5.1
, ,

49

X
", " ".
,
, ( ). ,
: , , .
. , Development Workbench
Dictionary. ( ).


"" . , Dictionary.
, .
, ;
. ""
, 01 .
, , .
(, ),
, , . ,
. ,
, , . (.. ), ,
( ).

. ( ) ( ). , ..
, , .
, .


Object Browser Initial , . Dictionary Objects
Edit (. 5.2).
Display. ,
(. 5.3).
. ,
:
Key: ,
Data elem.:

50

. 5.2

Object Browser


. 5.3

Dictionary

Type: { )
Length: ( )
Chk. table: ,
ShortTxt: ( )
& Data elem. , (. ).

Dictionary

51

. "
".


. Dictionary , , .
. Data Browser,
Developmeni Workbench, , Utilites () V Table Entries
( ). , , customers (). Data Browser,
0 10000000 (. 5.4).
Execute (),
(. 5.5).

. 5.4

Data Browser

. 5.5

Customer's

52

, Settings
( ) > List Format ( ) > Select Columns ( ) (. 5.6).

. 5.6

Data Browser

, , - Settings ( ) > List Formal


( ) > Sort Sequence ( ) (.5.7).

. 5.7

Data Browser

. 5.8.
Data Browser Create
Entry ( ) Change Entry ( ). Change
Entry (.5.9).
Data Browser, , Edir > Delete
Entry. He , Data Browser,
, ?

Dictionary

53

. 5.8

. 5.9

, ,
, ,
(. 19).


Dictionary
Object Browser, Edit.
Create. ,
. 5.10. ,
SAP , SAP
. "" , , .

54

(Application table )
(Customizing table ).

. 5.10
Dictionary

, .
- Key,
. Data elem. .
, .
, .
Data elem.
( ) . , ,
, , (. 5,11).

. 5.11

{. 5.12).
, ,
. -

Dictionary

55

, , Save.
, ,
Acrivatf.
Repository {, Dictionary ). "". ,
(. 5.13).

. 5.12

. 5.13

. , ,
tables, . /4
( wattt area - &) . . ,
Dictionary, . ,
cusLomers. :

56

tables customers.
select * from customers.
write: customers-.
endselect.
customers {
select * ) ( write:
customers-name).
select . 11.
,
. ,
select, .
, , like (. 4). , ,
customers, :
data all_customers like customers occurs 100.
(Use Lists) Development Workbench.
, customers,
Where-Used List (, )
Program. Use List (. 5.14).

. 5.14
Use List
CUSTOMERS


, . , .
,
(, 5.15).
D , Online, .. . .
Background (),
.
Enter For Mass Processing (TBATG) ( ) ,
.

Dictionary

57

5.15

:
( ),
. ,
. , . ,
, .
. , , " " .
, Use LisL .


,
, ( ) . , , , .
. /** .
, ,
.include ( ) ( SCUSTOM) (. 5.16). , : Extras () > Substructures () >- Expand All
Substr ( ).
, R/3 , , , SAP. , . SAP
, SAP . : . .
/4 Dictionary , Append Structures (
). ,
.
. ,
. ,
. , .

56

,
Dictionary .

? Goto > Append Structures.


. :
Y Z. .

. 5.16


, , , , . ,
(.. ,
, ).
.
, (,
), .
. , Sender cost center

( ). Receiver cost center ( ) Partner rust center ( -

) Cost center ( ). ,
, . ,
.


, , ,
" ". Dictionary Object Browser .
, . 5.17.
( ).
, , . (Texts) (
) (short , medium , long ) .
( ) , .

Dictionary

59

Dictionary . 19.

. 5.17

, Documentation.
, , . , , F1.
, ,
Dictionary, , .
, ,
.


( ui-iHHrffK : Objrrt Browser ( Dictionary Objects ).
] ,
(.5.18).

. 5.18

60

, ,
.
. (. " ") () (, ) . , Maintain Field Labels (
).
,
, .
Save. , Activate, .
:
, .
Documentation. F1 ( ).
Data Element Maintenance
Parameter , ,
, , . , ,
() . , .
Parameter ID . 22.


.
.
.
, ( ),
. .
Domain Maintenance
. , S_CUSTNAME
char () 25.


:
, ,
, .
Dictionary Objects Object Browser ( ).
, . 5.19.
( ). .
,
. ;


,
, .
, , .
. "
".

Dictionary

61

. 5.19

S_CUSTOMER


(, , )
. , .
, . .
:

(-)
char(x)
cuky
curr


()
c(x)
c(5)
P(n/2+1) decimate m

dais
mtd
lang
numc(x)

d
i
c(1)
n(x)

Urns

Character ()
Currency Key ( )
Currency (n-digits, m-decimals) (:
,
)
Data ()
Integer ()
Language ()
Numeric character (only digits)
( , )
Time ()

, . ,
(1, 2
12) (business) (private), : , .
Values (. . 5.20, SjCUSTTYPE,
S_CL\STOMER ).
.
, , , , .
(. . 5.19)
. , Output Length ( ) ,
. , .
Development Workbench /4 (conversion functions), , -

62

. CONVERSION_T_,
(, ALPHA), _INPUT
_OUTPUT.
. ( ) Domain Maintenance.

. 5.20

S_CUSTTYPE

. 5.21

S_CUSTOMER

, , (Use List). Where-Used List.


S_CUSTOMER . 5.21.


, , -,
: -

Dictionary

63

Objen Browser Dictionary Objects,


. , ,
( ,
). , }' .
, .


- .
(foreign keys),
. , .
)' .

. , ,
: ,
. , , (foreign key
field), , Dictionary, (cfieck). ,
.
. ,
, , . , .
. , booking ()
customid, customers.
, ,
R/ .
. , , ,
. , Dictionary. F4, ,
.

. 19.
Cnk.Table . Foreign Key ( ).
(. 3.22).

. 5.22

64

. , . 5.22 ACTFLJ ZBOOKINOS-CAJRRID. Check table


*
)' .

, . .
.
:
Projection ( );
( )
Selection ():
Join ():
, ,
Dictionary. (primary table), a
^ (secondary table). ,
(. 11).
, Object Browser, Dictionary
Objects Initial, Edit .
Create.
D (database - ). (.. ), . 5.23.

. 5.23

, Tables (. 5.24).
Fields () Maintain View: Attributes (
: ), .
(. 5.25), . , ,
Selection Condition ( ).

Dictionary

65

. 5.24

. 5.25

type-pool
,
. , Dictionary
; - 4, types data
, . , Dictionary type-pools.

66

type-pool Object Browser Initial


Dictionary Objects Edit .
type-pool Type Group. types Dictionary
, (. 4). ,
, ,
type-pool customer:
type-pool customer.
t y p e s : b e g i n o f phone_faK_numbers,
country_code (3) type n,
area_code (3) type n,
number(10) type n,
end

of phone fax numbers ,

begin of employee,
name(25),
phone type phone_fax_mimbers occurs 10,
fax type phone_fax_numbers occurs 5,
end of employee.
type-pool type-pools;
type-pools customer.
data employees type employee occurs 100.


, . ,
, , .
/4 . ,
, . (reference Jwlds).
curr cuky, (, USD
). .
:
customers bookings, (. 5.26).

. 5.26

BOOKINGS

Dictionary

67

forcuram ( ) forcurkey ( ), . ,
Table Maintenance (. . 5.26),
, .
(. 5.27).

5.27


BOOKINGS

(, : 0.00). ,
write,
(. 8). , : quan unit, , .
- R/S , CHeiu ().
R/3 Client, (). Client , !
, SAP . Client, , , .
Client . Client - SAP (. 6). Client /4 Development
Workbench. , clnt ( Client) Dictionary
, Client. /4
select , Client, Client where,
Client (. 11).
/4 Development Workbench Client,
Client ( ,
Client).

68

/4 Dictionary : Dictionary
, .
, ,
.
, . ,
.
, . ,
( ).
,
, , . , .
, ,
, .
(.. ) pool
type-pools.
, ,
, , .
Client
"" Client.
, Dictionary.

70


, . . Data Modeler
Development Workbench,
.
: ,
(entity types) , , . Dictionary,
. , . Dictionary .
.


, , .
Dictionary.
*
(, SQL- ), .
,
: , ,
, , . :
customers ( )
geocity ( )
carriers ( )
planfli ( )
actfli ( )
bookings ( )
customers (. 6.1) , .. id customers.
, customers (,
bookings). name (),
city (), telephone () customers. ,
.

6.1.

customers
00000001

Edwards

Small Town

00000002

Young

Village

654-321-1234
333-444.2222

00000017

Smith

Big City

717-181-5151

87654321

Edison

Marketplace

111-111-1111

geocity (. 6.2) city,


city .

71

6.2
geoclty
Frankfurt

10

50

Madrid

35

Moscow

30

58

Paris

48

carriers (. .) ,
( carrid)- . :
( ) .

6.3
carriers
ABC

ABC Airlines

USD

AL

AUTALIA

ITL

XYZ

XYZ Fliahts

DEM

planfli (. 6.4) carrid (


carriers) connid ( ).
( geocity),
.

6.4
planfli
ABC

1000

Frankfurt

Paris

081000

ABC

1234

Paris

Frankfurt

175500

XYZ

0006

Madrid

Moscow

163000

XYZ

0007

Frankfurt

Madrid

093500

planfli, actfli carrid, connid fldate


( ). planfli carrid eonnid.
, (. 6.5).

6.5
actfli
ABC

1000

19991230

200

DEM

110

ABC

1234

19991230

500

DEM

010
020

ABC

1234

19991231

300

DEM

XYZ

0006

19990606

100

USD

175

XYZ

0007

19990505

110

USD

133

bookings carrid, connid, fldate bookid (


). carrid, connid fldate actfli. ( customers)
(. 6.6).

72

6.6
bookings
ABC

1000

19991230

001

00000017

19990101

ABC

1234

19991230

002

00000002

19991229

ABC

1234

19991231

005

00000017

19990101

XYZ

0006

19990606

008

00000001

19990101

XYZ

0007

19990505

007

87654321

19990101

, ,
, , (
). , , ,
Client, .. clnt
. , .
. , geocity . cityfrom cityto planfli, ..
geucily city gcocity.
, . . G.I .

. 6.1

() . ,
.
, .
5, Data Browser.
.
, , .
, , . , planfli-carrid ( ) carriers, .. planfli carriers .
, carriers plantli.
planfli-cilyfrom planfli-cxtytu geocity. ,
, geocity - ( ) planfli, planfli. , , ,
{ ). -
, . ,

73

, ,
. ,
)1 .


. Dictionary
, , ,
. ( ) . .
: i-. ,
. ,
.
/4 Development Workbench :
( ) ,
. .
,
. .

, ,

. , - . ,
, -, ,
.
, Object Browser,
Modeling Ohjeci; ( ) Edit
. D (
F4). ,
Entity Type . , ( Definition . 6.2).

. 6.2

TRAVEL

74

( ). , ,
, Editor. ,
Hierarchy
Data Model (. 6.).

. 6.3

Hierarchy ( )
. ,
.


, Object
Browser, ,
Hierarchy. Hierarchy,
Subordinate ( ) : Modeling Objects > Insert () > On Same Level ( ).
. .
.
(. . 6.2). .
( ), .
,
. , .
, , Sel./Desel. SubTree (/ ). , , Select/Deselect Node
(/ ).
Graphics () .
, (. 6.4).
, ,
" ".

75

. 6.4


.
(. 6.5).
. 6.5 CUSTOMERS.
, (. . 6.4).

. 6.5

, Dictionary. , Diet., Dictionary (,


customers, . 6.6). .
, Table View.
Dictionary, ,
, ,
, , Attributes
. . 6.7 , .
.

76

. 6.6

Dictionary

. 6.7

, Dictionary. , , CUSTOMERS,
S_CUSTNAME.
. Dictionary,
. ,
Extras > Flds.From F.nr.Type .
Edit () > Paste ().

77


{
) (). , , , , .
: ,
, (). , iiiiuii no ,
. , , ,
. , , .
1
(nfrrmlwt). , , planrfli-ciryfrom geociry-city.
* (hierarchical) (ag&vgeting)- , , , , (refinement of the independent entity). ,
planfli-carrid ( ) carriers-id .
planlli carriers.
.
, , .
, .. . , .

,
:


, ,
Connect (). , : Gam () > Ingoing Relalshps ( )
> Outg.Relarshps ( ). .
, .
, , .. fi.8.

. 6.8


CARRIERS PLANFLI

78

, , .
.
Category () Cardinality ( ).
, " " (,
), , "X",
R/. . , (external relationship).
, .
, ()
, 1:CN.
, . ,
, .. carriers-id planflicarrid 1:CN. carriers, ,
planfli. : 1:1 (
) 1: ( ). ,
.
, (specialization). . , . ,
, carriers: amcarriers gecarriers.
.
, .
Spec ().

Dictionary.
,
Logical Database (. 15).

( )
, Data Modeler - Development Workbench /4.
Data Modeler Dictionary.
, ,
.
, , . .
.
,
.
- , .
/4. 7 , .

III


7.
8.
9.
10.

82

, , Dictionary .
/4. , : , (, - ).
, , /4 . , ,
. . /4 : .
/4
, .
(in a single step)
.
, . /4 : sin,
cos .
,
, , .


Move () Compute ()
-
move, :
d a t a : (25), counter type i.
move: ' Edison' to , 17 to counter .
name Edison, 17.
move :
move: to
, compute:
compute = .
, compute:
= .
,
.
compute - ,
/4. Syntax Check .
compute, . ,
.
, , ,
:
phone_4phone_3=phone_2phone-_l = .
. .
/4.


, /4 , . , ,
, character, .
integer. /4- :

83

d a t a : * _ 1 ( 4 ) , number_2 ( 3 ) , r e s u l t t y p e i .
r e s u l t = number__l + numbar_2.
number_l 1771, a number_2 005, result
1776. , number_2 5 { 5),
05 (_05) 05 (05__).
. , , , 10, , 25, :
d a t a : old_customer__name (10) ,
_tomar_nan>is (25) .
move ld_cuetemer_name t o n e w ^ c u s t o m e r j i a m e .
new_customer_name old_customer_name,
25 . old_customer_name Edison,
new_customer_name Edison
( 19 ).
, :
d a t a : any__d*fca t y p e d ,
same_day_o;C_na; t__week t y p e d.
aame__day_o_n*t_week = a n y ^ d a t a + 7.
, 19991231 (31 1999 .) 20000107 (7 2000 .). ..
/4,
, .
, . ,
.
/4 , ,
move compute, :
, , , .. .
, " ".



, (, ). , Washington :
d a t a : Short__name (8) , long_name (16) .
move ' W a s h i n g t o n ' t o : short__name, long_name.
short_name Washingt, long_name
Washington . ,
, .
, , )' : . , ( ),
, .
, .. .
, ,
short_name. long__name :
long_name = s h o r t _ n a m e = ' W a s h i n g t o n ' .
Washington short_name , short_name (Washingt) long_name,
. Tong_name Washingt .


/4 . ,
, ,
:
d a t a : no_employe (4) t y p e n , n o _ r ooms t y p e p .

84

data: employees per_room type p decimals 2.


employees_per_room = no_employees / no_rooma.

no_employees . ,
, .. employees_per_room.
, . :

data: income type i,


tax type p decimals 2,
net_income type p decimals 2.
net_income = income * ( 1 tax ) .
income 10,000, a tax 20% (.. 0.20).
net_income 8,000.00. (1 - tax) 0.80 ( 80%),
10,000. (8,000) net_income ( ,
net_income , ).
. , net_income ,
:

data rounded net_income type i .


rounded net_income income * ( 1 - t a x ) .
income 10,000 8,000
8,000.00, .
: income 10,002, net_income 8,001.60, a rounded_net_incomc 8,002.

, -. ,
.
(, cos sqrt) t
.


, ,
. , 10 . :

data: reeeiving_date type d,


last__admissible_date type d.

l a s t _ a d m i s s i b l e _ d a t e r e e e i v i n g _ d a t e + 10.
. ? -, receiving_date (, 19980223) ,
, 01/01/0001. -, 10
( 19980303), 19960223 20000223? /4 ,
.
/4 , 2000 . ,
, /4,
1999 2000 . .
, .
" ". /4,
.

85


,
move. move :
move

tft

tl.

move a to t2 .

s t i .
. , t,
, ( ):
data:

s(4) value '12x4',


tl(2> type n,
t2<6)

type n.

move : t1 = '24', a t2 - '000124'.


. :
data: (4) type n value ' 0 1 2 4 ' ,
tl<2>,
t2(6) .

: t1 = '01', a t2 = '0124_ _' ( ).


. s
(+). , :
data: s(6) type n value '012345',
tl(10) type p,
t2<6) type p.
: t1 = 12345. move .
.
:
data: (a) type p value 124,
tl<2) type n,
t2<6) type n.
; t1 = '24', a t2 = '000124'.


( ) . ,
. move-correspondmg
. , move-corresponding, .
move
(, ), .
, .
, ( id city).
, move-corresponding:
data: begin of my_customor,
id<a) type a,
n<25),
city(25),
and of mY_customor.
begin of ci ty_of_cuetomer,
city like my_cu8tomer~city,
text(30),

86

id l i k e my_cu3tomer-id,
end of city__o_customer.
move-corresponding my_customer to city_of_custonir.
move-corresponding id city,
my_customer, city_of_customer. city_of_customer-text , . ,
, /4 . city
my_customer city__of_cusiomer.
, ,
.
move
. , :
data: current cue turner l i k e my_customer,
begin of previous_customor,
i d e n t i f i e r l i k e my customer-id,
l i k e my_eustemer-name,
c i t y l i k e n.y_ouatomer-city,
end of previoua__customer, .
move current_custoner to previous customer.
currem_customer previous_customer.
move-corresponding (id identifier) ,
.
:
types: begin of t a b l e _ l i n e ,
field_l,
field_2 type i,
end of t a b l e _ l i n e .
data: source_table type table_line occurs 100,
t a r g e t _ t a b l e type t a b l e _ l i n e occurs 50.
move sourca_table to t a r g e t table
,
.



, , . , , , .
, sin cos.
/4 , -.
.
, last_admissible_dace * receiving_date + 10. :
* + .
net_income = income * < 1 - tax ) .
= * cos ( alpha ) .
, ( , , ):
data: black swans type i ,
white swans type i .
data percentage type p decimals 2.
percentage = black_swans * 100 / (black_swana + white__swans ) .
. , , :

87

n5 = ( ( n l - n2 / ) * < n4 + n l > / 5 ) .
, , . , , , :
5 ( n l - 2 / ) * ( n4 + n l ) / n S .
:
1. (, cos sin)
2. ()
3. (*), (/), (div), (mod)
4i (+) (-)
, /4 , :
: abs, sign
: cos, sin, tan, acos, asin, atan, exp, log
: sqrt
: strlen

/4 ( compute).
, /4:

= ( alpha )
* ( * l o g ( ) )
d - n div q
= n mod q
, , , . ,
data, , :
data name (25) .
,
. move:

data: n4 (4) type n value ' 12A4' ,


nl type n value ' 2 ' ,
Jt t y p e p.
X - n4 * n l .
n4 124. nl 2, , , n l , 248 .
/4 , -, . ,
(, ) /4, Remote Function Call (. 27).

. , compute,
, compute".


/4 .
,
.

88

, compute
. , :
data: shert__counter(2) type p.
do 1000 tines.

ehort_counter = short_counter + 1.
enddo.
, short_oounter
. , ():
data: counter type p.
, ,
15.
. - ,
, :

data: type p value I,


type ,
z type p.
Z < / .
, .
, :

if = 0.
* divisor zero: do something. . .
els*.
* divisor non-zero: divide
I m t endif.
, , /4 .
. /4 ,
, , .
, .. .


() concatenate:
data: first (25), middla(2), last(25),
full(54).
first - 'con- .
middle '.' .
last = ' tanate' .
concatenate first middle last into full.
full .
(, ,
), :
data: directory!(2), directoxy_2 (10) , file_name(10) ,
path(24).
directory_l = ' a:' .
directory_2 = 'usr' .
file_name = 'programs' .
concatenate directory_l direotory_2 filename
into path
separated by ' \ ' .
path 'a:\usr\programs'. sy-subrc, , ,
.

89

:
data; l i s t < 4 0 ) ,
_1<25) , _2(25> , _(25) .
l i s t = 'Edison,Smith,Young'.
eplit l i s t at ' , ' i n t o name_l name_2 _3.
, , ,
. , ,
, sy-subrc .
, , ,
. ,
, :
data name l i k e namo 1 occurs 10.
l i s t 'Edison,Smith,Young,Edwards' .
split l i s t at ' , ' i n t o t a b l e names.
names : Edison, Smith, Young u Edwards.


shift, by n places:
name_l = ' Edison' .
name 2 = ' Smith' .
name_3 = ' Young' .
shift name__l.
shift name_2 by 3 p l a c e s .
shift name_3 r i g h t .
name_l dison, name_2 th, a
name_.3 Young ( ). , )'
, .
, (,
), shift. , ;
names 'Alexander B i l l Charles' .
shift names up to ' B i l l ' .
Bill names, names
Charles. ,
sy-subrc. , , , :
* ' Joanna
' .
shift name r i g h t d e l e t i n g t r a i l i n g apace.
shift name
Joanne. space () , .


replace, ( ) ;
string = ' V a r i a b l e : fi. The v a r i a b l e & is s u b s t i t u t e d l a t e r .
replace ' fi' with 'X' i n t o s t r i n g .
string Variable: X. The variable & is substituted later.. & X
translate:
t r a n s l a t e s t r i n g using '&X' .
& X, ..
Variable: X. The variable X is substituted later..

translate . , . ,
:

90

expression - 'a ** 2 + ** 2 - ** 2' .


translate expression using 'axbycz' .
** 2 + ** 2 2.



, California :
t e x t 'Texas California Mew Mexico Louisiana Oregon'.
search t.*act for ' California' .
if ay-aubrc n* 0. writ* 'Not found', endif.
, (sy-subrc) . ,
sy-fdpos (
sy-fdpos - 6). search ,
:
search t e x t for 'cAliforniA' .
, :
search text for 'New M' .
iy-subrc 0, sy-fdpos 17.
, , "":
data: string(6) value '/4' .
search string for ' ./4 .' .
./4_. , string
, /4_ .
/4 . , letter :
types text_line<80) .
data l e t t e r type teact_line occurs 100.
letter Dear Sir, thank you for your letter of 12/31/1999.

search l e t t e r for ' y o u ' .
: sy-subrc - 0, sy4abix - 2, sy-fdpos 6.
sy-tabix , , a sy-fdpos . , search
:
searoh l e t t e r for 'thank' starting at 2 ending at 100.
search l e t t e r for 'Sincerely' starting at 3.
,
, .


,
, .
(,
). , :

1
lanl
of2
12
move

- 2.
- 3.
- 4.
3.
s+ol (lanl) to t+o2 (Ii2) .

move ( 3 )
( 5 7).

91

:
* compute
* target
* move

target
=

source.

source.

source

to

target.

/4 , .
move, , .
move-corresponding
.
, ;
.

: concatenate, shift, replace, translate, search.
.
.
, .

94

move
move-corresponding.
() write. /4
, , , .
write, ,
. , (. 17). , , , . ,
, .
, , 17.


write , .
, write, /4 .
, .
, :
writs: 'This is the current date:', ay-datum.
This is the current date:, (, 12/31/1999), sy-datum. .
/4 , ,
" ".
, ,
. , .
(.) (,) (, MM/DD/YYYY
DD/MM/YYYY) ,
(Administration) R/3.
:
data: string(20) ,
int type i ,
packed_number type p decimals 2,
date like sy-datum.
string = 'Customer l i s t ' .
int = 17.
packed_number = 5 / 4 .
datum = ay-date + 30.
write: string, i n t , packed_nunber, date.
Customer list string 20 , 17
int ( ) packed_number 1.25,
(.) . , , date !
01/30/2000, MM/DD/YYYY.
(,),

, nj
. , ,
. line-si
new-page. 84 .
new-page ,
.

95

do/enddo,
40 . sy-index, " " counter ( do/enddo 9).
10 44 .
, .
, .
program abapteot no standard page heading.
data counter(9) type n.
nciw-page l i n e - s i z e 44
do 40 tiiaes.
counter - ay-index.
write counter.
enddo.
- . 8.1. no standard page heading program , ,
.

. 8.1

40

, new-line.
(/) write
skip. .
. 8.2.
write 'This string will appear on the f i r s t l i n e . ' .
new-line.
write: 'New l i n e ' ,
/ 'Yet another l i n e ' .
skip 3.
write / 'skip 3 produces three empty l i n e s . ' .
at write
position, .
:
write at 5 ' p o s i t i o n 5' .
- 20.
write at pos 'position 20'.
position = 40.
write 'position 40'.

96

. 8.2

(, 2
), )' , at:
pOS sa 10 . 1 2 0 .
new-line.
write at pos(len) 'position 10, length 20'.
under, .
, , .
write )' ,
. .
new-page.
top-of-page end-of-page (. 17).



,
color write format
, , ,
.

.
.
.


/4 200 ,
, as symbol as icon write;
write: / sym_jphone
as symbol, 'telephone',
/ sym_fax
as symbol, ' fax machine' ,
/ sym_lef t_hand
as symbol, 'hand pointing left'
/ sym_caution
as symbol, 'caution',
/ icon_eheckd
as icon,
'checked; okay',
/ icon_delete
as icon,
'delete',
/ icon_pnnt
as icon,
'print'.

97

, include <symbol> include <icon> . - . 8.3.

. 8.3

,

color write :
write 'Header' c o l o r c o l _ h e a d i n g .
.

/4

coljieading

-
col_key

-
col_normal

-
coLbackground

col_positive

coLnegative

col_group

coLtotal

, ,
(, ). SAP , - . ,
.
coLbackground. write,
. format,
col_total () :
format: c o l o r c o l _ t o t a l .
/4 format color off
. , write
.
, ( );
write ' total sum' color ool_total intensified ott.
, format, , .
write .
:

98

format color col__heading.


write 'Header'.
format color off.
skip.
w r i t e : / 'Key f i e l d ' color coi_ky,
'Background' ,
_
'Negative' color col_nogativ,
/ ' Total sum' color c o l _ t o t a l i n t e n s i f i e d off.
, , -
, . -,
, .
.
, , ,
( ) ,
. , , .

,
/4 , .
:
no-sign:
currency:
decimals;
using edit mask:
no-gap:

/4 Help write.

, (edit mask):
data time type t value '154633'.
write at (8) time using e d i t mask '
: :__' .
15:46:33. using edit mask
, . 15:46, t
6, , .


,
- . /4
, . .
() . ;
w r i t e : / ' L i t e r a l without teact symbol',
/ ' O r i g i n a l t e x t of the source code' (001),
/ text-002.
Editor
, (. 8.4).
. 8.5.
,
.
( ) ,
, . , , , , .

8.4

8.5

99

100

,
" 17.

:
, , ,
.
at write.

symbol icon.
, .
, : no-sign, currency, decimals, using edit
mask ..

.
,
, , .

102

Abap/4 , , ..
, . , .
, , , , .
, , -, R
. ,
, . , ,
.. . , ,
. ,
. .
/4 , , .
, . , if/else/endif do/enddo,
, . . (, ) .
, .
, ,
, .

, ( V VI),
, if. ,
, , I 100.
do/enddo, while/endwhile.

:
/4 "
. , ,
at line selection, .
, :
, select ( 11 , ), write:
s e l e c t * from customers.
write/customers-name.
endselect.
,
. at line selection:
at line-selection
s e l e c t s i n g l e * from customers whore..,
- at line selection .
at line selection, /4 ,
:
at line-selection, at user-command: (. 17)
top-of-page, end-of-page:
(. 17)
start-of-selection, get, end-of-selection: , Logical Databases (. 15)
process before output, process after input: ,
(. 19)

103

. start-ofselection, .
.
, .

:
/4 (logical
conditions) (loops).

( )
. , , -, . /4
:
if/elseif/eise/endif: ,
case/when/endcase:
if/elseif/else/endif :
if c u s t o m e r s - c u s t t y p e = ' ' .
* book business
. . . else.
* book economy class
. . . endif.
customers-custtype, (), if
else. , endif.
customers-custtype , else endif.
if. , 1,
, zero, 0, 1
:

If > 0,
* + 1.
Is*.
iff - 0.
write ' z e r o ' .
else.
n = n - 1.
endif.
ndiff.
if , . : n > 0 , n = 0 < 0.
, elseif:
iff n > 0 .
n n + 1.
lseif n = 0.
write ' z e r o ' ,
I.e.
n = n - 1.
ndif.
if elseif. , elseif, , , elseif else, ,
endif. , , else.
, .

104

if, elseif.
if , elseif. if elseif/ else
if. , endif, elseif else , :
i f n = 0.
write ' z e r o ' .
endif.

case/when/endcase:
case color.
when 'red' . write ' c o l o r is red'.
when 'green 7 . write 'color is green' .
when ' yellow'. write 'color is yellow' .
when others. write 'non-standard c o l o r ' .
endcase.
color red. , when. case , , endcase.
when ( green). , when 'green'. , ,
, , when others. , ,
when. :
if color = 'red'.
write 'color is red'.
elseif color = 'green' .
write 'color is green' .
elseif color = 'yellow'.
write 'color is yellow'.
else.
write 'non-standard color' .
endif.
, when
. , case,
, when. , case
> .


if : if .
:
- b (true, )
> b (true, )
/4 :
a eq b ( = b)
a gt b ( > b)
:
a ne b ( ): b
a It b (a < b): b
a ge b (a >= b): b
a le b (a <= b): b
a between b and : (b <= a) and ( )

105

a is initial: a (0 ).
and or,
not:
i f (not (1 e q 2 ) ) o r (3 = f4 and 5 = 6 ) .
, . not , and, , , .
:

if not fl eq 2 or f3 - 4 and 5 = 6.
,
:
i f f l = 2 and 3 > 4 and 5 < 6 .
fl f2, false ()
.


. ,
, , :

data: n(4) type n value '124' , type p.


if n > .
write 'n is greater than p ' .
endif.
, (0124 0).
, . ,
. 124, (0).
, (, < ) ,
. :
1. ,
( ).
move 8.
2. f, f.
3. , .
4. ^ d t, .
" " , .
5. , , .
6. , ,
().
, , ,
:
data: c4(4) v a l u e ' 1 2 4 ' , 5(5) v a l u e ' 0 0 1 2 4 ' .
i f c4 = 5 .
write ' 4 and c5 are e q u a l ' .
ndif.
4 5 124 00124 , 4 = 5
, 4 , (.. 124

00124).


, , > .
, (, )
(, SAP). /4 :
b ( ): b
b ( ): b ( )

106

9
a c s ( ): b ( ; )
b ( ): b (* , +
)
:
data:

a (6) value 'AEAP/4' ,


result().
i f ' ' .
result - a+sy-fdpos(2).

endif.
, true (). ,
sy-fdpos ( Field position )
( 3). , result /.
:
i '' .
write 'a only contains , ,
endif.

and P' .

, / 4. :
i f a cs '' .
write ' a contains the string BAP' .
endif.

, . , ,
:
if ' *++' .
write ' a contains followed by two more characters' .
endif.

, ,
( *) , ( ++).
.
/4' '': false, sy-fdpos-3 ( /4, )
'/4' cs '': true, sy-fdpos=l ( /4)
'/4' cs 'AA': false, sy-fdpos=6 ( /4)
'/4' '**': true, sy-fdpos=l ( /4)
'/4' '+++*': true, sy-fdpos-0 ( ++A+ /4)
'/4' '+*': false, sy-fdpos-6 ( /4)

, , .

:
do/enddo
while/endwhile
, ,
IV.

, :
do 100 times
square__number = sy-index ** 2.
write square_nurobar.
enddo.

107

, , sy-index 1.
1 .
100 . ,
, :
data n t y p e .
= 200.
do n times.
enddo.
. ,
:
do.
* terminate loop after 5 steps or when the color is red
if sy-index > 5 or color 'red', exit, endif.
* main loop step
write..*
enddo.
exit , , enddo. : , .
( ) . continue
:
do max times.
f2 - f l + f0.
if f 2 < 0. continue, endif.
f3 * sqrt( f2 ).
enddo.
do/enddo . sy-index
, .
, .
, :
min = 0.
max 1000.
while key <> s e a r c h _ k e y .
key = ( min + max ) div 2.
if key > search__key.
max ** key - 1.
else.
min * key + 1.
endif.
endwhile.
while while endwhile.
, , endwhile. , , , (time-out).
exit:
while a <> .
if a > b . exit, endif.
endwhile.
> b , while ,
endwhile. do/enddo
, continue.

108

/4, , , . .
if/elseif/else/endif ( )
.
case/when/endcase .
.
, move.
do/enddo .
(do n times) Exit.
while/endwhile .
.
. .

10

110

10

A/4
, , .
:
* { ) ,
,

(, ).
, .
, .
, , .
,
(Syntax Check). ,
.
, .
. , ,
, .
(
) 18 21.



, , ( ) form/endform
perform:
data flag value ' G' .
write flag.
perform set_flag.
write flag.
form set__flag.
flag = 'L' .
write flag.
endform.
perform ,
form set_flag endform. , ( flag), . G L L.
/4 .
(. " "). , ,
. , , , ,
(, at line-selection).


set_flag. , , , data:
data flag value ' .
write flag.
perform write_flag.

111

write flag.
form write_flag.
data l_flag.
l_f lag ' L' .
write l _ f l a g .
ndform.
l_flag write_flag,
iHtse G L G.
flag l_flag ,
flag "" , , , .
. ,

.
.

(.. ). .
, :
perform count.
perform count.
form count.
s t a t i c s c a l l s type i .
c a l l s = c a l l s + 1.
write c a l l s .
ndform.
count calls 1,
1, 1 2. statics
, data.
, ,
.
,
,
.


, . .
, (, , )
. , , , . , . /4
. , ;
. " "
.
,
:
types: t_name (25) .
data:

name_l type t_name value 'A' ,


name_2 type t_nama value 'B' .
perform set__name changing name__l.
perform set_name changing name_2.
form set_name
changing f_name type t_name.
write f name.
f name = ' Smith' .

112

10

write f_name.
endform.
:
name_l
f_name name_l.
f-name
, Smith,
.
f_name name_2.
f_name ,
Smith, .
,
.
"
".
.
:

perform f changing al
a2
.
form f changing f 1 l i k e al
f2 like a2
f3 l i k e a3.
f3 = f 1 + <f2 * 3) .
endform.

:
1. al
2. f2 2
3. f3
( form) ( perform)
. (Syntax Check)
Editor . ,
,
. "" ,
, .
. ,
f f_ .


:
(read only): ,
(changing):
()
(by value): ,
(by reference): ( ),
,
, /4.

113

using value (p)

using p

changing value (p)

changing p

, ( ).
, . , - f2, (fl) , (f2) .
f3 (. ) :
perform calc using
al
a2
changing
a3.
write: a3 .

form calc using value


changing value
f3 - fl + (f2 * f3) .
endform.

(fl) like al
f/2 like a2
<f3) like a3.

al
(, cl ), . 2 f2.
. = cl + (2 * )
cl 2. , endform,
.
. ,
.
, (, ).
, using changing
{ ). ,
using, . ,
(using changing) . , - (using) (changing)
, . /4 "
" (. " ").
(
header lines tables). .
/4,
.
. . ,
:
data all_customers like customers occurs 50 with header l i n e .
perform read_custamers tables all_customers.
form read__customers tables f_customers structure all_customexs.
select * from customers into table f_customers.
end form.



type like, . ,

. /4 (, i, p, n, f, d, t),
. ,
.
data: name_l (25) ,
nama_3 (2) .
perform set__name changing name_l.
perform set_name changing name_3.
form set__name changing f name l i k e name 1 .
f_name = ' Smith' .
endform.

114

10

name_l f_name,
f_name name_3 . , .
.
, ,
.
:
types: t_name__l (25) ,
t_nama_2 (25) .
data: name_l type t_name_l,
name_2 type t_name_2.
perform set_name changing name_l.
perform set_name changing name__2.
form set_nam9 changing f_name l i k e name_2.
f__nama = ' Smith' ,
endform.
,
. , :
form set_name changing f_name type t name_2.
( ), .
. ,
(, ),
( , ), .
data: string_l(2> value '' ,
string_2(8> value '/4'.
perform write_first__character changing: string_l,
etring_2.
form irrite_first_character changing f_jstring.
hift f__string l e f t deleting leading space,
write at (1) f_string.
endform.
:
form write_first__character changing f_string type .
, . , , ,
short_number :
data hort_string <3).
data short_number (3) type n.
perform write__first_character changing: shortystring,
short_number.
. , :
form sort_and_eearch_in_table
changing f_table type table.
sort f_table.
search f__table for ' Smith' .
endform.
. ,
, (sort) (. 12, , ). , sort .
, :

115

: (
), .
: .
: ,
( ) .



, ..
. ,
, .
, . ,
.
function endfunction call function. .
c a l l f u n c t i o n ' MY_FIRST_FUNCTION' .
f u n c t i o n ' MY_FIRST_FUNCTION' .
w r i t e 'My f i r s t f u n c t i o n ! ' .
endfunction.
/4 Editor
function/endfunction , (.
" "). () Editor: Edit (), Insert Statement ( ). .


Development Workbench Object Browser,
Single Object ( ), Function Group Objects
( ) (.10.1).

. 10.1

116

10

a ,
Function Module ( MY_FIRST_FUNCTION).
Create () . 10.2.
(. 10.3). Short Text
( ) This is my first function, .
. Process Type ()
Normal ().

. 10.2

. 10.3

,
. ,
, .
, .

(Function Module Create). , Function

117

Group Possible Entries ( ),


( F4). ,
. 10.4.

. 10.4

, .
, (.
19 22, ).
, Include, .
, . , .. .
,
Function Group ( ) ,
. 10.3. , .
, (. 10.5).

. 10.5

118

10


, . call function , - . ,
. importing exporting , .
.
.
,
. ,
( )
. .
f u n c t i o n 'CONVERT_TEMPERATURE'.
*
*
*
*

Local

interface:

importing

value
value

(temp_unit) type
(degrees) type p

exporting reference
if temp_unit = ' F' .
conv_degrees =
else.

(conv_dagrees)

( degrees - 32 )

type p

* 5 / 9.

conv_degrees = degrees * 9 / 5 + 32.


endif.
endfunction.

:
data deg type p.
c a l l function 'CONVERT_TEMPERATURE'
exporting temp_unit ' F'
degrees 100
importing

conv_degrees

dag.

value (p)
reference (p). , .
/4 Development
Workbench. , : Goto >
Imp./ExpJnterface , ( 10.6).

. 10.6



Attributes Maintenance

119

, Dictionary,
, . 10.7.
P/4 (, n, i, p, d ..), Dictionary (. 5).
, .
Proposal.

. 10.7

( )
(. 10.7). ,
. , Proposal, .
, ,
; .
.
,
( ). (.10.8),

. 10.8

120

10

: Goto > Tab./Exc.Interface. ,


.

, , .
,
. : Goto > Tab./Exc.Interface
(. 10.9).

. 10.9

, raise ().
, ,
.
function
* Local
*
*
*

read_cu3tomers.
interface:
importing value (i_name) like customers-name
tables customer_table structure customers
exceptions not_found

select * from customers into table customer_table


where name = i_narae.

if sy-subrc ne 0.
raise not_found.
endif.
endfunction.
:
c a l l function 'READ_CUSTOMERS'
exporting i_name = 'Smith'
tables customer_table - Cust__tab
exceptions not_found = 1.
if sy-subrc = 1.
write 'Customer not found' .
endif.

121

raise not_found . , , , .
,
sy-subrc. , ,
.
.
, :
cell function . . .
exceptions not_found = 1
invalid = 1
unlikely = 2.
if sy-eubrc = 1.
write 'Error'.
alsexf sy-subrc = 2.
write ' Unlikely case' .
ndif.
, others ():
call function . . .
exceptions not_found = 1
others = 2.
others ,
. , raising
message ( 20).
(), .
.


Function Module ( ) Function Module Create: Administration ( : ). . 10.10.

. 10.10

122

10

: Edit >*Insert Statement ( )


/4 Editor (. " " 3).
(. 10.11) Call Function ( ).
, , ,
Insert (. 10.12).

. 10.11

. 10.11
,



() ,
. .

123

form (.. endform ), .


, R/S.
. .
( ) /4
exit (), perform call fanction:
data: number typa i value 5,
result type i value 1.
perform factorial.
write result.
form factorial,
if number <= 1.
exit,
endif.
result = result * number,
number = number 1.
perform f a c t o r i a l .
ndform.
result number.
exit , . , exit
, , . ,
(, ,
endloop ).
1. (do/enddo)
2. (while/endwhile)
3- (form/en dform)
4. (function/endfunction)
5. (select/endselect, . 11)
6. (loop/endloop, . 12)
exit -
( ).

.
, , .
,
( ).
,
.
( type data).
.
.
, .
, .

124

10

.
.
, ,
.
.
exit . , , .
IV , .

IV

11.
12.
13.
14.

11

128

11

select ,
. ,
, where. , . 11. ,
, , ( select , /4 Dictionary). .
SQL ,
.


, customers ,
11.1, bookings , 11.2.

11.1
customers
00000001

Edwards

Small Town

654-321-1234

00000002

Young

Village

333-444-2222

00000017

Smith

Big City

717-161-5151

87654321

Edison

Fort Myers

111-111-1111

11.2
bookings
ABC

1000

19991230

001

00000017

19990101

ABC

1234

19991230

002

00000002

19991229

ABC

1234

19991231

005

00000017

19990101

XYZ

0006

19990606

008

00000001

19990101

XYZ

0007

19990505

009

87654321

19990101

, ,
customers, /4 Dictionary. /4:

t a b l e s customers.
s e l e c t * from customers.
write: / customers-name.
endselect.
customers
. tables,
, ( )
, Dictionary. select/endselect
, customers.
select , .
.

tables customers.
data my_customer l i k e customers. "alternative work area"
s e l e c t * from customers into my_customer.

129

write: / my__customer-name.
endselect.
( )
, . ( , ) ,
. ,
,
. , :
, .
tables , ,
Object Browser Development Workbench , Dictionary.
tables.

select

/4 select, .


, . ,
,
, , :

data all_customers

like customers occurs 100


with header line.
select * from customers into table all_customers.
loop at all_custamers .
write: / all_custamers-name.
endloop.

" " . loop/endloop,


12.
:
. , , :
select/endselect , .. .
select into table , .
.
, , ,
. , loop/endloop ,
, , .
12.

, .
" ", select .

130

11

select into table ,


. , ,
Dictionary, ,
.

where
select
. , . , 01/01/1999:

data customers_orders l i k e bookings occurs 100.


s e l e c t * from bookings i n t o table customer_ordars
where order_date '19990101'.

where ,
01/01/1999. ,
. where
: , , , .

eq
ne
It
le

=
<>
<

ge
between a and b
like
in (a,b,c)
in selopt

>=



<=

b

Select-Option
, and or. , , 01/01/1999,
87654321:

s e l e c t * from bookings into table customer_orders


where customid - '87654321'
and order_date >= '19990101'.

, , , ,
, . like:

s e l e c t * from customers into table all_customers


where name l i k e '%'.

(%) , , .. Edwards, Edison, McElton.


(_). , Bell
_11, , Bill, Ball ..
in Select-Options where. , , .
Select-Options
" ".
R/3 Clients (), Client . Client , clnt, (. 5).
select Client where, Client, .

131


select single where, . sysubrc ( ) ( )
:

, select single ,
(.. = eq).


(*) select . , - .
(, id name),
select. (, cid cname) into .

, .
, 10 000 , 100 ,
, , , .


, . , select count(*) ():

count_bookings ,
where. , ,
:
max
min
avg
sum
, , , :

132

11


select , . /4 :
order by select
, (. 12)
order by
select, :

,
order by primary key. .


select , .. ,
where.
where.
/4 .


Select-Options
, where (..
, ). ,
. /4
( - selection screen), .
,
Select-Options, .
SelectOptions, Select :

Select-Options
.
Select-Options 16.


,
, . select from:

133

CUSTOMERS.

where
, where,

where. , conditionsjab:
name l i k e ' E % '
and c i t y l i k e ' S % '

where :

select * from customers i n t o table all_eustomers


where id between 1 and 999
and (conditiona_tab> .

1 999,
S .
, condttionsjtab
.
, select . . ,
, where
. , ,
SQL ( Select-Options where).



. - , . ,
customid bookings customers. /4
, :
select, where
,
Dictionary
for all entries
.
customers bookings . , , 01/01/1999. , ,
, .
:


Edwards
06/06/1999
Smith
12/30/1999
Smith
12/31/1999
Edison
05/05/1999


select
select,
where:

134

11

. , select . select , select


. , 01/01/1999,
, .
select . ,
/4
select. ,
.

Dictionary

, /4 Dictionary, (.. select). , vcustbook customers bookings fldate order_date
Dictionary. U.S.
,
. ,
, select.

11.3
vcustbook
Edwards
Smith

19991230

19990101

19991230

19990101

Smith

19991231

19990101

Young

19991230

19991229

Edison

19990505

19990101



for all entries select.
select, where
. select
. :

135

select bookings, where


all_customers. where customid = all_customers-id for all entries.
, select :

, appending table , .


.
select
, select
. , (, bookings-connicl)
( )
, . ,
select , 01/01/1999
, /4 Dictionary

, select
,

() . vcustbook


Dictionary

136

11

for all entries



, select,

select
, :
(, 50 200 )

,
, 01/01/1999
, ( ),

, Dictionary

, , Dictionary,
, ,
. , , ( for all entries)
, .
, .
, ,
(, ). SOL
, .

select/endselect .
select into table ,
.
where.
, ,
select single. where
( = eq).
.
select (, , ).
order by
, .
Select-Options,
where.
, ,
select, Dictionary for all entries.
.
.

12

138

12

11 " "
. , . ,
/. ,
"" .
,
(,
). , , .
.


( ) data.
" "
, .
select. , :
data all_customers like customers occurs 100.
s e l e c t * from customers i n t o table all_customars.
.
, . , ,
, , , . -
(,
).
,
/4 . , . Occurs Parameter ( occurs) ,
.
, .
.


4 5,
with header line ( ), /4
, , .
.
, ,
.
. (
)
() (. 11).
. ,
.

. ( /4),
().
, . , :

139

data all_customers

l i k e customers occurs 100


with header l i n e .
( 12.1):

12.1
all_customers
+


00000017

Smith

Big City

717-161-5151


00000001

Edwards

Small Town

654-321-1234

00000002

Young

Village

333-444-2222

00000017

Smith

Big City

717-161-5151

87654321

Edison

Fort Myers

111-111-1111

( )
, . /4
(, append loop) ,
( , move) .
. ,
, .
.


/4 :
select
* append
* insert
move
.


11.
, into table select:
ralact * from customers i n t o t a b l e a l l _ c u s t o m e r s .
.
.
appending table:
Mlact * from customers appending t a b l e a l l _ c u s t c m e r s .
, /4
. Occurs Parameter " ".


select ,
, .
, , , -

140

12

(..
customers).
t y p e s : begin of t_cuetcmer__city,
id
like customers-id,
city like customers-city,
end of t_cuetomer_city.
data: customar_cities type t_euetojner_eity occur 100
with header line,
select * from customers.
move-corresponding customers to customer_cities.
append customer_cities
endselect.
, append ()
. ,
. , append
12.2, customer_cities :

12.2
customer_cities append

00000015

Dry Greek


00000001

Small Town

00000002

Village

00000017

Big City

87654321

Fort Myers

00000015

Dry Greek


data

, , .
(work area), append:
my_customer l i k e customers.

append my_customer to all_customers.


( )
.
/4 . , append . ,
(
), , .
, lines of append. , ali_customers old_customers:
data old_customers like customers occurs 10.
append lines of old customers to all_custoraers.
from x to .
lime of R/3,
Release 3.0C.


append .
.

141

insert, , . , , ,
:
i n s e r t c u s t o m e r _ c t i e s index 3 .
12.3 , (Header Line), , (Table Contents).

12.3
customer_cities table
Header Line
00000005

Pleasant Site

Table Contents
00000001

Smatl Town

00000002

Village

00000005

Pleasant Site

00000017

Big City

67654321

Fort Myers

00000015

Dry Greek

append, insert ,
from. , .
lines of from x to . , 2 5
old_cities customer_cities, 3, 4, 5 , 3 customer_cities 7:
insert lines of old_cities
from 2 to 5
into customer_cities index 3.
, insert lines of , .
lines of R/3,
Release 3.0C.


move
. move
all_customers foreign_customers:
tables customers.
data: all_cuatomers
like customers occurs 100,
foreign_customers like all_customers.
s e l e c t * from customers into table a l l customers.
move all_cu3tomers to foreign_customers.
, ( !)
move.
:
tables customers.
data foreign_customers h like customers occurs 100
with header line.
s e l e c t single * from customers where id = '00000017'.
move customers to foreign_customers__h.
append foreign_customers_h.
6 . 65

142

12

customers foreign_customers_h,
.


, , /4 . ,
.
, .. .
. /4 Occurs
Parameter (, occurs ).
( ) , , :
estimated_size = width * number_of_lines.
. ,
50 , 4 , 200 .
,
8-16 . , Occurs Parameter, .
, Occurs (, ),
, ,
. Occurs Parameter , , ,
8 . , ""
. Occurs Parameter ,
,
.
( ), Occurs Parameter , :
, .

. .
8 (, 100
, .. 500 ),
.
8 , .
.
(, , 10 ) free, ,
:
free all_customers .
refresh,
. , ,
.



. ,
- . , sort (),
:
data my_flights l i k e a c t f l i occurs 10.
s o r t my_f l i g h t s .
, ..
.

143

12.4 my_flights .

12.4
my_flights
XYZ

0007

19990505

110

USD

ABC

1000

19991230

200

DEM

110

ABC

1234

19991231

300

DEM

020

XYZ

0006

19990606

100

USD 1

75

ABC

1234

19991230

500

DEM

010

133

12.5 ,
.

12.5
my_flights sort
ABC

1000

19991230

200

DEM

110

ABC

1234

19991230

500

DEM

010

ABC

1234

19991231

300

DEM

020

XYZ

0006

19990606

100

USD

175

XYZ

0007

19990505

110

USD

133

, :

sort my_flights by fldate price.


12.6 my_flights . fldate, a
price.

12.6
my_flights fldate price
XYZ

0007

19990505

110

USD

133

XYZ

0006

19990606

100

USD

175

ABC

1000

19991230

200

DEM

110

A8C

1234

19991230

500

DEM

010

ABC.

1234

19991231

300

OEM

020

descending (). (ascending). ,


, (..
, ).

144

12

( ) :
,
( , d ).
,
, .


, ,
. ,
( ).

:

loop at all__customer3.
write / all__customers-name.
endloop.

all_customers
( ).
, .. , , .
, select
:
loop at a l l _ c u s t o m e r s .

write / all_customers-name.
loop at new_boolcings.
write / new_boofcings-fldate.
endloop.
endloop.
sy-tabix,
,
.
.
where select,
11, ,
where :

loop at all__cus tamers


where name = ' Smith' .
write / all_customers-name.
endloop.

where ,
if, eq, =, ne, , ge, >=, (. 9). , ,
,
Small Town, ( ) ( ):

loop at all_customers
where name '*'

145

and c i t y ne ' Small Town' .


write / all_customers-name.
endloop.
, ( ):
loop at all_customers
from 10 to 15.
.
, , ,
.
, , .
into loop:
data my_customer l i k e customers.
loop at all_customers into my_customer.
write / my_customer8-name.
endloop.


:
.
read table. index
:
read table all_customers index 3.
if sy-subrc = 0.
write / all_jcustomere-name.
else.
write / 'Customer not found'.
endif.
,
. sy-subrc.
into read table, -
, . ,
:
data my customer l i k e customers.
read table all_customers into my_customer index 3.
. . ,
,
with key, (
):
read table all_customers with key id '87654321'.
if sy-subrc = 0.
write / all__customers-name.
else.
write / 'Customer not found' .
endif.
read sy-tabix.
, all_customers 87654321,
sy-tabix 4 . read
table , . ,
, , ,
:
read table all_customers
with key
name ' Smith'
c i t y = 'Big City'
if sy-subrc 0.
write: / all_customers-id, a l l customers-name.

146

12

else.
write / ' Customer not found' .
endif.
all_customers, Smith,
Big City. , , ; Robert Smith Smith. read
table ,
. , ,
(, Mary Smith, Robert Smith,
).
, . , read table binary starch ( ).
, ( ). , all_customers
, customers, :
select * from customers into table all_customers
order by primary key.
read table all_custoners with key id = '87654321' binary search.
if sy-subrc = 0.
write / all_customers-name.
else.
write / ' Customer not found' .
endif.

. , . ,
, .

. , ( ) ,
. sy-subrc
( ), .
/4 , , . .
, .
,
, :
sort all_customers by name city telephone.
read table all_customers
with key
name = ' Smith'
city = 'Big City'
telephone = '717-161-5151'
binary search,
if sy-subrc = 0.
write / all_customers-name.
else.
write / ' Customer not found' .
endif.
,
, . ,
. , ,
.

147


,
.
, .


, , read
(with key) (binary search). ,
sy-subrc . sy-tabix , , ( ). insert.
, all_customers,
12.8.

12.8

00000001

Edwards

Small Town

654-321-1234

00000002

Young

Village

333-444-2222

00000017

Smith

Big City

717-161-5151

87654321

Edison

Fort Myers

111-111-1111

read table all_customars with key id = '00000005' binary search.


if sy-subrc i 0.
all_eustom*rs-id - '00000005'.

all^cuetomers-ziame * 'Martinez' .
all_customers-city = ' Phoenix' .
all_customers-telephone = '354-321-4567''.
insert a l l customers index sy-tabix.
endif.
sy-tabix 3,
3 alLcustomers , 12.9.

12.9

00000001

Edwards

Small Town

654-321-1234

00000002

Young

Village

333-444-2222

00000005

Martinez

Phoenix

354-321-4567

00000017

Smith

Big City

717-161-5151

87654321

Edison

Fort Myers

111-111-1111

into,
. , ,
from x to .


. , , , , . , -

146

12

00000005 all_customers. modify,


:
read t a b l e all_cuetomers with key id = '00000005' binary search.
if sy-eubrc = 0.
all_cuatomers-city * ' Big City' .
modify all_cuatomers index sy-tabiac.
andif.
append, modify , from. loop/endloop , .
, Big City 717 777
:
loop at all_customers where c i t y = ' Big City' .
all_customere-telephone(3) ' 7 7 7 ' .
modify all_customers.
endloop.
from
.


, :
read t a b l e all_customers with key id m '00000005' binary search.
if sy-subrc = 0.
all_customers-city = ' Big City'
delete all_customers index sy-tabix.
endif.
delete, modify,
loop/endloop .
, where
from x to . ,
, :
delete all_customers
where name cp ' E * ' ,
refresh ():
refresh all_customers.
, refresh
clear ( ).
, ( ), . refresh
. ( statics) .


, .., ,
, at endat ( ). ,
at endat, :
at first/endat
at new f/endat f

at end ot 5/ervdai i

at last/endat

149

.
my_flights , .
:

at new f at end f ,
, f.
f .


.
, .
,
( planfli actfli). , .
Dictionary planfli actfli , .
,
.
.

extract.
.
. , field-groups
insert. , extract. , - . loop/endloop
.
at/endat:

150

12

header. , ,
. ,
connections flights.
extract, select.
extract. sort.
. ,
at/endat.
sort ,
.
at/endat , (. ).

, at/endat
, sort. , .


, , . , , , .
, .
,
:

151

, (conn_fli) (flight)
:

,
. .

/4
.
,
.
select, append, insert move.
data Occurs Parameter, .
sort .
loop/endloop where,
.
insert, modify delete. refresh
,
at/endat .

.
, ,
.
,
, . , .

13

154

13

,
, .
. ,
. , . ,
(, ). , ,
,
.
: insert, update,
modify delete. Open SQL, /4.
Open SQL - select
(. 11).
, , . ,
, Open SQL, .
, , , .
. Open SQL,
. ( ) , .
Open SQL, ,
. Open SQL
,
.


insert
, . , insert.
, .
insert,
.


insert . , , , tables:

tables customers.
customers-id = '12345678'.
customers-name = 'Brown' .
insert customers.
if sy-subrc <> 0.
write 'entry already e x i s t s ' .
endif.
customers-id Dictionary . ,
,
. sy-subrc
.
, , , insert values.
, . , Green .

tables customers.

155

customers , a my_customer ,
insert.
, , . .


, . ,
. , ,
, .
from table:

? all_customers,
, customers, , , ,
.
select ,
select. . ,
. ,
.
, accepting duplicate keys. , , ,
. ,
, . select. ,
, accepting
duplicate keys, , select insert. , , select .
modify,
" modify".
, .
, ,
, . ,
"", . "
?" " ?" , "
?" " ?" .
,
, .

156

13


update
update, . update :
.


, ,
. :

insert, , update
customers, tables . , , ,
. , 12345678,
sy-subrc .


update, insert, from table, . ,
,
:

changed_customers ,
(, Brown, Green White ).
, , , City unknown. ,
.
sy-subrc.
customers, , . . /4
. ,
, :

update city City unknown.


select, update
where.

157

select 11.
, , set where update,
, , .
, , select, loop
update. set , . ,
" " .
: .
:

1234 ABC
30/12/1999 31/12/1999.


modify
, .
select ( ) insert update. modify insert update, . ,
12345678, , .
:

/4
(, 12345678).
.
.
insert update, from table :

, ,
all_customers. ,
City unknown. .
modify insert/update
. , insert. -

158

13

. , modify ,
(insert update) .


delete
delete .
insert, update modify, delete , where:

delete 12345678,
customers. delete , delete ,
1.

, (%) SQL ,
.
, sy-subrc .
sy-subrc 0 ,
.


, , , . , .
:

insert.
.

Open SQL insert, update, modify delete.


Open SQL , , .
( ).
(,
) .

14


/4

160

14

/4 . , 4
,
. , " "
, .
R/3 .
, , Open SQL
select insert. "" , .. .
, ,
. .
export import
. export import
, .
.
export import
, ( /4 Memory), . /4 Memory (
). export ( ) .
export import , ,
. ,
, .


, . export to memory,
id. .
all_customers all_bookings, export , CUSTBOOK ( ,
).

, CUSTBOOK,
import:

all_customers all_bookings,
CUSTBOOK, .
,
. "
".
, id, 32 . export , -

161

, , export. sysubrc import,


, ,
. , .
import export ,
, , ,
.


, import, , ,
. , CUSTBOOK all_bookings all_customers:

( CUSTBOOK) import
( all_bookings) , .
import Memory, . ,
CUSTBOOK, :

new_customers ,
. .

.


import to,
. , ,
all_bookings, new_bookings, :

new_bookings, data, all_bookings, CUSTBOOK. all_customers .


,
from :

old_customers all_customers, old_bookings all_bookings, CUSTBOOK.


free memory, .
, :
CUSTBOOK, .

162

14



/4 . , . P/4 .
18 " "
21 "".
, submit () ,
, .
. /4 . ""
, . ,
(: System > Create Session R/3), .


, ,
. . , , , .


export import, /4,
. ,
, , zflight :

, .
all_customers all_bookings :

zz , , . ,
, id. zz zflight, . zflight ,
: /4.
-, . .
, .
(, , zflight). sy-subrc
import, , ,
.

163

, ,
. : to (import) from (export).
,
. , aH_customers all_booking$, .
all_carriers ( ).
:

, , import alLcustomers all_bookings, a alLcarriers .



export import.
,
" " 5.
, :
1. , Client (),
mandt ( Dictionary clnt).
2. reiid ( Dictionary char (), 2)
.
3* , 1 2, .
char , id
export import. .
4. snf2 ( int4). export import.
5. , 4, , export. .
.
6. clustr ( int2) clustd ( Iraw), export import.
clustd .
, . , , 3800, 7600 . .
. 14.1.
, id export import,
, . Dictionary , 3, tables
.

164

14

. 14.1
zflight

export import .
, ,

.
export import , .
/4
.
, .
, /4 .
.

V

15. Logical Databases
16. Report
17.

18.

15

Logical
Databases
Logical Databases
: select Logical
Databases


Logical Databases

168

15

, Logical Databases
/4 , ,
.
.


:
/4 Query,
, , Logical Database,

select
.
/4 Query ,
. , ,
. /4 Query. /4, ,
.
/4 Query .
Logical Database .
,
.
Logical Databases /4 . Logical Database ,
.
, Logical Database :

,
(, select)
, Logical Database , . , Logical Database :
, Logical Database, .
Logical Database,
, select (. 11).

,

Logical Databases , :
select
Logical Database get
: customers ( 15.1) bookings ( 15.2).

Logical Databases

169

15.1
customers
00000001

Edwards

Small Town

654-321-1234

00000002

Young

Village

333-444-2222

00000017

Smith

Big City

717-161-5151

87654321

Edison

Fort Mayers

111-111-1111

15.2
bookings
ABC

1000

19991230

001

00000017

19990101

ABC

1234

19991230

002

00000002

19991229

ABC

1234

19991231

005

00000017

19990101

AIR

0007

19990430

010

87654321

19990101

AIR

1234

19990901

011

00000002

19990101

XYZ

0006

19990606

00000001

19990101

XYZ

0007

19990505

008
007

87654321

19990101

, ,
05/01/1999 01/01/1999.
, . 15.1.
. 15.1


,
select:
tables: customers, bookings.
select * from customers.

170

15

write / customers-name.
select * from bookings
where customid = customers-id
and fldate > '19990501'
and order_date = '19990101'.
write at /3 bookings-fldate.
endselect.
endselect.

, (Logical Database) get:


tables: customers, bookings.
get customers.
write / customers-name.
get bookings.
write at /3 bookings-fldate.

Logical Database
(. 15.2).

. 15.2


. 3.

R/3 150 (Logical Databases),


-. , Logical Databases :




Logical Databases

171


,
. (. 15.3).

. 15.3

Selection Options , Greater Than ( )


(. 15.4). , .

. 15.4

172

15

( C)
(. 15.5).

15.5

(. . 15.1).

get
get, /4. : get customers
, , .. get bookings . , get Logical Database (. 15.6). . 15.6,

15.6

Logical Databases

173

customers ( ),
bookings ( ).
"
get".

: select Logical Databases


,
:
get, select.
customers bookings
where, , Logical Database.
get.
( )
where.
.
Logical Database, Logical Database , . Logical Database
; , where select, .
, ,
, .
Logical Database , "
Logical Databases".


- :
(, = 01/01/1999)
(, > 05/01/1999)
, :
(, )
(, , S)

(, 111-000-0000
666-999-9999, 333-444-2222)
.
, .
18 (Variants),
, ,
, . 16.

get
, get
, Logical Database.
. 7 . 65

174

15

customers bookings.
, , Logical Database, . . get
get. , . , get . get
, .


. ,
ztabl-ztab4, :
ztab1 ztab2
ztab2 ztab3 ztab4
select
:

Logical Database
(. 15.7).

. 15.7

Logical Database

Logical Databases

175

, Logical Database,
:

, ,
select. , get late ,
,
ztab2. ztab1 , get . , , Logical Database,
:
1. get get late .
2. , 1.
ztab2, ztab3 ztab4 , ztab1
}'. (..
), get.
Logical Database
. , Logical Database, .


Logical Databases ,
.
,
, 06/30/1999. , , , .. .
, .
06/30/1999 .
, select
where. , ,
Dictionary, customers bookings. ,
Edison, .


, Object Browser Development
Workbench. , , ,
. Logical Database .
/4 (User's Guide).
Development Workbench, : Help >
Extended Help.

176

15

: start-of-selection end-of-selection
, .
/4 start-of-selection get.
, - .
end-of-selection get.
:


, select ,
. :

.
.
(. 16).
- ,
Logical Database (, ).
Logical Database
, .
, Logical Database ,
select (, , - Logical Databases). , ,
, Development Workbench. .
,
.

.
.
.
, , get,
, . get .
get, . Logical Databases .
start-of-selection end-of-selection
get.
,
(, ).

16

178

16


, . Logical Database
get.
, , Logical Database,
, , 15.
,
Logical
Database. , , where select. , ,
. /4 .

19.
/4 :
Parameters

Select-Options


( where select)
,
. Logical Database . ,
Logical Database. ,
( ),
Logical Database.


, , data. . ,
, , , :

. 16.1.
, - , data.
Execute (),
, . , Big City
p_city, :

,
Logical Database, .
select , ,
where select ,
.
, parameters data :

179

. 16.1


default ( value,
data). .
( ,
begin of/end of).
() 1 ,
as checkbox .
X, .
(
), (, Flight date p_fldate).
. (/4 Editor)
: Goto > Text Elements ( ). , , 17.

(Select-Options)
(, ,
). Select-Options
, . (
, ) . /4
, ,
where select.

Select-Options select
where select (. 11). , , , :
tables

customers.

select-options s_name for


select * from customers
where name in

customers-name.

s_name.

180

16

write / customers-name.
endselect.
- . 16.2.

. 16.2
Select-Option

select , customers. - :
s e l e c t * from customers
where name between 'A' and 'M'.
write / customers-name.
endselect.
, Select-Options . , , , Smith, M Shuliz.
Complex Selections . *, Single Value Selections ( ) Smith. Ranges () Shultz (. 16.3).
C () , , , ,
. Selection Options,
.
.
, (. 15)
Logical Database (. 15.3 15.5).
Select-Option (, customers-name),
for where.
( select)
. where
, , ( , , ).
SQL,
-, submit (. 18).
SQL, Select-Options where,
:
tables customers.
data a l l customers l i k e customers occurs 200

181

. 16.3


Complex Selections

with header line.


select-options s_name for customers-name.
select * from customers into table all_customers.
loop at all_customers
where name in s_name.
write / all_customers-name.
endloop.
all_customers customers. , s_name, .
, ,
(, s_name - "Customer name").

.
(/4 Editor) : Goto > Text Elements
( ).


" ", where select: . Select-Option
. ,

, .
, Select-Option,
: sign (), option (), low ( ), high ( ). , . 16.3, :
sign
()

option
()

high
(
)

EQ

low
(
)
*
Smith

I
I
I

Shultz

182

16

. (sign option) :
sign = I (Including): ()
sign = E (Excluding): ()
option = (BeTween): (, , M
Shultz)
option = C (Contains Pattern): (, , )
option EQ (EQual): (, name Smith)
option GE (Greate than or Equal to): (, id >= 1)
(low high)
: (
, customers-name). high
(option = ), .
, ,
, . , ,
(, ). , . , - ,
,
.


/4 ,
:
initialization ():
,
at selection-screen output ( ):
at selection-screen on p/s ( ): s
at selection-screen:
initialization , at selection-screen output
Enter (), .
/4 start-of-selection, ( Logical Database) get (. 15).


at selection-screen at selection-screen on p/s
. ,
ZIP , , , , ZIP (invalid):

, at selection-screen,
- . .
on p/s,
.

183

, , .
20.


. .
,
where select. , , , , :

,
, . - , , , . , s_id
customers-id, - :

, s_id , .
Object Browser, Single Object (
) . ,
, : Goto > Selections.
,
.


.
, where SQL-.
, sign/option/low/high.
(, at selection-screen) , .

184

16

, -.
, .

17




, -

186

17

, - .
, .
- , , .
, . ,
.

, . ,
(, ).
/4 , , ,
, . at line-selection ,
. at user-command
,
. , , window
call screen ( ) .
, , ,
,
(GUI). GUI
/4. ( , ..) GUI . GUI
, .
, . /4 - ,
. , . , write
, , .


. /4 , at
line-selection ( ) at user-command ( ).
. , '

, .
, .
- , ..

: at line-selection
( , ) /4. , at line-selection.
F2. ,
. at line-selection :

187

start-of-selection , .
write at line-selection , . ""
.
,
window (. " ").
, , : Back ( F3)
Cancel ( F12). . Exit ( F15) .
/4
: Back, Cancel Exit.
(Hotspots) , . , . ( ),
, . , hotspot write. ,
, ,
.

, .
- , .
( ) .
, R/3 ..

: at user-command
,
at user-command. ,
4 (, FREE),
sy-ucomm . ,
. "Free".
:

4 ( FREE) GUI
status (GUI-).
Object Browser
" ".
GUI set pf-status. , , ,
. , .

188

17


p . Object Browser Create, GUI Status (. FLIGHTS).
.
, List (), . 17.1.

. 17.1

GUI 19 22.
( Create List). , , (. . 17.2).

. 17.2


189

(, BACK ) . (.
. 17.2) Display Standards ( ), (. . 17.3).

. 17.3


Edit > Free Seats Edit,


. ,
.
Insert Entry ( ) (. . 17.4) .

. 17.4

Edit

190

17


. , FREE
, .
Maintain Status ( GUI) "FREE" F5
Freely Assigned Function Keys ( ). , F5 (. . 17.5).
Enter () "Free Seats". ( ) .

. 17.5


. FREE ,
Application toolbar ( ) (. . 17.6, ).
. (Free Seats) .

. 17.6

191

.
More
Utilities ( ) > Propose Icons ( ). ,
/4. (FREE) Application
toolbar Change Text Type ( ). . Icon (), , (. . 17.7).

. 17.7



. ,
(, BACK F3).
. . SAVE . 17.8.

. 17.8

192

17


.
, (. 19).

GUI
: .
. , Free seats
. , : ,
, , .
,
.

Active<->Inactive ( ). , . GUI ,
.
Goto > Function List ( ).
Generate (). GUI set pf-status.
, .
sy-pfkey. FLIGHTS , CHANGE , a SHOW
. SAVE , .

, FLIGHTS (. . 17.9).


, ..
, .
window starting at xl yl ending at x2 y2, (. . 17.10).

193

. 17.9
FLIGHTS

. 17.10


ending at.
. , ,
,
.
(, ),
call screen starting at x1 y1 ending at 2 2.
, 19 22. Development Workbench
,
(. 20).

194

17


at line-selection at user-command , , ,
. :
1. , (, customers-id customers-name)
2. ,
/4 . :
hide
get cursor field value

hide
, :

hide all_customers-id , Hide Area ( ). ,


, all_customers-id Hide Area.
, - , all_customers-id
(, 87654321),
:

Hide Area .
at line-selection, all_customers-id . all_customers .

get cursor
get cursor,
, , .
get cursor , ,
, field. ,
value.

195

at line-selection.
get cursor field fieldname valye fieldvalue.
if sy-subrc * 0 and fieldname = 'CUSTOMERS-NAME'.
write: 'Selected customer:' , fieldvalue. .
endif.
fieldname ,
. , .



/4,
. -,
.
. (, ) . , ,
write, , .
-, top-of-page end-of-page,
.
.
, , . /4 .

,

, , /4
.
Editor Goto > Text Elements
( ). , ,
(. . 17.11).

. 17.11
Text Elements

196

17


Titles and headers ( ) Change (). , ,
.
(. . 17.12).

. 17.12
,

, (
) .
-of-page (. ).
Selection texts ( ) (. . 17.11).
Change Change PARAMETERS/SELECTOPTIONS, (. . 17.13).

. 17.13

197

, , . 17.14. (, ,
S_FLDATE).

. 17.14

, write . ,
, "Name" "City":
w r i t e : / 'Name' (nam) , customers-name,
/ 'City' (cit), customers-city.
nam Name, a cit City. ,
, "" "" ( Name City) -: Nombre Ciudad.
cit, ,
. . , , , Name
Customer name (, . 17.15).
Environment ()
Development Workbench. ,
, write. , Nomber Name .
:
w r i t * : / t e x t - n a m , customers-name,
/ t e x t - c i t , customers-city.
text-nam text-cit , .
, , , write ,
. .


, .

198

17

. 17.15

top-of-page ( ) end-of-page ( ),
. ,
. ,
top-of-page . , new-page
( ).
.
no standard page heading (
).
.
, , , ,
. 17.16:

. 17.16



199

r e p o r t header n standard page heading.


start-of-selection.
do 100 times.
w r i t e / sy-index.
enddo.
top-of-page.
write ' This is the page header of top-of-page' .
, , ""
: 60000. .
new-page.
,
.
Sysiem > List > Print. ,
. line-count,
report.
end-of-page
line-count, . , :
r e p o r t footer
no
standard page heading
line-count 44 (3).
start-of-selection.
do 100 times.
w r i t e / sy-index.
enddo.
end-of-page.
w r i t e ' T h i s is the page footer of end-of-page' .
. 17.17.

. 17.17
,

, top-of-page line-selection,
.

. ,
sy-pfkey, GUI.

200

17

()
(, ) /4, .. Query.
/4,
.
, , , (.. ) uline sy-vline (,
. 17.18):

. 17.18

CONSTANTS MY_LINE_SIZE TYPE I VALUE 40.


DATA SQUARE TYPE I.
NEW-PAGE LINE-SIZE MY_LINE_SIZE.
ULINE.
FORMAT COLOR COL_HEADING.
WRITE: / SY-VLINE,
'Numbers and their squares',
AT MY_LINE_SIZE SY-VLINE.
FORMAT COLOR OFF.
ULINE.
DO 20 TIMES.
SQUARE = SY-INDEX ** 2.
WRITE: / SY-VLINE,
SY-INDEX COLOR COL_KEY,
SY-VLINE,
SQUARE,
AT MY_LINE_SIZE SY-VLINE.
ENDDO.
ULINE.
,
, (uline) (sy-vline) .
, my_line_size, line-size new-page. uline
, format . write ,
. uline,

201

. do
, . . uline .
, ,
"" .

at line-selection at user-command .
, .
GUI set pf-status. sy-pfkey.
window , .
top-of-page end-of-page .
uline sy-vline
/4.
, -
.

18

-
-

204

18

. , .
/4 , ,
. ,
. Development Workbench . submit.
. ,
(Variant),
. .
R/3 .
Reporting Tree ( ) 1000 , R/3.
, .
Reporting Tree , . (Logistics
, Accounting , Human Resource .)
, .
,
, .
. , , (. ).


Development Workbench
- Editor
Program > Execute (). ,
.
Back (F3) Editor.
Object Browser
Test/Execute (/).

. /4
Dictionary.
,
, . , .
R/3 System > Services > Reporting, . 18.1.
(, abapl801) Execute
(. . 18.2).
Back (F3) ,
.

submit

/4 - ,
. , -

205

. 18.1

System >
Services >- Reporting

. 18.2

Execute Program

, -. :


/4



- submit. with submit. , abaplSOl p_date
s_name:
report abaplSOl.
tables: customers, bookings.
parameters p_date type d.
select-options s_name for customers-name.
select * from customers
where name in s_name.
write / customers-name,
select * from bookings
where order_date = p_date.

206

18

customers bookings
s_name.
p_date.
abapl801 , ,
. abapl802 abapl801 :

, ,
with submit.
p_date ( sy-datum),
s_name abapl802 s_name
1801.
TWO ,
, using selection-set,
Variant. "
, ".

, :

submit . , , Back (), " " ,


submit. . submit and return:

abapl801 .
submit . ,
.

/4


, ,
export to memory (. 14), .
import from
memory. , customers:

207

submit abapl804.

]1__5, /4 . :
r e p o r t abapl804.
data all_customers
l i k e c u s t o m e r s o c c u r s 100
with header l i n e .
i m p o r t a l l _ c u e t o m e r s from memory id 'CUSTOMERS' .
loop at all_cu3tomers.
write / all_eustomers-name.
endloop.
all_customers , .
/4
.

,
(Variant) .
, . , ,
p_date 19991231 s_name
. .,
, .


G o t o > Variants > Save As Variant.
, (. . 18.5).
(. " ").

. 18.3
,


Date ()
Customer name
( )

208

18

(,
, S).
, (. 15).


(! )
(. . 18.3). , Protected ( )
Environment (), . Field Attributes, , .
Invisible ( ), .
,
. Variable ( )
" ".
, , (. " "). "" Background Only (
) (. . 18.3). ,
- , .


. , Customer name Z_NAME
Smith Edison,
. ,
.
. "" Variable ( )
Selection Variables ( ).
(, Z_N'AME), (, Customer name) (. . 18.4).

. 18.4

(Z_NAME|

, , . 18.5.
Z_NAMK ,
S.

209

. 18.5


, date, ,
. , (,
) Selec-

. 18.6

: ,
(date+10).

210

18

. , " " Period () :


From month start to today ( )
First quarter of a year ( )
Preceding month ( )

,
,
Get Variant ( ) . .
System >* Services >
Reporting, Execute With Variant ( )
\ .
, ,
. " ".
using selection-sei submit:
submit abapl801
u s i n g s e l e c t i o n - s e t ' FIRSTVARIftNT' .
abaplSOl,
FIRST_VARIANT. submit (via selection-screen, and return).


System > Services >
Reporting (. . 18.1), .
,
R/3 (. . 18.7), . . 18.7 ,
Reporting Tree ( ), .
1000 , -

. 18.7
,

211

R/3. R/3 (, ,
.) .
.
, .
R/3 (,
),
.
. ,
. ,
.

.


, , .
. ,
, , . ,
. :



System > Services > Reporting, , Background ().
(.. , /4 ). ( ).
.
, . ,
Execute Immediately ( ). , .
. , R/3,
. 8:00 , , .
, .
,
System > Services > Jobs () > Job Definition ( ), System >
Services > Jobs > Job Overview ( ).
Development Workbench
. . , , /4, , R/3.
:
( , )
,
log- ( )

212

18

Execute Editor , -.
.
submit. : via selection-screen , and return .

, .
submit .
, . .
, .
.
, .
,
() .
,
. , .

VI

19:
20: ,

21:

22: GUI (
)

19




GUI

216

19

, ,
. ,
(. ). ,
, .. ,
. , ,
.
, , , :
, .
, .
(Graphical User Interface, GUI)
, . ,
. , .
/4 ,
. /4 , . , , .
, .
/4. , , .
WYSIWYG (
"What You See Is What You Get" " , ").
, (), , , , .. Dictionary
.
, . ,
. . (, ),
/4.
.
20.
GUI , . /4 set pf-status. GUI
set titlebar. GUI
. GUI
, Workbench , .
, GUI
. GUI 17.

. , , GUI .


, . .
.
:

217
217

,
. , ,
. 19.1.

. 19.1

,
() . , , , ( ).
(, ).
.
"", ,
(. . 19.2). , .

. 19.2


218

19

,
Request (). , , .
.
. (. . 19.3).

. 19.3


Book (),
. , , . ,
.


, , .
Object Browser (. 3). (,
SAPMSABB) (.. Module Pool ,
). , Module Pool submit
Test/Execute Objecl Browser, Object Browser
. Module Pool
, , .
R/3 ,
(. 21).
(. .19.1) (. . 19.2, 19.3). ,
Object Browser. Other Objects ( )
Edit . (, SAAB) Create (). Dialog Transaction ( ),
,
( SAPMSAAB 100).
, .
Test/Execute (/ ) Object Browser.

219


, /4. Object Browser Create. , , Screen () (. . 19.4),
. (.
. 19.1). , 100 (. . 19.1), 200 (. . 19.$).
Create, (. . 19.5)
, Save.
,
. (, 200).
, -

. 19.4

. 19.5

100

220

19

(Flow Logic) ( Flow Logic " ").


. ,
, () FullScreen Editor ( ).

Fullscreen Editor
a Fullscreen.
(. . 19.6). , ,
Settings > Graph Fullscreen. Fullscreen
Editor. " " ( ),
.
.

. 19.6
Fullscreen Editor,



() Text. , "" . .
Field Name ( ) Text,
(. . 19.7).
, Entry ( ) ,
(. . 19.8). , .
. ( Field Name ). ,
Text .
.
( , )
planfli, acifli (. 6).
Dictionary,
Fullscreen. Dict/ProgFields
, PLANFLI (. . 19.9,
). Enter () . Template () Yes,

221

. 19.7

. 19.8

Key Word ( ) Average (),


.
Dictionary ( ) ,
. , ,
. Key Word None.
. planfli cityfrom, cityto carrid,
Dictionary, .
.
Ctrl (. . 19.10).
Dictionary ,
1 " " (drag-and-drop). 1 , -

222

19

. 19.9

Dictionary

. 19.10

Dictionary

. .
, Dictionary . , ,
Dictionary, ,
.


, , (. . 19.3). Frame (
) , ,

223

, , . . (. . 19.11).

. ,
.

. 19.11


, .. Field List Fullscreen Editor, . /4 ,
(. . 19.12).

. 19.12
,

224

19

planfli-cityfrom. , planfli-cityfrom, ( Ftype). Texi ,


I / O /. I / O Attribs.For I Field ( ). . 19.13
planfli-cityfrom. Fullscreen Editor.

. 19.13


(PLANFU-CITYTROM)

, Dictionary . Obligatory Input ( ). ,


. .
Req.Entry ( )')- (?). Foreign Key
( ). " ",
. , , .
,

Dictionary (. 5).
, (
). , Bright () .
,

. List Texts/Templates ( ) (. . 19.12), , .
. , OK Code Field (
). . (, fcode ).
. 4 :
data: f c o d a ( 4 ) type .
,
, OK Code Field.

225

" GUI ".


, .


.
, ,
"" . :
Process before output (PBO, ) , .
Process after input (PAI. ) ,
, .
Process on value request (POV, ) , ( F4).
Process on help request (POH, ) - ,
( F1).
,
. , process before output,
(PAI, POV, POH). , , (modules). . 19.14 , .
Field List ( ) Goto > Flow Logic. , .

. 19.14

226

19

process before output


, process before output 100.

init_request - ,
. , ,
, (include). , "" module/end module;

output , process
before output. input , ( , ). set titlebar set
pf-status (. " GUI "). , . .

process after input


process after input 100 ,
chain/endchain. :

action_request , field. action_request , ,


, , .
. . action_request:

fcode OK Code Field 100 , ,


. PAJ
case/endcase. flightjrequest, , fcode c_fcode_request.
( flag_found false),
message ,
. , -

227

. V error (). 20.


f!ight_request (
flagjound true), set 200, ""
leave screen. process before output
, set screen. , .. , . ,
Enter (), process before output , .
, call screen . , . . ( ). ,
call screen, .
22.

init_booking seats_free,
seats_required customers-name. ,
customers, dear customers.

,
Enter. , seats_required customer-name, ,
. fiag_keep_input
, . action_booking PAI
.

228

19

leave screen,
endcase.
endmodule.
flight_booking :
1.
2. ,
3. booking
4. actfil
5.
flight_booking:

229

, .
flight_booking ( ),
22.
, , , ,
form/endform.
,
. /4
, .. ( ),
( ).
, . , ,
(, ,
- ). ,
.

GUI
GUI , . GUI .
GUI ,
. ,
.
GUI Object Browser Create.
Create , GUI
Status, , 19.15.
REQUEST Screen, .
List (. 17).
22.


, 19.16,
. ,
. ,
Display Standard (. . 19.17). ,
"" .

230

19

. 19.15
GUI

. 19.16

GUI

, , Create (), Change (), Save () Delete ().


Flight Connection. : Edit (). Goto
(). Details () Environment (). Goto
Flight Connection. Cut.
:


REQU

BOOK
CLEA
BACK
EXIT

231

. 19.17

,

GUI

GUI (. . 19.18).
,
. ,
Active <-> Inactive GUI. . ,
Edit >- Insert () > Separator Une ( ).
" " ,
. , OK Code Field (, fcode).
PAI
. .

. 19.18

Flight Connection
(
)

232

19

type
function_code(4) t y p e
constants:
t y p e f u n c t i o n _ c o d e v a l u e ' RBQU' ,
c_f code_r eque s t
t y p e f u n o t i o n _ c o d e v a l u e ' BOOK' ,
c_feode_booking
t y p e f u n c t i o n _ c o d e v a l u e ' CLEA' ,
c_jfcode_clear
t y p e f u n c t i o n _ c o d e v a l u e 'BACK' ,
c_fcode_back
type function_code value 'EXIT'.
fcode
exit
GUI -

, , Generate ( GUI Object Browser). , ,


. set
pf-status, . .
, , .


, . ,
.
, REQUEST Request Delete Input.
. REQU F5, REQU Freely Assigned Function Keys
Enter. Request ,
Flight Connection. , , ,
.
REQU CLEA ,
.
: Request Delete Input (. . 19.19).
. More Utilities > Propose Icons ( ).
Text. ,
.

. 19.19



RBQU CLEA

233

Change Text Type ( ). . Choose Icon ( ) ,


(. . 19.20).

. 19.20

CLEA

. ,
GUI , (.
17). . ,
PAI. ,
( ) set screen ( ) leave screen
( ) , GUI List.
" process after input".
.
GUI , )' GUI, Goto > Function List ( ).
.
. , GUI ,
( , ).

Function Activation ( ) > In Current Status ( GUI).

GUI
GUI . Create
Object Browser. GUI Title ( GUI), , . 19.21. Flight booking: Inquiry
for flight connection ( : ).
set titlebar,
. , GUI. init_request :
module init__requesfc o u t p u t .
* I n i t i a l i z e t i t l e b a r and s t a t u s
set t i t l e b a r t i t l e request.

234

19

. 19.21
GUI

s e t pf-status c_status_request.
endmodule.
, GUI
. , :
module i n i t _ r e q u e s t o u t p u t .
* I n i t i a l i z e t i t l e b a r and s t a t u s
set titlebar '100'.
s e t p f - s t a t u s 'REQUEST' .
endmodule.


/4.
. Dictionary.
process before output (PBO), process after input (PAI), process
on help request process on value request.
.
( fields chain/endchain).
set screen call screen.
leave screen.
GUI , , ,
. pf-siatus.
GUI. OK Code Field . process after input (PAI).
GUI set
titlebar.
, GUI .
.

.

20

236

20

, . ,
. message, .
(, Yes, No Cancel),
/4 Development Workbench, .
, , , , : , , ,
-. , ,
, . , .
, /4, .
, , , . /4,
" " .



. , -
, .


message :
message e001.
. , , "" . ,
Editor. Display
Messages ( ) (. . 20.1), ,
. ,
.

. 20.1

237

, ,
message-id program:
program sapmsabb m e s s a g e - i d su.
message:
data: msgid l i k e sy-msgid v a l u e ' S U ' ,
msgty l i k e sy-msgty v a l u e ' E' ,
msgno l i k e sy-msgno v a l u e ' 0 0 1 ' .
message id msgid t y p e msgty number msgno.
&, , . with message:
message iOO2 w i t h a c t f l i - c o n n i d customers-.


process after input (PAI).
, .
. , chain/endchain,
. 19 PAI :
module a c t i o n _ r e q u e s t i n p u t .
case fcode.
when c_f c o d e _ r e q u e s t .
*
Check f o r a v a l i d c o n n e c t i o n
perform f l i g h t _ r e q u e s t changing flag__found.
if flag_found = f a l s e .
message eOOl.
"
Flight connection not available
else.
s e t s c r e e n 200. " Next s c r e e n
leave screen.
endif.
endcase.
endmodule.
,
. 20.2. ,
, .

. 20.2

,


238

20

Confirm (), , . Help .



Long text ( ) Message Display ( ).


/4 , (.. ):

s

" " ,
. .
"" PAI, . PAI.
"" "": PAI , .
, : ( New Entry),
( Continue) PAI ,
message (. . 20.3).
"" .
, ,
message.
, " " . , .
, . ,
, .. at
selection-screen (. 16). ,
start of selection, get table end of selection, , ""
"", .

. 20.3

""


239


,
, /4. Development Workbench . ,
:




, ,
POPUP_TO_CONFIRM_LOSS_OF_DATA. ,
,
(. . 20.4). .
(" "), (Yes, No Cancel). No,
. (Yes. No Cancel) answer. :
c a l l f u n c t i o n ' POPUP_TO_CONFIRM_LOSS_OF_DATA'
exporting
title
= ' Leave customer l i s t '
t e x t l i n e l = 'Really quit?'
importing
answer
user_anawer.

POPUP_TO_DECIDE, ,
. ,
. , ( 1, 2, ).
TABLE_PRINT_STRUCTURE_KNOWN
TABLE_PRINT_STRUCTURE_UNKNOWN, .
.

. 20.4


240

20

,
. TABLE__PRINT_STRUCTURE_K.NOWN , .
TABLE_PRINT_STRUCTURE_UNKNOWN,

(Online Help) R/3
Help > R/3 Library ( R/3) > Basis Components ( ) > /4
Development Workbench > Extended Applications Function Library (
) > Standardized Dialogs ( ).


, , , . . /4,
(. 10). raise raising message. , not_found
:
1. raise not: found.
2. message eOOl raising not_found.
,
, , . , . ( raise )
, . ( raising message) message .
" " ,
. others () . , message raising,
others.
(), .
, ,
.

message, , . program report.


: " ", "", "",
"" " ".
,
, .
, .
raise raising message .
, -
.
R/3,
.

21

242

21

/4
, . ,
, ,
. , , , .
, , , .
.
( ), , .
(Logical Units of
Work, LUW). LUW , .
,
. , /4 Development Workbench . LUW.
/4 Development Workbench , /. "" .
Update Task
.
(LUW) ,
. , R/3
, /4 LUW,
.

(LUW)
(. 19) , . , . ,
. ( )
, . /4
Development Workbench.

R/3
, (
) .

. ,
. , LUW. LUW
( ) , ,
R/3 . , . R/3, ,
. ,
, .
. R/3.
R/3 ( ), . , . R/3
"" , R/3. , LUW R/3 LUW .
, LUW .
:

243

1. , PAI .
2 . Update Tasks,
{. ) .
R/3 , , ,
.


Object Browser Dictionary Objects
Lock Object .
, . 21.1.
.
, (. . 21.2).

. 21.1

. 21.2

244

21

Generate (). .


, R/3 , Enqueue ( ) Dequeue ( ).
ENQUEUE^ DEQUEUE. , .
, , :

foreign_lock Enqueue ,
. .
.
R/3 ,
. Enqueue
, . -,
. Enqueue .
, .
, ,
. ,
LUW, commit work (). rollback work (), , LUW.


Dequeue. DEQUEUE_ECONNECT , ENQUEUE_ECONNECT.
, LUW .
Update Task (. " Update Task"), commit work , .
,
.


, ,
. . R/S
Development Workbench.


Object Browser
Transaction Dialog Transaction (
) (. . 21.3). , -

245

. 21.3

, ,
.
, Development Workbench .
, (Report Transaction) ,
(. 15-18). (Variant
Transaction) ,
. ,
( ).
.
.
. , SAAB (. 19)
(. . 21.4).

. 21.4

246

21

SAAB Flight connections. .


:
1. call transaction ( )
2. leave to transaction ( )
3.
call transaction , . ,
SAAB (. 19) :
call

transaction

'SAAB'.


. , leave to transaction .
.
and skip first screen ( ) call transaction
leave to transaction .
, .
22.

RS_HDSYS_CALL_TC_VAR1ANT. R/3 Release 3.0, R/3 System.


{. . 21.5).
Create (. . 21.6),
, Save.
Screen Entries .
, . . Exit and Save

. 21.5

247

( ) , ,
, , .

. 21.6


(Update Task)
,
. Update Task

commit work. ,
.


Update Task ,
, insert delete. ( ) Update With Start Immediately (
) (. ). (. 19), :
function abap_book_insert_bookings.
i n s e r t b o o k i n g s from i _ b o o k i n g s .
u p d a t e a c t f l i from i _ a c t f l i .
endfunction.
in update task call
function:
c a l l f u n c t i o n 'ABAP_B0OK_INSERT_BOOKINGS'
in update task
exporting
i_bookinga = bookings
i_actfli
actfli.
* o t h e r s t a t e m e n t s may f o l l o w ( )
commit work.

248

21

in update task ,
. ,
. commit work ,
" " ,
, .
, (Update Order).
, , commit work.
Update Order. log-, , ,
R/3
. Update Order
Tools > Administration > Monitoring > Update.

Update Task
commit work Update
Task . .
Update Task . (
), . LUW , . ,
(Update Order).
R/3
Update Task.
Update Task, .

R/3 /, .
, Dictionary.
, .
Logical Units of Work ( ) " " R/3.
.
Object Browser.
call transaction leave to
transaction.
Update Task , .
.

22


,

-

250

22

, . . , ,
, .
,
. , ,
, . )
, , , GUI.
: GUI GUI (
).
(
) Dictionary (. 19).
, ,
. , ,
. ,
"" , .
.
: . , , , .


19 , Fullscreen
Editor. , () , , . . ,
, .

,
(Check Boxes) . , , 19, : . Object Browser
, Fullscreen Editor 200, Check
(. . 22.1) , . , .
"
" 19.
1.
: (),
, - , .
(Radio Buttons) , , .
: , (.
. 22.2). Radio
Create Fullscreen Editor, (, First , Business , Economy - ). , , .
,
, , ,
. Edit > Radio Button
Group > Define (), .
. Class ().
, , 1, .

251

. 22.1


. 22.2

Class ()

GUI
(. 19).
, Button ()
, .
() . Delete Input ( ),
.
, (. . 2S.3). .
(. Delete Input) FctCode ( ) 4 .
.

252

22

. 22.3

(Delete Input)


(table control)
. , ,
(. . 22.4 22.5). City (. 22.4)
(. . 22.5).

. 22.4

253

. 22.5



Table
Create Fullscreen Editor.
( , ).
.
Field Name. , Dictionary, Dict/ProgFields,
Yes ( Template) . Short ( KeyWord). Ctrl . , )'
C .
, Dictionary,
(. . 22.6). -

. 22.6


Customer No.,
Name City
CUSTOMERS

254

22

. .
, .
. , .
Field Attr. ( ).
(. . 22.7).

. 22.7

,
( ) (resizable). Configurable ( ), .
, , .
,
. ,
. ,
Line Markers ( ) .
, .
, , , . , customers
Cust.No. .
.


controls ( ):
c o n t r o l s c t r l _ c u s t type tableview u s i n g s c r e e n 100.
, . loop/endloop .
process befor output. :
process after
input. ,
:
process befor output.
module i n i t C t r l c u s t .

255

init_ctrl__cust all_customers
:

fill_ctrl_cust all_customers. .
exit from step-loop:

, PAI get_ctrl_cust, :




,
. modify screen loop at screen
endloop, . , :
screen-requierd
screen-input
screen-invisible
screen-length
1
0. , , :

.

:

256

22

endif.
endloop,


, ( Groups). ,
flight time ( ) free seats ( ).
Groups (, INV) ,
. screen-groupl:
module i n i t _ b o o J t i n g o u t p u t . ,
*

s u p p r e s s f i e l d s f o r f l i g h t t i m e and f r e e s e a t s
loop at screen.
if - g r o u p l = 'INV' .
s c r e e n - i n v i s i b l e = 1.
modify s c r e e n .
endif.
endloop.
INV .
,
Screen Field Attributes Groups. : screen-groupl screen-group4.



. , . .
, ,
, .


. - .
, . 22.8. Book

. 22.8

257

: Book , Book and send


. ()
, .
,
(fast path). , .
.
. .
, . , Book, a S Book and send,
.BS.

Maintain Status Fast Path.
(, Book
a Flight) .

.



,
, . , Back, Exit Cancel . GUI .

Function Type ( ).

.
, , at exit-command module:
process a f t e r i n p u t .
module e x i t _ s c r e e n a t exit-command.
, at
exit-command . ,
.


,
. GUI (, ) :
. . 22.9 ,
.

.
, .
, , , .
GUI ,
, .
.
19.

258

22

. 22.9




,
Dictionary. Dictionary
. Dictionary
, - ,
process on help-request process on value-request (.
", - ").
. ,
Big City Fort Meyers 6
6 ,
. , (Parameter ID),
, , . Parameter ID
" ".

Dictionary
, Dictionary, ( F1), ( F4) (. 19).
Foreign Key, Dictionary (. 5),
. , , .

,
-
, , process on help-request process on value-request. , Dictionary
,

259

. field. " ':


process on v a l u e - r e q u e s t .
f i e l d customers-name
module v a l u e s _ c u s t o m e r s .
:
module v a l u e s _ c u s t o m e r s i n p u t .
* D i s p l a y a l l c u s t o m e r s i n d i a l o g box
c a l l s c r e e n 110
s t a r t i n g at 20 10
ending at 50 20.
endmodule.
call screen starting at / ending at . ,
" ".


, ,
(Paravitter ID), Dictionary,
, . , CAR planfli-canid
Dictionary. , , SET
Parameter ( ) Field Attributes. GET Parameter ( ) (. . 22.10).
planfli-carrid,
Airline carrier (). (, ABC)
, .
parameter id, get parameter set parameter:
s e t p a r a m e t e r i d 'CAR' f i e l d p l a n f l i - c a r r i d .
g e t p a r a m e t e r i d 'CAR' f i e l d p l a n f l i - c a r r i d .
field.

. 22.10

SET GET

pfemfli-carrid

260

22



.
set screen leave screen. call screen
, call screen .
, write
, .


set screen leave screen
, leave screen "" .
. , call screen, .
, , call screen, starting at ending at
, ( )

call screen
call screen starting at xl yl ending at x2
xl yl , 2 2
. , *
, :
module v a l u e s _ c u s t o m e r s i n p u t .
* D i s p l a y a l l c u s t o m e r s i n a d i a l o g box
c a l l s c r e e n 110
s t a r t i n g at 20 10
ending at 50 20.
endmodule.
,
(. . 22.11). ,
, ,
( ) ,
. , , ,

. 22.11
Customers

call screen

261

.
" ".
writs,
, ,
window (. 17). ,
write . , , ,
F3 .


20 , .
, ,
. , , , , :
c a l l f u n c t i o n ' POPTJP_TO_CONFIRM_LOSS_OF_DATA'
exporting
t a i t l i n e l = 'Really quit?'
title
= ' Leave c u s t o m e r l i s t '
importing
answer
user_answer.
Leave customer list. Unsaved data will be lost (
), Really quit?. Yes
No, user_answer .

R/3. Help > R/3 Library.
Basis components >- /4 Development Workbench > Extended Applications Function Library > Standardized Dialog.


, . sy-pfkey.
, check_data (
), :
case sy-pfkey.
when 'BOOKING' .
perform check_data.
*
Perform t h e booking
when 'REQUEST'.
perform cheokjdata.
*
Perform t h e f l i g h t r e q u e s t
endcase.
check_data BOOKING REQUEST.
, .
,
.


, write, , (. V). /4

leave to list processing. suppress dialog (""
) , .
, , call
screen, :

262

22 ,

process befor output.


module init list.
process after input.
module action_list.

initjist , :
module i n i t _ l i s t o u t p u t .

Initialize titlebar and status


set titlebar c_title_list__customers.
set pf-status c_status_list.
Prepare list
suppress dialog.
leave to list-processing and return to screen 0.
endmodule.
GUI , . 22.12.
.
and return to screen 0 leave to list-processing,
. action_Jist PAI :
module a c t i o n _ l i s t i n p u t .
*

Read a l l c u s t o m e r s
select * from customers into table all_customers

* Write all customers


new-page no-title.
loop at all_customers.
write / all_customers-name.
hide all customers-id.

. 22.12
GUI
,

263

endloop.
endmodule.

hide (. 17). ,
:

. ,
leave to screen 0, :

"" ,
, , .
. modify screen loop at screen/endloop.

.
, .
.

.
GUI:
.

process on help-request process on value-request.
Parameter ID, .
Parameter ID set
parameter get parameter.
.
set screen leave screen; call screen.
starting at / ending at.
sy-pflcey GUI
GUI.
leave to list processing .
suppress dialog .
GUI .
.
. (,
).

VII

23:
24: Field Symbol
25:

23

268

23

, .. ,
, , . ,
12, . ,
, (,
, ). ,
,
. , . , .
, sort.
/4 ,
, . .
, .
.
"" , (,
) ,
.


/4 , .
, ,
11-13.

sort
.
,
. sort , . :

write:

endloop.

269

/ all_customers-id,
all_customers-name,
all_customers-city,
all_customers-telephone,

name. (. . 23.1).

. 23.1

sort

customers all_customers
case, sort
.
.
: . ,
Dictionary (, ),
.
sort, , , :
p a r a m e t e r s column(10) d e f a u l t 'NAME' .
tables customers.
data all_customers
l i k e c u s t o m e r s o c c u r s 100
with header l i n e .
s e l e c t * from customers i n t o t a b l e a l l _ c u s t o m e r s .
s o r t a l l _ c u s t o m e r s by (column) .
loop at all_customers.
write:
/ all_customers-id,
all_customers-name,
all_customers-eity,
11_ustomers-telephone.
endloop.
column ,
. sort , , .
:

10 . 65

270

23

sort
. - ,
.
sort ,
, .

read table
.
read table ,
:

name id
(. . 23.2). customers
all_customers, read table , . ( , sort) .


( ), at / endat. ,
"" at new name endat , all_customer-name
. , , at. , 12,
:

271

. 23.2

read table

actfli myjflights, carrid, connid fldate.


. - , at line-selection,
( get cursor shift, column). , .

. .

272

23

Open SQL
11 13, Open SQL (select, insert, update, modify delete)
, select :

. select count ( * ) . ,
, , ,
.
select ,
where. where_tab
, where:

where.
,
.
where_tab select,
customers:

,
1 999, S . ,
where:

where , ,
where . ,
, where
.
,
/4 where select.
where . where (. 16).


,
, (
) .
perform :
report chap2307.

273

perform, chap2308 :

chap23G8 (
) , extform ( ) . perform , ..
. , , ,
.
,
. ,
.
extform chap2310.
(sy-cprog) :

perform :

chap2309 extform chap2310,


call_backjbrm chap2309. . 23.3.

. 23.3

274

23

,
. , ,
. display_buuon, , perform, display_button.

sort.
read table.
at new / endat .
Open SQL (select, insert, update, modify delete)
.
select where.
, ,
in program perform.
, ,
.
Field Symbol,
(assign), , .

24

FieldSymbol
Field Symbol
assign

276

24

, , . , , ,
. , , ,
.
.
,
, . :
0005Smith0007Edwards0005Young0006Edison.
(,
5 Smith) .
. , (pointer), (.. ).
/4 Field Symbol assign
, . Field
Symbol .
, , .
assign Field Symbol ,
. , , .
Reid Symbol, , , , .
, Field Symbol.
.

Field Symbol
Field Symbol field-symbols, ,
.
:
field-symbols <fs>.
, "" .
Field Symbol, assign ().

assign
assign ( ) Field Symbol:
field-symbols <fs>.
data f i e l d value 'X'.
assign f i e l d to <fs>.
Field Symbol ,
. , Field
Symbol , write:
write <fs>.
, , : , , .
, :

Field Symbol

277

, external_record , ..
: 0005Smith0007Edwards0005Youngp006Edison.
26.
do . 0,
. position 4 , . , ,
Field Symbol <entry> .
. , .
, assign,
Field Symbol. .
, /4,
(. 7).
,
Field Symbol. .

Field Symbol

, . " ",
. component of structure assign :

customers. assign
component ( ) <output>.
sy-index . <output>, , .

278

24


Field Symbol . ,
"" ,
( ). , ,
:
tables customers.
s e l e c t * from c u s t o m e r s .
perform d i s p l a y u s i n g c u s t o m e r s .
endselec t .
form display using fl like bookings.
write f1-customid.
endform.
customers bookings,
, , , (. . 24.1).

. 24.1

, Field Symbol:
tables customers.
f i e l d - s y m b o l s <customers>.
a s s i g n c u s t o m e r s t o <customers>.
s e l e c t * from c u s t o m e r s .
perform d i s p l a y u s i n g <customers>.
endselect.
form display using f1 like bookings.
write f1-customid.
endform.
, . ,
. ,
, . 24.2.

Field Symbol

279

. 24.2

. 24.3
,

. , , (. . 24.3).
Field Symbol . . , perform ( , . 24.1) ,
:
tables customers.
f i e l d - s y m b o l s < c u s t o m e r s > l i k e customers.
a s s i g n customers t o <customers>.

280

24

, Field Symbol npi


, , ,
, . ,
. ?
Field Symbc
,
.

Field Symbol field-symbols.


Field Symbol assign.
Field Symbol
.

/4 .

25

282

25

/4 . , , 23. Field Symbol (. 24) ,


, /4.
: , ,
,
. /4
, ..
. ,
, . , /4 Repository, ,
, , .


, ,
. generate subroutine pool. , , , perform.
" "
1.
, , write, source_table:

source_table report
display write. :
g e n e r a t e s u b r o u t i n e p o o l s o u r c e _ t a b l e name program name.
, source_table,
program_name.
. . perform :
perform d i s p l a y in program (program_name) .
display , program_name.
perform
23.
, name generate subroutine pool perform,
.
, , ,
, .


. . generate subroutine
pool. , , ,

283

, , ,
perform.
sy-subrc generate subroutine pool. , Syntax Check
, . :

generate subroutine pool , endform . syntax_check_message, _. 4


: "The last statement is not complete (period missing)."
(" ( ).".


24 , , , customers. , ,
. , .
:


tabname. build_the_source_code ,
display_table. generate subroutine pool
display_table perform ,
.
:

284

25

, ,
f_name. source_table , append f_name .


insert report,
:

zgenprog : report, write. insert report


Repository /4. zgenprog, submit and return ( ):
submit zgenprog and r e t u r n .
a Repository , read report. :

zgenprog Repository
source_table. read report ,
Repository .

285

,
, insert report
"" ( ).
,
perform, , insert report, ( perform ). ,
, Repository .

generate subroutine pool.


,
insert report.
read report.
/4 .

. 65

VIII

26.
27.
28. OLE

26

290

26

, , .
R/3 . . .
. V *
() .
, ,
.
. , , ( ). , ,
, .
/4 . , ,
- . . .
.
- , - . ,
CD-ROM.
. , . /4
.
(Remote Function Call, RFC). R/ , .
, RFC R/2, , . RFC OLE (Object Linking and.
Embedding) Automation, OLE Automation ,
/4. ,
, , R/3.
RFC OLE Automation 27 28.


,
, .
, . :
1.
2.
3.
. ,
/4 ,
customers all_customers, .
. ;

291


, , open dataset,
:

. filename, lower case ( ), .


, open dataset . (
) .
16 ,
open dataset for appending.
.
for output open dataset ,
/4 (). for input ( /4 ). open dataset in text mode ( ) ,
. in binary mode ( ).
,
/. , .
R/3
. ,
. , , open
dataset, R/3.
, ,
. , sy-subrc. msg_text,
message. .


, transfer:

, all_customers, , filename.
transfer
. ,
.
, .
. , :

292

26

customers . ,
, .
, " ".
. , length transfer, :

strlen.
, .


,

close:
c l o s e dataset filename.
, transfer read dataset
( ) .


.
read dataset. :

, open dataset
for input. sy_subrc, , .
read dataset . , , ( ) .

293

, . .
" " . ( ):

all_customers
read dataset.
, , , Dictionary Include (),
.

R/3
/4, R/3.
R/3 ( )
, ,
. .
R/3 .
/4 , transfer read dataset .
,
/4:
WS_DOWNLOAD

WS_UPLOAD
, .
:

294

26

.
customers so all_customers , .
WS_DOWNLOAD,
, all_customers. ,
. (file_open_error), , others. , WSJDOWNLOAD
.
, ,
:

WS_UPLOAD all_customers
.

295

open dataset.
, .
transfer.
close dataset .
read dataset. .
,
ABAP/4 Development
Workbench.
,
.

27

298

27

Remote Function
Call (RFC),
/4. RFC ,
. RFC (Remote Procedure Call, RPC), .
RFC , , .
, ,
. RFC
: ( ) (
, ).


. ,
, : "", - , ,
, : " ". ""
. . , -, , -, ,
, , , , . , , .
, ,
, . , , .
, .. - , , , .
.
, ,
, TCP/IP, Internet. , , . ,
CPI-C, - IBM .
/4; .
, , .
RFC /4 /4,
.


, .
.
. ,
destination ( ).
,
. , , ,
- . :

299

destination , , FLORIDA. from_date to_date , .


agency local_bookings.

RFC
(. ) .
-, , FLORIDA destination.
- R/3, , R/2, R/S , , .
rfcdes. ,
FLORIDA.
rfcdes " ".
-
, , . GET_LOCAL_BOOKINGS,
. GET_LOCAL_BOOKINGS
(remotely callable),
/4 Development Workbench , (stub), . stub
.
.
,
(.. ).
.
.
, .
. , , , ,
,
. .


, ,
. , VI, .
, .
R/3
..
,
, , BACK.
, , .
, . ,
,
.
, NONE.

300

27

,
.
RFC , .
: /4 .


Function Administration ( ) Utilities () > RFC Interface (
RFC) ^ RFC Target Machine ( RFC).
RFC (. 27.1).

. 27.1

RFC

RFC (connection type): R/2, R/S


. Create,
. , (. 27.2).
RFC destination
(, , -).
Load ln ( ),
R/3 . , ,
.
. ,
. Save.
,
Test. ,
- . , , Remote logon ( ), .
.


, . ,
, .
, .

301

. 27.2

FLORIDA

(exceptions). , communication_failure , . message ,


, .
systemjailure, message,
. , ,
, system_failure , message.
:

parameters: date_l type d,


date_2 type d.
data:
l_agency(20),
sys_msg (80),
comm_msg like sys_msg,
l_bookings like bookings occurs 50 with header
line.
c a l l function
'GET_LOCAL_BOOKINGS'
destination 'FLORIDA'
exporting
from_date = date_1
to_date
=
date_2
importing
agency
=
l_agency
tables
local_bookings = l_bookings
exceptions
syatem_failure = 1 message sys_msg
communication_fallure = 2 message comm_msg.
case sy-subrc.
when 1.
write: / ' system error', sys_msg.
exit.

302

27

/4 Debugger ,
, , ,
.


,
. , .
(
, ) . ,
starting new task call function, :

from_date to_date, bookings. ,


, , . GET_LOGAL_BOOKINGS
COLLECT_BOOKINGS.
, ,
. , 8 ,
. ,

. .
, ,
, . performing on end of task "" :

ANSWER , . performing on end of task,


,
ANSWER.
:

303

,
ANSWER. receive
. receive
results from function .

(Remote Function Call, RFC)


, R/3, R/2 .
(RFC) .
RFC , .
, .
OLE- /4
, .

28

OLE
OLE /4

306

28

OLE (Object Linking and Embedding), Microsoft,


. - OLE
, , , .

OLE
/4
OLE /4 (Open Object Interface), R/3.
OLE RFC. /4 R/3
OLE, - OLE.
Open Object Interface, OLE. , CORBA, R/3.


OLE-, R/3,
/4
Development Workbench: Development () > Programming Environment ( ) > OLE2 > OLE2 Setup ( OLE).
R/3 OLE-; .
OLE- R/8
: Development > Programming Environment > OLE2 > OLE2 Typeinfo (
OLE). , OLE .
:
Development > Programming Environment > OLE2 > OLE2 Object Browser. /4 , create:

create , application ole2_object, . Excel, excel.application.


. ,
, language (
). ,
sy-msgli.


, . ,
create, :

set property Excel,


Excel.
no flush get,

OLE

307

OLE ( OLE
OLE- ).
get property, :
data v i s i b l e type i .
get property of a p p l i c a t i o n ' V i s i b l e ' * v i s i b l e .
visible , .


. OLE . Excel
. Excel , )'
:
data workbook type o l e 2 _ o b j e e t .
c a l l method of a p p l i c a t i o n 'Workbooks'= workbook.
c a l l method of workbook 'Add' .
application. method workbook.
Excel .
.
, exporting. (
), :
data s h e e t type o l e 2 _ o b j e c t ,
c a l l method of
a p p l i c a t i o n 'Worksheets' s h e e t
exporting #1 1.
c a l l method o f s h e e t ' A c t i v a t e ' .
( ) . , OLE.
customers filljsheet.
. 28.1. :
program e x c e l .
include o l e 2 i n c l .

. 28.1
Excel,

/4

308

28


OLE ,
free , OLE:
free o b j e c t a p p l i c a t i o n .
OLE
.

OLE

309

* OLE , P/4.
* create object.
* set property get property.
* call method.
* free object.
: R/3, Query tool /4
Development Workbench. , Development Workbench, .
,
, /4.
Development Workbench. ,
Dictionary . : . , Dictionary, /4
Data Modeler, .
,
. -, , , .
, . Open SQL, /4, " "
, /4.
, (Logical Databases) .
. , , , ,
. , . , /4
-
(Remote Function Call) OLE-.
. , ,
/4 R/3. !


. R/3
. /4 Query
. /4
Development Workbench
D.
.

314

R/ , P/4
. P/4 , ,
(. ).

. .1

R/3

R/3 SAP


R/3 Basis :
GUI ( )
/4


/4 Development Workbench







R/3, , /. R/3 :
, -
,
GUI
(. .2).

R/3

315

. .2

R/3

R/S ""
(. A.3) .

. .
R/3


/ ,
R/ (
) (
). R/3 ,
. R/ . /,
. R/ , . ,
.
/4 Development Workbench R/3 Basis, , - SAP.
, , Development Workbench, , .. .


/4 Query

318

/4 Query
. , , . , R/3.
/4 Query , , . , , Logical Databases,
. /4 Query .
. , /4 Query . ,
, , .
. ( ) ,
R/3, , .

Logical Databases
/4 Query
Logical Databases , R / 3 .
Logical Databases . 15.
/4 Query
Logical Database. Logical Database, R/3,
. /4 Query , Logical Database, -. , ,
. /4 Query ,
Logical Database, .

/4

(. 15-17) , :




/4 Query . , . , /4
Query , . :
/4 Development Workbench, , .
. 18.

/4 Query

319

/4 Query
/4 Query
(Functional Areas).
. -, . , , , . -,
, .
Logical
Database, .. . , Logical Database.

.
. Logical Database ,
. , .
, , /4 Query
.
/4 Query (User
Groups), . , .
, . ,
/4 Query, .

/4 Query
.
:



,
. , . (, ).
( ,
).
, . , ,
.



. .
. , .
, , . .
.
: , . , . , :

320



,
(, , , , , , ..)

, ,
.


,
. ,
. , Logical Database . , (Carrier ID)
(Flight number), (. .2).

. .1

/4 Query

321

. .2

. .

. B.3.
/4 Query . , , , ,
(, .4).

322

. .4

. .5
,

. .5.
:
, .


/4 Development
Workbench

324

Workbench, . , , .
Workbench (, ) 3.


Workbench ( select call
function) (, where
select) , ,
. Edit > Insert Statement
Editor. (. .1).

. .1

select,
, where. select (. .2).
call function, write
Dictionary .


Include
(Include File). Include File , , .. (, abapincl) .
( 1, . 15 18) , (
, . 19 22), Include File ,
.
Include File Object Browser I. include,

/4 Development Workbench

325

. .2

select

(, abapincl).
. , Include ,
Create Object Browser Include.


, /4 Development Workbench
. /4 Editor
Program > Check () > Extended Prog.Check ( ).
,
. ,
,
.
Syntax Check, , , .
,
.


, ( )
, , . ,
.
/4 .
:

( )

326

,
( ). Editor
:
Utilities > Breakpoints ( ) > Set (). ,
(. .).

. .


( ). ,
cable . ,
. : Goto > Active Call Stack ( ).
, Single Step
( ). Execute , . , , Continue
( , ).
,
. : Breakpoint ( ) >
Breakpoint At ( ).




( , ).
( Editor). , ,
data . , , ,
.
( Include).
Include, -

/4 Development Workbench

327

. , ( form/endform) .
,
(, ),
. " " (Rapid Prototyping),
, , ,
. (,
Dictionary) Create Object Browser /4 Development
Workbench.
" " .
, .
, (, data ). (Use List) (. ).

(Use List)
Where-Used List,
/4 Development Workbench, Use List (,
Dictionary). , Dictionary,
,
R/3. Use List
( , /4,
Dictionary, ).
, Use List serptree , . ,
(. .4).

. .4
Use List
serptree

- Use List,
, .

328


Object Browser (), . Object Browser
(. .5).

. .5

.
Dictionary: , (. 5)
: , (. 4)
: , , (. 9)
PAI: , ,
(. 19)
: (. 10)
: (. 19 22)
GUI : , (. 19)
: , (. 21)
Include: , (.
" " )

.

(. .6).
, , , Program Object Types (
) (. .6) (. Include) .

/4 Development Workbench

329

. .6

,



Edit > Documentation > Display/Change Object Browser. (, ).
:
Description ():
Precondition ( ):

Output ():
Example ():
(, ) , : Help > Extended Help.


:
.
, , ,
.
/4 Development Workbench: Test > Runtime Analysis (
). , , . ,
. , R/3. , Absolute <-> %, ,
, ( ).
-

330

,
.
Workbench : Test > SQL Trace ( SQL),
, .
, , ,
, ,
.
, , Test Development Workbench.

332

P/4 Development Workbench


, , . Workbench Organizer
R/3, , , ,
.
(, -
R/3, Dictionary),
local (), .
.
, ,
(, Dictionary), ..
.
, ,
( ).
Task (), , ,
(Change Bequest), , .
, - ,
, . ,
R/3, ABC.
001234, ,
00125 ( Development Workbench
). , , .


.
(, Dictionary) ,
R/3,
( ), .
Object Browser, , . Object Browser
Display (. D.1). SLDB . D.2.
. (,
ZTST) R/3 ( - integration system),
{, ABC).
, (consolidation system). (, XYZ).
integration consolidation,
Development Class ( ),
. D.2. , . D.3 SLDB.
(, ),
(, ), , (. D.4).
,
.

333

. D.1

Object Browser,

SLDB

. D.2
,

SLDB

Object Browser
. Object Browser Development Class
. Display . Yes.
. , Save. R/3 , , ,
Y Z, R/3 /4
. ,
( Y Z) ,
R/3, .

334

. D.3

integration consolidation
SLDB

. D.4

(Tasks)
(Change Requests)
, ,
(Tasks). ,
(Change Request). ,
. (, Dictionary ..), .
. ,
( ) , . ,

335


(, ).
, ,
. . ,
. , , .


Workbench Organizer.
Object Browser, :
Environment > Workbench Organizer. Workbench Organizer
(. D.5) Display .
, .

. D.5

Workbench Organizer

,
. Request For User ( ) (. D.6).

. . Workbench Organizer: Requests
(Task) Release () (Application).
, .
Workbench Organizer Requests (Change Request)
Release Application.
. ,
, ,
(..
).

, . Workbench Organizer
.
Workbench : Goto > Logs ( ) > Transport Log
( ). .
, .
Workbench Organizer .

336

. D.6

Workbench Organizer
Requests,
Change Requests


/4

338

/4

sy-datum
sy-uzeit
sy-tzone
sy-dayst
sy-mandt
sy-uname
sy-iangu
sy-sysid
sy-saprl
sy-dbsys
sy-opsys
sy-tcode
sy-cprog
sy-repid
sy-subrc
sy-index
sy-tabix
sy-fdpos
sy-dbcnt
sy-batch
sy-dynnr
sy-dyngr
sy-pfkey
sy-msgid
sy-msgty
sy-msgno
sy-msgvl
sy-msgv2
sy-msgv3
sy-msgv4
sy-uline
sy-vline
sy-pagno
sy-colno
sy-Hnno
sy-linct
sy-cucol
sy-curow
sy-lsind
sy-winco
sy-winro
sy-tvarO
sy-tvarl
sy-tvar2
sy-tvarS

SAP
R/S
R/3













GUI

(, I, W...)









()
()






/4

sy-tvar4
sy-tvar5
sy-var6
sy-tvar7
sy-tvar8

339

sy-tvar9

, Help
sy (Editor).


add
append
assign
at line-selection
at new
at selection
screen
call function
call method
call screen
call transaction
case/endcase
clear
close dataset
commit work
compute
concatenate
constants
controls
create object
data
delete
do/enddo
else
exit
export
field-symbols
form/endform
format
generate
subroutine pool
get
get property
hide
if/endif
import
include
insert
leave
loop/endloop
message



field-symbols
,

,
(, )




case









, if/endif


Field-symbols
"",




, ( )
if/endif





modify
module/
end module
move
new-line

new-page
open dataset
parameters
perform
program
raise
read dataset
read table

receive
refresh

replace

report
rollback work
search

select

select-options
set pfstatus
set property


(GUI)

set screen

shift

sort
split
start-of-selection ,

statics
submit
tables

top-of-page
transfer

translate
type-pools
types

update

while/endwhile
window

write

Оценить