You are on page 1of 35

IBM Global Business Services

The AT LINE-SELECTION Event (SY-LISEL vs. HIDE)

The AT LINE-SELECTION Event Dec-2008 IBM Corporation 2013


(SY-LISEL vs. HIDE) |
IBM Global Business Services

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.

2 The AT LINE-SELECTION Event (SY-LISEL vs. HIDE) | Dec-2008 IBM Corporation 2013
IBM Global Business Services

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.

3 The AT LINE-SELECTION Event (SY-LISEL vs. HIDE) | Dec-2008 IBM Corporation 2013
IBM Global Business Services

The Challenges

First Challenge:
How did the ABAP code know when and which record
the user has selected?

Second Challenge:
How is this record sent back as criteria to an
ABAP SELECT statement?

SELECT * FROM BSIK WHERE LIFNR = <selected vendor number>.

4 The AT LINE-SELECTION Event (SY-LISEL vs. HIDE) | Dec-2008 IBM Corporation 2013
IBM Global Business Services

Illustration : (The AT LINE-SELECTION Event)

Determining When the User Is Requesting


Additional Information

When the user double-clicks a line in the report,


the AT LINE-SELECTION event occurs A New
(because the PICK function code is invoked). ABAP
Event

SYNTAX: AT LINE-SELECTION.

5 The AT LINE-SELECTION Event (SY-LISEL vs. HIDE) | Dec-2008 IBM Corporation 2013
IBM Global Business Services

The SY-LISEL System Field

Determining Which Records the User Is Requesting Additional


Information Upon

When the user selects a line in the report,


SY-LISEL is updated with the text from A New
that line. ABAP
System Field

The Contents of SY-LISEL:


222 Express Vendor Inc CHICAGO

SYSTEM FIELD: SY-LISEL

6 The AT LINE-SELECTION Event (SY-LISEL vs. HIDE) | Dec-2008 IBM Corporation 2013
IBM Global Business Services

Coding Example : AT LINE-SELECTION and SY-LISEL

DATA:WA_LFA1 TYPE LFA1. SELECT *


CHECK
START-OF-SELECTION. SY-SUBRC
SELECT * FROM LFA1 INTO WA_LFA1.
WRITE: / WA_LFA1-LIFNR, WA_LFA1-NAME1, WA_LFA1-ORT01.
ENDSELECT.

This code is continued on the next page.

7 The AT LINE-SELECTION Event (SY-LISEL vs. HIDE) | Dec-2008 IBM Corporation 2013
IBM Global Business Services

Coding Example : AT LINE-SELECTION and SY-LISEL

*--------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--------------------------*

8 The AT LINE-SELECTION Event (SY-LISEL vs. HIDE) | Dec-2008 IBM Corporation 2013
IBM Global Business Services

AT LINE-SELECTION and SY-LISEL

First double-click on a Then a second drill down list is


record. 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?

9 The AT LINE-SELECTION Event (SY-LISEL vs. HIDE) | Dec-2008 IBM Corporation 2013
IBM Global Business Services

Limitations of the SY-LISEL System Field

We cant send an entire string to an ABAP SELECT statement.

The contents of SY-LISEL:

100141 A B Anders Heidelberg

However, if we could somehow send only


individual fields from the selected record, we
would then process that data with an ABAP
100141 SELECT statement.

SELECT * FROM BSIK WHERE LIFNR = 100141

10 The AT LINE-SELECTION Event (SY-LISEL vs. HIDE) | Dec-2008 IBM Corporation 2013
IBM Global Business Services

Demonstration

Use of AT LINE-SELECTION event and SY-LISEL system field.

11 The AT LINE-SELECTION Event (SY-LISEL vs. HIDE) | Dec-2008 IBM Corporation 2013
IBM Global Business Services

Practice

Use of AT LINE-SELECTION event and SY-LISEL system field.

12 The AT LINE-SELECTION Event (SY-LISEL vs. HIDE) | Dec-2008 IBM Corporation 2013
IBM Global Business Services

The HIDE ABAP Reserved Word

Extracting Individual Fields from the Record Chosen


