interactive - chapter 04 v1
TRANSCRIPT
-
7/30/2019 Interactive - Chapter 04 V1
1/15
IBM Global Services
Copyright IBM Corporation 20031.3.4 |Slide 1
ABAP is an Event-Driven Language
Starts at the
beginningof the code
Completes
at the end
of the code
event-driven Language
The events can execute
in any order. Some may
never even execute at all.
1st
3rd
2nd
VSProcedural Language
Event z
Event y
Event x
Event w
-
7/30/2019 Interactive - Chapter 04 V1
2/15
IBM Global Services
Copyright IBM Corporation 20031.3.4 |Slide 2
List Display EventAT PF##
Triggered by function code:
PF##
-
7/30/2019 Interactive - Chapter 04 V1
3/15
IBM Global Services
Copyright IBM Corporation 20031.3.4 |Slide 3
REPORT Y190XX01.
TABLES: LFA1.
START-OF-SELECTION.
SELECT * FROM LFA1.
WRITE: / LFA1-LIFNR, LFA1-NAME1, LFA1-ORT01.
ENDSELECT.
AT PF06.
WRITE: / The user has just pressed the F6 key.
SYNTAX: AT PF.
PF## Coding Example
A New
ABAP
Event
.
SELECT
* SY-SUBRC
CHECK
-
7/30/2019 Interactive - Chapter 04 V1
4/15
IBM Global Services
Copyright IBM Corporation 20031.3.4 |Slide 4
F1 Reserved for the Help function
F2 The user will press the F2 key to
select a specific line of interest
in your report.
F3 The user will press the F3 key togo back one screen in your report.
Just as a test, place your mouse
on the green back arrow on the ABAP
Editor toolbar. What
does the little yellow flag say?
F4 The user will press the F4 key to see
possible values that can be enteredinto a field.
F10 The user will press the F10 key
to switch into menu select mode.
Try it. Go to the ABAP Editor and
press F10.
F12 The user will press the F12 key to
quit. Its the same as clicking on the
red X that is located on the ABAP
Editor toolbar.
F15 (Shift + F3) The user will press theF15 key to End. Its the same as
clicking on the yellow up arrow that is
located on the ABAP Editor toolbar.
F21 (Shift + F9) The user will press the
F21 key to scroll to the beginning.
F22 (Shift + F10) The user will press the
F22 key to scroll back one page.F23 (Shift + F11) The user will press the
F23 key to scroll forward one page.
F24 (Shift + F12) The user will press the
F24 key to scroll to the end.
Function Keys Reserved by ABAP
-
7/30/2019 Interactive - Chapter 04 V1
5/15
IBM Global Services
Copyright IBM Corporation 20031.3.4 |Slide 5
Coding ExampleAT PF## with Multiple Events
.
.
REPORT Y190XX01.
TABLES: LFA1.
START-OF-SELECTION.
SELECT * FROM LFA1.
WRITE: / LFA1-LIFNR, LFA1-NAME1, LFA1-ORT01.
ENDSELECT.
AT PF06.WRITE: / The user just pressed the F6 key.
AT PF07.
WRITE: / The user just pressed the F7 key.
When the user pressesthe F6 key only the
code between the twoarrows will execute.
-
7/30/2019 Interactive - Chapter 04 V1
6/15
IBM Global Services
Copyright IBM Corporation 20031.3.4 |Slide 6
*--BEGIN OF AT PF06 EVENT MODULE.-----------------------------------------
AT PF06.
WRITE: / The user just pressed the F6 key.
*--END OF AT PF06 EVENT MODULE.--------------------------------------------
*--BEGIN OF AT PF07 EVENT MODULE.-----------------------------------------
AT PF07.
WRITE: / The user just pressed the F7 key.
*--END OF AT PF07 EVENT MODULE.--------------------------------------------
Commenting Events in ABAP
Commenting in this manner helps to make the start and
end of an event more apparent.
-
7/30/2019 Interactive - Chapter 04 V1
7/15
IBM Global Services
Copyright IBM Corporation 20031.3.4 |Slide 7
Coding ExampleOpening a Window
SYNTAX: WINDOW STARTING AT ENDING AT .
.
.
REPORT Y190XX01.
TABLES: LFA1.
START-OF-SELECTION.
SELECT * FROM LFA1.
WRITE: / LFA1-LIFNR, LFA1-NAME1, LFA1-ORT01.ENDSELECT.
AT PF06.
WINDOW STARTING AT 10 4
ENDING AT 77 12.
WRITE: / The user just pressed the F6 key.
AT PF07.
WRITE: / The user just pressed the F7 key.
A New
ABAP
Reserved
WordSELECT *
SY-SUBRC
CHECK
-
7/30/2019 Interactive - Chapter 04 V1
8/15
IBM Global Services
Copyright IBM Corporation 20031.3.4 |Slide 8
TITLE
COLUMN 10 COLUMN 77
TITLEROW 4
ROW 12
SYNTAX: WINDOW STARTING AT ENDING AT .
WINDOW STARTING AT ENDING AT...
-
7/30/2019 Interactive - Chapter 04 V1
9/15
IBM Global Services
Copyright IBM Corporation 20031.3.4 |Slide 9
Potential Problems with
Creating Additional Screens
1.
2.
3.
Hey!?!
Whatsup here???
-
7/30/2019 Interactive - Chapter 04 V1
10/15
IBM Global Services
Copyright IBM Corporation 20031.3.4 |Slide 10
The SY-LSIND System Field
Basic List
SY-LSIND = 0
1st Detail List
SY-LSIND = 1
2nd Detail List
SY-LSIND = 2
A New
ABAP
System FieldSYSTEM FIELD: SY-LSIND
F6 F6
-
7/30/2019 Interactive - Chapter 04 V1
11/15
IBM Global Services
Copyright IBM Corporation 20031.3.4 |Slide 11
AT PF06.
CHECK SY-LSIND = 1.
WINDOW STARTING AT 10 4
ENDING AT 77 12.
WRITE: / SY-LSIND =, SY-LSIND.
WRITE: / The user just pressed the F6 key.
AT PF07.
WRITE: / The user just pressed the F7 key.
Coding ExampleSY-LSIND System Field
Check that SY-LSIND is equal
to 1.
If SY-LSIND is not equal to one,
then the rest of the AT PF06
event block does not execute.
-
7/30/2019 Interactive - Chapter 04 V1
12/15
IBM Global Services
Copyright IBM Corporation 20031.3.4 |Slide 12
Here SY-LSIND is equal to 0.The user attempts to createanother list.
The user attempts to create another list,
but cannot because CHECK SY-LSIND = 1
returns false. The contents of the initial
list remain unchanged.
Now SY-LSIND is equal to 1.
Strategies for Dealing with Detail Lists using the SY-
LSIND System Field
-
7/30/2019 Interactive - Chapter 04 V1
13/15
IBM Global Services
Copyright IBM Corporation 20031.3.4 |Slide 13
Here SY-LSIND is equal to 0. The
user attempts to create another list.
Now SY-LSIND is equal to 1.
The user creates another list and the
contents of the previous list are replaced.
Strategies for Dealing With Detail Lists using the SY-
LSIND System Field
-
7/30/2019 Interactive - Chapter 04 V1
14/15
IBM Global Services
Copyright IBM Corporation 20031.3.4 |Slide 14
A NewABAP
Event
SYNTAX: TOP-OF-PAGE.
Prior to the TOP-OF-PAGE
event, column headings
were managed via text
elements. The TOP-OF-
PAGE event allows you to
manage your column
headings through code.
START-OF-SELECTION.
SELECT * FROM LFA1.
WRITE: / LFA1-LIFNR, LFA1-NAME1,
LFA1-ORT01.ENDSELECT.
*-----BEGINNING OF TOP-OF-PAGE EVENT -----*
TOP-OF-PAGE.
WRITE: / This is the header of the basic list.
*-----END OF TOP-OF-PAGE EVENT-----------------*
AT PF06.
CHECK SY-LSIND = 1.
WRITE: / The user just pressed the F6 key.
SELECT *SY-SUBRC
CHECK
Programmatically Managing
Column Headings for Your Report
-
7/30/2019 Interactive - Chapter 04 V1
15/15
IBM Global Services
Copyright IBM Corporation 20031.3.4 |Slide 15
*-------------------BEGINNING OF TOP-OF
TOP-OF-PAGE.
WRITE: / This is the header of the basic list.
*-------------------END OF TOP-OF-PAGE
* ----BEG. OF TOP-OF-PAGE DURING LINE-SELECTION EVENT--------*
TOP-OF-PAGE DURING LINE-SELECTION.
WRITE: / This is the header of the detail list.
*------END OF TOP-OF-PAGE DURING LINE-SELECTION EVENT--------*
*------------------- BEGINNING OF AT PF06 EVENT-------------------------------*
AT PF06.
CHECK SY-LSIND = 1.
WRITE: / The user just pressed the F6 key.
Coding ExampleProgrammatically Managing the Column Headings for Your Drill-Down
Windows
The TOP-OF-PAGE DURING
LINE-SELECTION event allows
you to manage the column
headings of the detail lists
through code.
SYNTAX: TOP-OF-PAGE DURING LINE-SELECTION.
A New
ABAP
Event