Post on 24-Dec-2015
description
IBM Global Business Services
© IBM Corporation 2013The AT LINE-SELECTION Event (SY-LISEL vs. HIDE) |
Dec-2008
The AT LINE-SELECTION Event (SY-LISEL vs. HIDE)
IBM Global Business Services
© IBM Corporation 20132 Dec-2008The AT LINE-SELECTION Event (SY-LISEL vs. HIDE) |
Objectives
The participants will be able to : Create drill-down screen.
Use AT LINE-SELECTION Event.
Apply SY-LISEL system field.
Apply the HIDE statement.
Interpret the HIDE memory.
IBM Global Business Services
© IBM Corporation 20133 Dec-2008The AT LINE-SELECTION Event (SY-LISEL vs. HIDE) |
A “Drill Down” Screen
First the user double-clicks on a record.
Then a “drill down” list is created showing data relevant to the record
initially selected by the user.
IBM Global Business Services
© IBM Corporation 20134 Dec-2008The AT LINE-SELECTION Event (SY-LISEL vs. HIDE) |
The Challenges
Second Challenge:
How is this record sent back as criteria to an ABAP SELECT statement?
First Challenge:
How did the ABAP code “know” when and which record the user has selected?
SELECT * FROM BSIK WHERE LIFNR = <selected vendor number>.
IBM Global Business Services
© IBM Corporation 20135 Dec-2008The AT LINE-SELECTION Event (SY-LISEL vs. HIDE) |
Illustration : (The AT LINE-SELECTION Event)
A New ABAPEvent
SYNTAX: AT LINE-SELECTION.
Determining When the User Is Requesting Additional Information
When the user double-clicks a line in the report, the “AT LINE-SELECTION” event occurs
(because the PICK function code is invoked).
IBM Global Business Services
© IBM Corporation 20136 Dec-2008The AT LINE-SELECTION Event (SY-LISEL vs. HIDE) |
The SY-LISEL System Field
A New ABAP
System Field
The Contents of SY-LISEL:
222 Express Vendor Inc CHICAGO
SYSTEM FIELD: SY-LISEL
When the user selects a line in the report, SY-LISEL is updated with the text from
that line.
Determining Which Records the User Is Requesting Additional Information Upon
IBM Global Business Services
© IBM Corporation 20137 Dec-2008The AT LINE-SELECTION Event (SY-LISEL vs. HIDE) |
DATA:WA_LFA1 TYPE LFA1.START-OF-SELECTION.
SELECT * FROM LFA1 INTO WA_LFA1.WRITE: / WA_LFA1-LIFNR, WA_LFA1-NAME1, WA_LFA1-ORT01.
ENDSELECT.
SELECT *
SY-SUBRCCHECK
Coding Example : AT LINE-SELECTION and SY-LISEL
This code is continued on the next page.
IBM Global Business Services
© IBM Corporation 20138 Dec-2008The AT LINE-SELECTION Event (SY-LISEL vs. HIDE) |
*--------begin of AT LINE-SELECTION event------------------------*
AT LINE-SELECTION.CHECK SY-LSIND = 1.WINDOW STARTING AT 10 4 ENDING AT 77 12.WRITE: / ‘The user double-clicked on a line in the report’.WRITE: / SY-LISEL.
*---------end of AT LINE-SELECTION event--------------------------*
Coding Example : AT LINE-SELECTION and SY-LISEL
IBM Global Business Services
© IBM Corporation 20139 Dec-2008The AT LINE-SELECTION Event (SY-LISEL vs. HIDE) |
AT LINE-SELECTION and SY-LISEL
First double-click on a record.
Then a second “drill down” list is created showing data relevant to the
record you had initially selected.
If you double-click here, will another drill window appear? Why
or why not?
IBM Global Business Services
© IBM Corporation 201310 Dec-2008The AT LINE-SELECTION Event (SY-LISEL vs. HIDE) |
Limitations of the SY-LISEL System Field
The contents of SY-LISEL:
“100141 A B Anders Heidelberg”
We can’t send an entire string to an ABAP SELECT statement.
SELECT * FROM BSIK WHERE LIFNR = 100141
However, if we could somehow send only individual fields from the selected record, we would then process that data with an ABAP
SELECT statement.100141
IBM Global Business Services
© IBM Corporation 201311 Dec-2008The AT LINE-SELECTION Event (SY-LISEL vs. HIDE) |
Demonstration
Use of AT LINE-SELECTION event and SY-LISEL system field.
IBM Global Business Services
© IBM Corporation 201312 Dec-2008The AT LINE-SELECTION Event (SY-LISEL vs. HIDE) |
Practice
Use of AT LINE-SELECTION event and SY-LISEL system field.
IBM Global Business Services
© IBM Corporation 201313 Dec-2008The AT LINE-SELECTION Event (SY-LISEL vs. HIDE) |
The HIDE ABAP Reserved Word
SYNTAX: HIDE <program field>.SYNTAX: HIDE <program field>.
START-OF-SELECTION.SELECT * FROM LFA1 INTO WA_LFA1.
WRITE: / WA_LFA1-LIFNR, WA_LFA1-NAME1, WA_LFA1-ORT01.HIDE: WA_LFA1-LIFNR.
ENDSELECT.
A New ABAP
ReservedWord
Extracting Individual Fields from the Record Chosen by the User
SELECT *
SY-SUBRCCHECK
IBM Global Business Services
© IBM Corporation 201314 Dec-2008The AT LINE-SELECTION Event (SY-LISEL vs. HIDE) |
LFA1 WORK AREA
RECORD # 2WRITE: /WRITE: / HIDE
LIST MEMORY
START-OF-SELECTION.SELECT * FROM LFA1 INTO WA_LFA1.
WRITE: / WA_LFA1-LIFNR, WA_LFA1-NAME1, WA_LFA1-ORT01.HIDE: WA_LFA1-LIFNR.
ENDSELECT.
SELECT *
SY-SUBRCCHECK
The HIDE Memory Area
IBM Global Business Services
© IBM Corporation 201315 Dec-2008The AT LINE-SELECTION Event (SY-LISEL vs. HIDE) |
START-OF-SELECTION.SELECT * FROM LFA1 INTO WA_LFA1.
WRITE: / WA_LFA1-LIFNR, . . . HIDE: WA_LFA1-LIFNR.
ENDSELECT.
MEMORY
WA_LFA1-LIFNR ---- ----VEND011VEND012VEND013
INDEX12345
This is what the HIDE memory area and work area WA_LFA1 look like after the SELECT statement above has finished
processing.
LFA1 WORK AREA
RECORD # 3
SELECT *
SY-SUBRCCHECK
The HIDE Memory Area : (Showing the Index)
IBM Global Business Services
© IBM Corporation 201316 Dec-2008The AT LINE-SELECTION Event (SY-LISEL vs. HIDE) |
START-OF-SELECTION.SELECT * FROM LFA1 INTO WA_LFA1.
WRITE: / WA_LFA1-LIFNR, WA_LFA1-NAME1, WA_LFA1-ORT01. HIDE: WA_LFA1-LIFNR, WA_LFA1-TELF1.
ENDSELECT.
HIDE MEMORY
WA_LFA1-LIFNR ---- ----VEND011VEND012VEND013
INDEX12345
WA_LFA1-TELF1 ---- ----555-1111555-2222555-3333
If we used the HIDE statement to hide both LIFNR and TELF1, our
HIDE memory area would look like this.
SELECT *
SY-SUBRCCHECK
The HIDE Memory Area : (with More than One Field Stored)
IBM Global Business Services
© IBM Corporation 201317 Dec-2008The AT LINE-SELECTION Event (SY-LISEL vs. HIDE) |
The HIDE Index Numbers
VEND012VEND012
INDEX1234
MEMORY
WORK AREA WORK AREA WA_LFA1WA_LFA1
LINE 4 from the screen corresponds LINE 4 from the screen corresponds with INDEX 4 from the HIDE memory area.with INDEX 4 from the HIDE memory area.
The Correlation between the HIDE Memory Area and Line NumbersThe Correlation between the HIDE Memory Area and Line Numbers
WA_LFA1-LIFNR ---- ----VEND011VEND012VEND013
INDEX12345
IBM Global Business Services
© IBM Corporation 201318 Dec-2008The AT LINE-SELECTION Event (SY-LISEL vs. HIDE) |
REPORT Y190XX02.DATA: WA_LFA1 TYPE LFA1 , WA_BSIK TYPE BSIK.
START-OF-SELECTION.SELECT * FROM LFA1 INTO WA_LFA1.
WRITE: / WA_LFA1-LIFNR, WA_LFA1-NAME1, WA_LFA1-ORT01.HIDE: WA_LFA1-LIFNR, WA_LFA1-TELF1.
ENDSELECT.
SELECT * SY-SUBRCCHECK
Coding Example : Using the HIDE ABAP Reserved Word
IBM Global Business Services
© IBM Corporation 201319 Dec-2008The AT LINE-SELECTION Event (SY-LISEL vs. HIDE) |
What Happens When the System Hides Values?
DATASOURCE
field string
TABLE WORK AREA
HIDE MEMORYWA_LFA1-LIFNR ---- ----VEND011VEND012VEND013
INDEX12345
BASIC LIST
1 (header)2 (uline)3 VEND011 Star Craft Metal4 VEND012 Quality Fabr.5 VEND013 Euro Output SA
WA_LFA1-TELF1 ---- ----555-1111555-2222555-3333
SELECT
WRITE
HIDE
IBM Global Business Services
© IBM Corporation 201320 Dec-2008The AT LINE-SELECTION Event (SY-LISEL vs. HIDE) |
What Happens When the User Selects a Valid Line?
data available for further processing
TABLE WORK AREA(Field String)
HIDE MEMORYWA_LFA1-LIFNR ---- ----VEND011VEND012VEND013
INDEX12345
BASIC LIST
WA_LFA1-TELF1 ---- ----555-1111555-2222555-3333
VEND 011
555-1111
OldData
OldData
OldData
OldData
OldData
OldData
OldData
OldData
OldData
1 (header)2 (uline)3 VEND011 Star Craft Metal4 VEND012 Quality Fabr.5 VEND013 Euro Output SA
IBM Global Business Services
© IBM Corporation 201321 Dec-2008The AT LINE-SELECTION Event (SY-LISEL vs. HIDE) |
LFA1 WORK AREALFA1 WORK AREALFA1 WORK AREALFA1 WORK AREA
?
AT LINE-SELECTION.CHECK SY-LSIND = 1.WINDOW STARTING AT 10 4
ENDING AT 77 12.SELECT * FROM BSIK INTO WA_BSIK WHERE
LIFNR = WA_LFA1-LIFNR.WRITE: / WA_LFA1-LIFNR, WA_BSIK-BELNR.
ENDSELECT.IF SY-SUBRC <> 0.WRITE: / ‘No invoices for vendor’, WA_LFA1-LIFNR.ENDIF.
Remember... This is Remember... This is referencing the program referencing the program field! The value of this field! The value of this field is dependent upon field is dependent upon which line you double-which line you double-
clicked in the on-screen clicked in the on-screen report.report.
Remember... This is Remember... This is referencing the program referencing the program field! The value of this field! The value of this field is dependent upon field is dependent upon which line you double-which line you double-
clicked in the on-screen clicked in the on-screen report.report.
SELECT *
Coding Example : Using the HIDE Memory Area
IBM Global Business Services
© IBM Corporation 201322 Dec-2008The AT LINE-SELECTION Event (SY-LISEL vs. HIDE) |
Demonstration
Usage of HIDE command in Interactive Reporting.
IBM Global Business Services
© IBM Corporation 201323 Dec-2008The AT LINE-SELECTION Event (SY-LISEL vs. HIDE) |
Practice
Usage of HIDE command in Interactive Reporting.
IBM Global Business Services
© IBM Corporation 201324 Dec-2008The AT LINE-SELECTION Event (SY-LISEL vs. HIDE) |
Challenges Revisited
Second Challenge:Second Challenge:
How is this record sent back as criteria to an How is this record sent back as criteria to an ABAP SELECT statement?ABAP SELECT statement?
METHOD: HIDE memory area.METHOD: HIDE memory area.
First Challenge:First Challenge:
How did the ABAP code “know” which record the user How did the ABAP code “know” which record the user has selected?has selected?
METHOD: When a user event is triggered, the system METHOD: When a user event is triggered, the system automatically records the line selected (via SY-LISEL automatically records the line selected (via SY-LISEL and other system fields).and other system fields).
IBM Global Business Services
© IBM Corporation 201325 Dec-2008The AT LINE-SELECTION Event (SY-LISEL vs. HIDE) |
Restart the program and double-click on the header.
Is the User Selecting a Valid Line in the Report?
IBM Global Business Services
© IBM Corporation 201326 Dec-2008The AT LINE-SELECTION Event (SY-LISEL vs. HIDE) |
Restart the program and double-click on the header. What happens?
Where does this data come from?
Is the User Selecting a Valid Line in the Report?
IBM Global Business Services
© IBM Corporation 201327 Dec-2008The AT LINE-SELECTION Event (SY-LISEL vs. HIDE) |
What Happens When the User Clicks on an Invalid Line First?
No values are restored from HIDE into program fields.The last record selected by the “SELECT” statement is still in
work area and still available for further processing.
HIDE MEMORYWA_LFA1-LIFNR ---- ----VEND011VEND012VEND013
INDEX12345
BASIC LIST
WA_LFA1-TELF1 ---- ----555-1111555-2222555-3333
VEND- OR2
555-9898 PA USA 19103
Mr. Jones $100
NET 30Phila.
123Main
Bacon Inc.
1 (header)2 (uline)3 VEND011 Star Craft Metal4 VEND012 Quality Fabr.5 VEND013 Euro Output SA
IBM Global Business Services
© IBM Corporation 201328 Dec-2008The AT LINE-SELECTION Event (SY-LISEL vs. HIDE) |
SYNTAX: END-OF-SELECTION.
A New ABAPEvent
After all of the other system events have been
executed . . .
INITIALIZATION.
AT SELECTION-SCREEN.
START-OF-SELECTION.
GET <table>.
GET <table> LATE.
. . . before the basic list is displayed.
. . . the END-OF-SELECTION event occurs . . .
The END-OF-SELECTION Event
IBM Global Business Services
© IBM Corporation 201329 Dec-2008The AT LINE-SELECTION Event (SY-LISEL vs. HIDE) |
END-OF-SELECTION.CLEAR WA_LFA1-LIFNR.
AT LINE-SELECTION.CHECK SY-LSIND = 1.CHECK NOT WA_LFA1-LIFNR IS INITIAL.WINDOW STARTING AT 10 4
ENDING AT 77 12.SELECT * FROM BSIK INTO WA_BSIK WHERE
LIFNR = WA_LFA1-LIFNR.WRITE: / WA_LFA1-LIFNR, WA_BSIK-BELNR.
ENDSELECT.IF SY-SUBRC <> 0.
WRITE: / ‘No invoices for vendor’, WA_LFA1-LIFNR.ENDIF.
2
First: Initialise the WA_LFA1-LIFNR program field just before the basic list is displayed.
Second: Make sure the WA_LFA1-LIFNR program field is not initial before processing the rest of the user event (i.e. make sure the user selected a valid line).
SELECT *
1
Part I - Initializing Fields before Basic List Displayed
Handling Invalid Line Selection
IBM Global Business Services
© IBM Corporation 201330 Dec-2008The AT LINE-SELECTION Event (SY-LISEL vs. HIDE) |
Click on a Valid Line First
data available for further processing
TABLE WORK AREA(Field String)
HIDE MEMORY
WA_LFA1-LIFNR ---- ----VEND011VEND012VEND013
INDEX12345
WA_LFA1-TELF1 ---- ----555-1111555-2222555-3333
VEND 012
555-2222
1 (header)2 (uline)3 VEND011 Star Craft Metal4 VEND012 Quality Fabr.5 VEND013 Euro Output SA
OldData
OldData
OldData
OldData
OldData
OldData
OldData
OldData
OldData
BASIC LIST
IBM Global Business Services
© IBM Corporation 201331 Dec-2008The AT LINE-SELECTION Event (SY-LISEL vs. HIDE) |
… Then Click on an Invalid Line
TABLE WORK AREA(Field String)
No values restored from HIDE into program fields. Values restored from last valid line selected by the user are still in the work area.
HIDE MEMORY
WA_LFA1-LIFNR ---- ----VEND011VEND012VEND013
INDEX12345
WA_LFA1-TELF1 ---- ----
555-1111555-2222555-3333
VEND 012
555-2222
1 (header)2 (uline)3 VEND011 Star Craft Metal4 VEND012 Quality Fabr.5 VEND013 Euro Output SA
OldData
OldData
OldData
OldData
OldData
OldData
OldData
OldData
OldData
BASIC LIST
IBM Global Business Services
© IBM Corporation 201332 Dec-2008The AT LINE-SELECTION Event (SY-LISEL vs. HIDE) |
Handling Invalid Line Selection
END-OF-SELECTION.CLEAR WA_LFA1-LIFNR.
AT LINE-SELECTION.CHECK SY-LSIND = 1.CHECK NOT WA_LFA1-LIFNR IS INITIAL.WINDOW STARTING AT 10 4
ENDING AT 77 12.SELECT * FROM BSIK INTO WA_BSIK WHERE
LIFNR = WA_LFA1-LIFNR.WRITE: / WA_LFA1-LIFNR, WA_BSIK-BELNR.
ENDSELECT.IF SY-SUBRC <> 0.
WRITE: / ‘No invoices for vendor’, WA_LFA1-LIFNR.ENDIF.CLEAR WA_LFA1-LIFNR.
2
1
First: Initialise the WA_LFA1-LIFNR program field just before the detail list is displayed.
Second: Make sure the WA_LFA1-LIFNR program field is not initial before processing the rest of the user event (i.e. make sure the user selected a valid line).
SELECT *
Part II - Initializing Fields after Each Use
IBM Global Business Services
© IBM Corporation 201333 Dec-2008The AT LINE-SELECTION Event (SY-LISEL vs. HIDE) |
Flow of Data
DATASOURCE
BASICLIST
HIDEMEMORY
WORK AREA
IBM Global Business Services
© IBM Corporation 201334 Dec-2008The AT LINE-SELECTION Event (SY-LISEL vs. HIDE) |
Summary
AT LINE-SELECTION event is triggered when a user double-clicks on a line in the list (or single-clicks on a line and clicks on CHOOSE button or presses F2).
System field SY-LISEL contains the contents of the line selected by the user and SY-LILLI contains the number of the line selected.
HIDE memory area exists for each lists in a report. This area gets populated with the program fields when the system encounters the HIDE statement.
Specific fields can be stored in the memory using HIDE statement. HIDE command can be used to place multiple fields in HIDE memory area.
HIDE memory area cannot be directly accessed using an ABAP statement. Information is fetched from this area depending on the line the user selects.
IBM Global Business Services
© IBM Corporation 201335 Dec-2008The AT LINE-SELECTION Event (SY-LISEL vs. HIDE) |
Question
Which system field contains the content of the selected line ?
What does a HIDE statement do ?
How is the HIDE statement used for producing detail lists ?
What is an invalid line in the context of drill down reporting ?
How do you determine if the user has clicked on a valid line ?
What records are stored in a HIDE memory area ? How do the system get the value for a particular field for the selected line from HIDE memory area ?