by the User
A New
ABAP
Reserved
Word
SELECT *
CHECK
START-OF-SELECTION. SY-SUBRC
SELECT * FROM LFA1 INTO WA_LFA1.
WRITE: / WA_LFA1-LIFNR, WA_LFA1-NAME1, WA_LFA1-ORT01.
HIDE: WA_LFA1-LIFNR.
ENDSELECT.

SYNTAX: HIDE <program field>.

13 The AT LINE-SELECTION Event (SY-LISEL vs. HIDE) | Dec-2008 IBM Corporation 2013
IBM Global Business Services

The HIDE Memory Area

SELECT *
CHECK
START-OF-SELECTION. SY-SUBRC
SELECT * FROM LFA1 INTO WA_LFA1.
WRITE: / WA_LFA1-LIFNR, WA_LFA1-NAME1, WA_LFA1-ORT01.
HIDE: WA_LFA1-LIFNR.
ENDSELECT.

LIST MEMORY

WRITE: / RECORD # 2 HIDE

LFA1 WORK AREA

14 The AT LINE-SELECTION Event (SY-LISEL vs. HIDE) | Dec-2008 IBM Corporation 2013
IBM Global Business Services

The HIDE Memory Area : (Showing the Index)

SELECT *
START-OF-SELECTION.
SELECT * FROM LFA1 INTO WA_LFA1.
WRITE: / WA_LFA1-LIFNR, . . . MEMORY
HIDE: WA_LFA1-LIFNR.
INDEX WA_LFA1-LIFNR
ENDSELECT.
1 ----
2 ----
3 VEND011
CHECK
4 VEND012
SY-SUBRC
5 VEND013

This is what the HIDE memory area and


work area WA_LFA1 look like after the
SELECT statement above has finished
processing. RECORD # 3

LFA1 WORK AREA


15 The AT LINE-SELECTION Event (SY-LISEL vs. HIDE) | Dec-2008 IBM Corporation 2013
IBM Global Business Services

The HIDE Memory Area : (with More than One Field Stored)

START-OF-SELECTION. SELECT *
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
INDEX WA_LFA1- WA_LFA1-TELF1
CHECK 1 LIFNR ----
SY-SUBRC 2 ---- ----
3 ---- 555-1111
If we used the HIDE 4 VEND011 555-2222
statement to hide both 5 VEND012 555-3333
LIFNR and TELF1, our VEND013
HIDE memory area would
look like this.

16 The AT LINE-SELECTION Event (SY-LISEL vs. HIDE) | Dec-2008 IBM Corporation 2013
IBM Global Business Services

The HIDE Index Numbers

The Correlation between the HIDE Memory Area and Line Numbers

LINE 4 from the screen corresponds


INDEX with INDEX 4 from the HIDE memory area.
1
2 MEMORY
3
INDEX WA_LFA1-LIFNR
4
1 ----
2 ----
3 VEND011
VEND012 4 VEND012
5 VEND013

WORK AREA
WA_LFA1
17 The AT LINE-SELECTION Event (SY-LISEL vs. HIDE) | Dec-2008 IBM Corporation 2013
IBM Global Business Services

Coding Example : Using the HIDE ABAP Reserved Word

REPORT Y190XX02.
DATA: WA_LFA1 TYPE LFA1 ,
WA_BSIK TYPE BSIK. CHECK
SELECT * SY-SUBRC
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.

18 The AT LINE-SELECTION Event (SY-LISEL vs. HIDE) | Dec-2008 IBM Corporation 2013
IBM Global Business Services

What Happens When the System Hides Values?

DATA
SOURCE
TABLE BASIC LIST
WORK AREA
1 (header)
field string WRITE 2 (uline)
3 VEND011 Star Craft Metal
4 VEND012 Quality Fabr.
5 VEND013 Euro Output SA

SELECT HIDE MEMORY


INDEX WA_LFA1- WA_LFA1-
HIDE 1 LIFNR TELF1
2 ---- ----
---- ----
3
VEND011 555-1111
4
VEND012 555-2222
5
VEND013 555-3333

