Vous êtes sur la page 1sur 17

IBM Global Services

2005 IBM Corporation Multiple Line Selection | 4.08 March-2005


Multiple Line Selection

IBM Global Services
2005 IBM Corporation 2 March-2005 Multiple Line Selection | 4.08
The participants will be able to :
Write check boxes in the screen.
Providing additional information on single record on the screen.
Use READ-LINE statement with SY-INDEX.
Objectives
IBM Global Services
2005 IBM Corporation 3 March-2005 Multiple Line Selection | 4.08
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.
Providing Additional Information on a Single Record Only
IBM Global Services
2005 IBM Corporation 4 March-2005 Multiple Line Selection | 4.08
First, the user clicks inside of the
checkboxes for the vendors that
the user is interested in.
Then a drill down window
appears that contains the
telephone numbers for each of
the previously selected vendors.
Providing Additional Information on Multiple Records
IBM Global Services
2005 IBM Corporation 5 March-2005 Multiple Line Selection | 4.08
READ LINE 1.. checked? YES or NO
READ LINE 2.. checked? YES or NO
READ LINE 3 .. checked? YES or NO
READ LINE n .. checked? YES or NO
First we must learn techniques to
draw checkboxes on the screen.
Then we must learn techniques to loop through each of the lines on the
report and determine whether or not they were checked.
Challenges
IBM Global Services
2005 IBM Corporation 6 March-2005 Multiple Line Selection | 4.08
REPORT Y190XX03 LINE-SIZE 255.

TABLES: LFA1.
DATA: CHK1.

START-OF-SELECTION.
SELECT * FROM LFA1 WHERE TELF1 <> SPACE.
WRITE: / CHK1 AS CHECKBOX,
LFA1-LIFNR, LFA1-NAME1, LFA1-ORT01.
SKIP.
ENDSELECT.
Create a single-character variable.
Then WRITE it to the
report as a checkbox.
SELECT *
SY-SUBRC
CHECK
Coding Example : Writing Checkboxes to the Screen
IBM Global Services
2005 IBM Corporation 7 March-2005 Multiple Line Selection | 4.08
SYNTAX: READ LINE <#>.
A New
ABAP
Reserved Word
READ LINE 11 FIELD VALUE LFA1-LIFNR INTO VAR1.
MEMORY
VAR1 = VEND021
Programmatically Reading a Line in a Report
The READ LINE Statement
IBM Global Services
2005 IBM Corporation 8 March-2005 Multiple Line Selection | 4.08
READ LINE 1
READ LINE 2
READ LINE 3
READ LINE n
SYSTEM FIELD: SY-INDEX
A New
ABAP
System Field
READ LINE SY-INDEX FIELD VALUE LFA1-LIFNR INTO VAR1.
Looping through Each of the Lines in the Report
The SY-INDEX System Field
IBM Global Services
2005 IBM Corporation 9 March-2005 Multiple Line Selection | 4.08
This code continues on the next page.
REPORT Y190XX03 LINE-SIZE 255.

TABLES: LFA1.
DATA: CHK1.

START-OF-SELECTION.
SELECT * FROM LFA1 WHERE TELF1 <> SPACE.
WRITE: / CHK1 AS CHECKBOX,
LFA1-LIFNR, LFA1-NAME1, LFA1-ORT01.
HIDE: LFA1-NAME1, LFA1-TELF1.
SKIP.
ENDSELECT.
Write this code.
SELECT *
SY-SUBRC
CHECK
The READ LINE Statement
IBM Global Services
2005 IBM Corporation 10 March-2005 Multiple Line Selection | 4.08
READ LINE 1
READ LINE 2
READ LINE 3
READ LINE n
..checked? YES or NO
.. checked? YES or NO
.. checked? YES or NO
.. checked? YES or NO
AT PF06.
WINDOW STARTING AT 10 4 ENDING AT 77 12.
DO.
CLEAR CHK1.
READ LINE SY-INDEX FIELD VALUE CHK1.
IF SY-SUBRC <> 0.
EXIT.
ELSE.
CHECK CHK1 = X.
WRITE: / LFA1-NAME1, LFA1-TELF1.
ENDIF.
ENDDO.
Coding Example : The READ LINE Statement
IBM Global Services
2005 IBM Corporation 11 March-2005 Multiple Line Selection | 4.08
When the user has finished reading the
data in the drill down window, he/she
returns to the initial screen to find that
it has been modified to show the records
that have already been selected.
First the user clicks on the vendors
of interest.
Then the user presses the
F6 key on the keyboard.
The MODIFY LINE Statement
IBM Global Services
2005 IBM Corporation 12 March-2005 Multiple Line Selection | 4.08
REPORT Y190XX03 LINE-SIZE 255.
TABLES: LFA1.
DATA: CHK1.
DATA: WAS_USED.

SELECT * FROM LFA1 WHERE TELF1 <> SPACE.
WRITE: / CHK1 AS CHECKBOX, WAS_USED,
LFA1-LIFNR, LFA1-NAME1, LFA1-ORT01.
HIDE: LFA1-NAME1, LFA1-TELF1.
SKIP.
ENDSELECT.
Add new code here and here.
SELECT *
SY-SUBRC
CHECK
Coding Example : The MODIFY LINE Statement
IBM Global Services
2005 IBM Corporation 13 March-2005 Multiple Line Selection | 4.08
AT PF06.
WINDOW STARTING AT 10 4 ENDING AT 77 12.
DO.
CLEAR CHK1.
READ LINE SY-INDEX FIELD VALUE CHK1.
IF SY-SUBRC <> 0.
EXIT.
ELSE.
CHECK CHK1 = X.
MODIFY CURRENT LINE:
FIELD VALUE WAS_USED FROM *
CHK1 FROM SPACE
FIELD FORMAT CHK1 INPUT OFF.
WRITE: / LFA1-NAME1, LFA1-TELF1.
ENDIF.
ENDDO.
Add new code here.
Coding Example : The MODIFY LINE Statement
IBM Global Services
2005 IBM Corporation 14 March-2005 Multiple Line Selection | 4.08
Demonstration
Writing checkboxes, use of READ LINE and MODIFY LINE statement
IBM Global Services
2005 IBM Corporation 15 March-2005 Multiple Line Selection | 4.08
Practice
Writing checkboxes, use of READ LINE and MODIFY LINE statement
IBM Global Services
2005 IBM Corporation 16 March-2005 Multiple Line Selection | 4.08
Summary
Checkboxes can be written to the list by using AS CHECKBOX addition with the
WRITE command.
READ LINE statement can be used to read the contents of a list. With this
statement, the contents of the line are populated in system field SY-LISEL.
MODIFY LINE statement can be used to modify the list even after it is displayed.
The format of the lines in the list can also be changed using MODIFY LINE ..
FORMAT addition.
IBM Global Services
2005 IBM Corporation 17 March-2005 Multiple Line Selection | 4.08
Questions
How do you draw checkboxes in the output list ?
How to read the contents of a list ?
How do you modify the contents of a list after it is displayed ?

Vous aimerez peut-être aussi