Sie sind auf Seite 1von 35

IBM Global Business Services

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

The AT LINE-SELECTION Event


(SY-LISEL vs. HIDE) |

Dec-2008

IBM Corporation 2013

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.

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.

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

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
(because the PICK function code is invoked).

A New
ABAP
Event

SYNTAX: AT LINE-SELECTION.

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 that
line.

A New
ABAP
System Field

The Contents of SY-LISEL:


222

Express Vendor Inc

CHICAGO

SYSTEM FIELD: SY-LISEL

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

SELECT *
DATA:WA_LFA1 TYPE LFA1.
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.

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

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

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

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
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
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.
ENDSELECT.

MEMORY

LIST

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, . . .
HIDE: WA_LFA1-LIFNR.
ENDSELECT.

CHECK
SY-SUBRC
This is what the HIDE memory area and
work area WA_LFA1 look like after the
SELECT statement above has finished
processing.

MEMORY
INDEX
1
2
3
4
5

WA_LFA1-LIFNR
------VEND011
VEND012
VEND013

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)
SELECT *
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
CHECK
SY-SUBRC
If we used the HIDE
statement to hide both
LIFNR and TELF1, our
HIDE memory area would
look like this.

16

INDEX
1
2
3
4
5

WA_LFA1LIFNR
------VEND011
VEND012
VEND013

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

WA_LFA1-TELF1
------555-1111
555-2222
555-3333

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


with INDEX 4 from the HIDE memory area.

INDEX
1
2
3
4

MEMORY

VEND012

INDEX
1
2
3
4
5

WA_LFA1-LIFNR
------VEND011
VEND012
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.

SELECT *

CHECK
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
WORK AREA
field string

BASIC LIST
WRITE

SELECT
HIDE

19

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

1
2
3
4
5

(header)
(uline)
VEND011
VEND012
VEND013

Star Craft Metal


Quality Fabr.
Euro Output SA

HIDE MEMORY
INDEX WA_LFA1WA_LFA11
LIFNR
TELF1
2
------------3
VEND011
555-1111
4
VEND012
555-2222
5
VEND013
555-3333
Dec-2008

IBM Corporation 2013

IBM Global Business Services

What Happens When the User Selects a Valid Line?


BASIC LIST
1
2
3
4
5

(header)
(uline)
VEND011
VEND012
VEND013

VEND 555011
1111

20

HIDE MEMORY
INDEX WA_LFA11
LIFNR
WA_LFA1Star Craft Metal
2
---TELF1
Quality Fabr.
---3
---Euro Output SA
VEND011
---4
VEND012 555-1111
5
VEND013 555-2222
555-3333
TABLE WORK AREA
(Field String)
data available for further processing
Old
Data

Old
Data

Old
Data

Old
Data

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

Old
Data

Old
Data

Dec-2008

Old
Data

Old
Data

Old
Data

IBM Corporation 2013

IBM Global Business Services

Coding Example : Using the HIDE Memory Area

AT LINE-SELECTION.
SELECT *
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...
Remember... This
This is
is
referencing
referencing the
the program
program
field!
field! The
The value
value of
of this
this
field
field is
is dependent
dependent upon
upon
which
which line
line you
you doubledoubleclicked
clicked in
in the
the on-screen
on-screen
report.
report.

?
LFA1
LFA1 WORK
WORK AREA
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 doubleclick 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
1
2
3
4
5

(header)
(uline)
VEND011
VEND012
VEND013

INDEX
1
2
3
4
5

Star Craft Metal


Quality Fabr.
Euro Output SA

HIDE MEMORY
WA_LFA1WA_LFA1LIFNR
TELF1
------------VEND011
VEND012 555-1111
VEND013 555-2222
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
OR2 9898
Inc. Main

27

Phila.

PA

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

USA

Mr.
19103 Jones $100

Dec-2008

NET
30

IBM Corporation 2013

IBM Global Business Services

The END-OF-SELECTION Event


After all of the other
system events have been
executed . . .

INITIALIZATION.

. . . before the basic list is


displayed.
. . . the END-OF-SELECTION event
occurs . . .

AT SELECTION-SCREEN.
START-OF-SELECTION.
GET <table>.
GET <table> LATE.
A New
ABAP
Event

SYNTAX: END-OF-SELECTION.

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

END-OF-SELECTION.
1
CLEAR WA_LFA1-LIFNR.

First: Initialise the WA_LFA1LIFNR program field just before


the basic list is displayed.

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.
SELECT *
IF SY-SUBRC <> 0.
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
1
2
3
4
5

(header)
(uline)
VEND011
VEND012
VEND013

HIDE MEMORY
WA_LFA1INDEX LIFNR
1
------2
VEND011
3
VEND012
4
VEND013
5

Star Craft Metal


Quality Fabr.
Euro Output SA

WA_LFA1TELF1
------555-1111
555-2222
555-3333

TABLE WORK AREA


(Field String)
data available for further processing
VEND 555012
2222

30

Old
Data

Old
Data

Old
Data

Old
Data

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

Old
Data

Old
Data

Dec-2008

Old
Data

Old
Data

Old
Data

IBM Corporation 2013

IBM Global Business Services

Then Click on an Invalid Line


BASIC LIST
1
2
3
4
5

(header)
(uline)
VEND011
VEND012
VEND013

HIDE MEMORY
INDEX
1
2
3
4
5

Star Craft Metal


Quality Fabr.
Euro Output SA

WA_LFA1LIFNR
------VEND011
VEND012
VEND013

WA_LFA1TELF1
------555-1111
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 555012
2222

31

Old
Data

Old
Data

Old
Data

Old
Data

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

Old
Data

Old
Data

Dec-2008

Old
Data

Old
Data

Old
Data

IBM Corporation 2013

IBM Global Business Services

Handling Invalid Line Selection


Part II - Initializing Fields after Each Use
END-OF-SELECTION.
CLEAR WA_LFA1-LIFNR.

First: Initialise the WA_LFA1LIFNR 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).

AT LINE-SELECTION.
CHECK SY-LSIND = 1.
2
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.
SELECT *
IF SY-SUBRC <> 0.
WRITE: / No invoices for vendor, WA_LFA1-LIFNR.
1
ENDIF.
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

BASIC
LIST

HIDE
MEMORY

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

Das könnte Ihnen auch gefallen