19 The AT LINE-SELECTION Event (SY-LISEL vs. HIDE) | Dec-2008 IBM Corporation 2013
IBM Global Business Services

What Happens When the User Selects a Valid Line?

BASIC LIST
1 (header) HIDE MEMORY
2 (uline) INDEX WA_LFA1-
3 VEND011 Star Craft Metal 1 LIFNR WA_LFA1-
4 VEND012 Quality Fabr. 2 ---- TELF1
----
5 VEND013 Euro Output SA 3 ----
VEND011 ----
4
VEND012 555-1111
5
VEND013 555-2222
555-3333
TABLE WORK AREA
(Field String)
data available for further processing

VEND 555- Old Old Old Old Old Old Old Old Old
011 1111 Data Data Data Data Data Data Data Data Data

20 The AT LINE-SELECTION Event (SY-LISEL vs. HIDE) | Dec-2008 IBM Corporation 2013
IBM Global Business Services

Coding Example : Using the HIDE Memory Area


Remember... This is
referencing the program
field! The value of this
field is dependent upon
AT LINE-SELECTION. SELECT * which line you double-
CHECK SY-LSIND = 1. clicked in the on-screen
WINDOW STARTING AT 10 4 report.
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. ?
LFA1 WORK AREA

21 The AT LINE-SELECTION Event (SY-LISEL vs. HIDE) | Dec-2008 IBM Corporation 2013
IBM Global Business Services

Demonstration

Usage of HIDE command in Interactive Reporting.

22 The AT LINE-SELECTION Event (SY-LISEL vs. HIDE) | Dec-2008 IBM Corporation 2013
IBM Global Business Services

Practice

Usage of HIDE command in Interactive Reporting.

23 The AT LINE-SELECTION Event (SY-LISEL vs. HIDE) | Dec-2008 IBM Corporation 2013
IBM Global Business Services

Challenges Revisited

First Challenge:
How did the ABAP code know which record the user
has selected?
METHOD: When a user event is triggered, the system
automatically records the line selected (via SY-LISEL
and other system fields).

Second Challenge:
How is this record sent back as criteria to an
ABAP SELECT statement?
METHOD: HIDE memory area.

24 The AT LINE-SELECTION Event (SY-LISEL vs. HIDE) | Dec-2008 IBM Corporation 2013
IBM Global Business Services

Is the User Selecting a Valid Line in the Report?

Restart the program and double-


click on the header.

25 The AT LINE-SELECTION Event (SY-LISEL vs. HIDE) | Dec-2008 IBM Corporation 2013
IBM Global Business Services

Is the User Selecting a Valid Line in the Report?

Restart the program and double-click on the


header. What happens?

Where does this data come from?

26 The AT LINE-SELECTION Event (SY-LISEL vs. HIDE) | Dec-2008 IBM Corporation 2013
IBM Global Business Services

What Happens When the User Clicks on an Invalid Line First?

BASIC LIST HIDE MEMORY


WA_LFA1-
1 (header) LIFNR WA_LFA1-
2 (uline) INDEX TELF1
----
3 VEND011 Star Craft Metal 1 ---- ----
4 VEND012 Quality Fabr. 2 VEND011 ----
5 VEND013 Euro Output SA 3 VEND012 555-1111
4 VEND013 555-2222
5 555-3333

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.

VEND- 555- Bacon 123 Mr. NET


OR2 9898 Inc. Main Phila. PA USA 19103 Jones $100 30

27 The AT LINE-SELECTION Event (SY-LISEL vs. HIDE) | Dec-2008 IBM Corporation 2013
IBM Global Business Services

The END-OF-SELECTION Event

After all of the other


system events have been . . . before the basic list is
executed . . . displayed.

. . . the END-OF-SELECTION event


occurs . . .
INITIALIZATION.
AT SELECTION-SCREEN.
START-OF-SELECTION.
GET <table>.
GET <table> LATE.

A New
ABAP
SYNTAX: END-OF-SELECTION. Event

28 The AT LINE-SELECTION Event (SY-LISEL vs. HIDE) | Dec-2008 IBM Corporation 2013
IBM Global Business Services

Handling Invalid Line Selection

Part I - Initializing Fields before Basic List Displayed


First: Initialise the WA_LFA1-
LIFNR program field just before
END-OF-SELECTION. the basic list is displayed.
CLEAR WA_LFA1-LIFNR.
1
Second: Make sure the
AT LINE-SELECTION. WA_LFA1-LIFNR program field is
CHECK SY-LSIND = 1. not initial before processing the
CHECK NOT WA_LFA1-LIFNR IS INITIAL.2 rest of the user event (i.e. make
WINDOW STARTING AT 10 4 sure the user selected a valid
ENDING AT 77 12. line).
SELECT * FROM BSIK INTO WA_BSIK WHERE
LIFNR = WA_LFA1-LIFNR.
WRITE: / WA_LFA1-LIFNR, WA_BSIK-BELNR.
ENDSELECT.
IF SY-SUBRC <> 0. SELECT *
WRITE: / No invoices for vendor, WA_LFA1-LIFNR.
ENDIF.

29 The AT LINE-SELECTION Event (SY-LISEL vs. HIDE) | Dec-2008 IBM Corporation 2013
IBM Global Business Services

Click on a Valid Line First

BASIC LIST HIDE MEMORY


1 (header) WA_LFA1-
2 (uline) INDEX LIFNR WA_LFA1-
3 VEND011 Star Craft Metal 1 ---- TELF1
4 VEND012 Quality Fabr. 2 ----
----
5 VEND013 Euro Output SA 3 VEND011 ----
4 VEND012 555-1111
5 VEND013 555-2222
555-3333

TABLE WORK AREA


(Field String)
data available for further processing

VEND 555- Old Old Old Old Old Old Old Old Old
012 2222 Data Data Data Data Data Data Data Data Data

30 The AT LINE-SELECTION Event (SY-LISEL vs. HIDE) | Dec-2008 IBM Corporation 2013
IBM Global Business Services

Then Click on an Invalid Line

BASIC LIST
HIDE MEMORY
1 (header) WA_LFA1-
2 (uline) INDEX LIFNR WA_LFA1-
3 VEND011 Star Craft Metal 1 ---- TELF1
4 VEND012 Quality Fabr. 2 ---- ----
3 VEND011 ----
5 VEND013 Euro Output SA
4 VEND012 555-1111
5 VEND013 555-2222
555-3333
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.

VEND 555- Old Old Old Old Old Old Old Old Old
012 2222 Data Data Data Data Data Data Data Data Data

31 The AT LINE-SELECTION Event (SY-LISEL vs. HIDE) | Dec-2008 IBM Corporation 2013
IBM Global Business Services

Handling Invalid Line Selection

Part II - Initializing Fields after Each Use First: Initialise the WA_LFA1-
LIFNR program field just before
the detail list is displayed.
END-OF-SELECTION.
CLEAR WA_LFA1-LIFNR. Second: Make sure the
WA_LFA1-LIFNR program field is
AT LINE-SELECTION. not initial before processing the
CHECK SY-LSIND = 1. rest of the user event (i.e. make
CHECK NOT WA_LFA1-LIFNR IS INITIAL. 2
sure the user selected a valid
WINDOW STARTING AT 10 4 line).
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. SELECT *
WRITE: / No invoices for vendor, WA_LFA1-LIFNR.
ENDIF. 1
CLEAR WA_LFA1-LIFNR.

32 The AT LINE-SELECTION Event (SY-LISEL vs. HIDE) | Dec-2008 IBM Corporation 2013
IBM Global Business Services

Flow of Data

HIDE
BASIC MEMORY
LIST

DATA
SOURCE
WORK AREA

33 The AT LINE-SELECTION Event (SY-LISEL vs. HIDE) | Dec-2008 IBM Corporation 2013
IBM Global Business Services

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.

34 The AT LINE-SELECTION Event (SY-LISEL vs. HIDE) | Dec-2008 IBM Corporation 2013
IBM Global Business Services

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 ?

35 The AT LINE-SELECTION Event (SY-LISEL vs. HIDE) | Dec-2008 IBM Corporation 2013

You might also like