ABAP/4   ОКМ   ДМ   экономическая информатика   4GL   Теория и практика обработки информации

Компьютерный язык ABAP/4 - ключевые слова

AT - Events in lists

Variants



1. AT LINE-SELECTION.
2. AT USER-COMMAND.
3. AT PFn.

Variant 1

AT LINE-SELECTION.

Effect

Event in interactive reporting

This event is processed whenever the user chooses a valid line in the list (i.e. a line generated by statements such as WRITE , ULINE or SKIP ) with the cursor and presses the function key which has the function PICK in the interface definition. This should normally be the function key F2 , because it has the same effect as double-clicking the mouse, or single-clicking in the case of a hotspot .
The processing for the event AT LINE-SELECTION usually generates further list output (the details list) which completely covers the current list display. If the latter is still visible (to aid user orientation), this may be due to the key word WINDOW .
In most cases, the information is from the selected line is used to retrieve more comprehensive information by direct reading. When displaying the original list, you store the key terms needed for this in the HIDE area of the output line.

Note

You can choose a line and start new processing even in the details lists.
The following system fields are useful for orientation purposes, since their values change with each interactive event executed.
SY-LSIND Index of list created by current event (basic list = 0, 1st details list = 1, ...) SY-PFKEY Status of displayed list (SET PF-STATUS ) SY-LISEL Contents of selected line SY-LILLI Absolute number of this line in the displayed list SY-LISTI Index of this list - usually SY-LSIND - 1 (READ LINE ) SY-CUROW Last cursor position: Line in window SY-CUCOL Last cursor position: Column in window (GET CURSOR ) SY-CPAGE 1st displayed page of displayed list SY-STARO 1st displayed line of this page of displayed list SY-STACO 1st displayed column of displayed list (SCROLL LIST )
The system field SY-LSIND defines the line selection level (basic list: SY-LSIND = 0).

Example

DATA TEXT(20). START-OF-SELECTION. PERFORM WRITE_AND_HIDE USING SPACE SPACE. AT LINE-SELECTION. CASE TEXT. WHEN 'List index'. PERFORM WRITE_AND_HIDE USING 'X' SPACE. WHEN 'User command'. PERFORM WRITE_AND_HIDE USING SPACE 'X'. WHEN OTHERS. SUBTRACT 2 FROM SY-LSIND. PERFORM WRITE_AND_HIDE USING SPACE SPACE. ENDCASE. CLEAR TEXT. FORM WRITE_AND_HIDE USING P_FLAG_LSIND P_FLAG_UCOMM. WRITE / 'SY-LSIND:'. PERFORM WRITE_WITH_COLOR USING SY-LSIND P_FLAG_LSIND. TEXT = 'List index'. HIDE TEXT. WRITE / 'SY-UCOMM:'. PERFORM WRITE_WITH_COLOR USING SY-UCOMM P_FLAG_UCOMM. TEXT = 'User command'. HIDE TEXT. IF SY-LSIND > 0. WRITE / 'PICK here to go back one list level'. ENDIF. ENDFORM. FORM WRITE_WITH_COLOR USING P_VALUE P_FLAG_POSITIVE. IF P_FLAG_POSITIVE = SPACE. WRITE P_VALUE COLOR COL_NORMAL. ELSE. WRITE P_VALUE COLOR COL_POSITIVE. ENDIF. ENDFORM.

Depending on whether you choose the line at SY-LSIND or SY-UCOMM , the next details list contains the corresponding value with the color "positive". If the line is chosen without HIDE information, the list level is reduced.

Variant 2

AT USER-COMMAND.

Effect

Event in interactive reporting

This event is executed whenever the user presses a function key in the list or makes an entry in the command field .

Some functions are executed directly by the system and thus cannot be processed by programs. These include:
PICK See variant AT LINE-SELECTION PFn See variant AT PFn /... System command %... System command PRI Print BACK Back RW Cancel P... Scroll function (e.g.: P+ , P- , PP+3 , PS-- etc.)
Instead of this functions, you can use the SCROLL statement in programs.
Since many of these system functions begin with "P", you should avoid using this letter to start your own function codes.
Otherwise, the effect is as for AT LINE-SELECTION ; also, the current function code is stored in the system field SY-UCOMM .

Example

DATA: NUMBER1 TYPE I VALUE 20, NUMBER2 TYPE I VALUE 5, RESULT TYPE I. START-OF-SELECTION. WRITE: / NUMBER1, '?', NUMBER2. AT USER-COMMAND. CASE SY-UCOMM. WHEN 'ADD'. RESULT = NUMBER1 + NUMBER2. WHEN 'SUBT'. RESULT = NUMBER1 - NUMBER2. WHEN 'MULT'. RESULT = NUMBER1 * NUMBER2. WHEN 'DIVI'. RESULT = NUMBER1 / NUMBER2. WHEN OTHERS. WRITE 'Unknown function code'. EXIT. ENDCASE. WRITE: / 'Result:', RESULT.

After entry of a function code, the appropriate processing is performed under the event AT USER-COMMAND and the result is displayed in the details list.

Variant 3

AT PFn.

Effect

Event in interactive reporting

Here, n stands for a numeric value between 0 and 99.
This event is executed whenever the user presses a function key that contains the function code PFn in the interface definition. The default status for lists contains some of these functions.

Otherwise, the effect is as for the variant AT LINE-SELECTION . The cursor can be on any line.

Notes

To ensure that the chosen function is executed only for valid lines, you can check the current HIDE information. This variant should be used only for test or prototyping purposes, since the default status is not normally used. Instead, you should set a program-specific status with SET PF-STATUS . This should not contain any function codes beginning with " PF ".

Example

DATA NUMBER LIKE SY-INDEX. START-OF-SELECTION. DO 9 TIMES. WRITE: / 'Row', (2) SY-INDEX. NUMBER = SY-INDEX. HIDE NUMBER. ENDDO. AT PF8. CHECK NOT NUMBER IS INITIAL. WRITE: / 'Cursor was in row', (2) NUMBER. CLEAR NUMBER.


Index
© SAP AG 1996
НОВОСТИ ФОРУМА

Форум Рыцари теории эфира


Рыцари теории эфира
 10.11.2021 - 12:37: ПЕРСОНАЛИИ - Personalias -> WHO IS WHO - КТО ЕСТЬ КТО - Карим_Хайдаров.
10.11.2021 - 12:36: СОВЕСТЬ - Conscience -> РАСЧЕЛОВЕЧИВАНИЕ ЧЕЛОВЕКА. КОМУ ЭТО НАДО? - Карим_Хайдаров.
10.11.2021 - 12:36: ВОСПИТАНИЕ, ПРОСВЕЩЕНИЕ, ОБРАЗОВАНИЕ - Upbringing, Inlightening, Education -> Просвещение от д.м.н. Александра Алексеевича Редько - Карим_Хайдаров.
10.11.2021 - 12:35: ЭКОЛОГИЯ - Ecology -> Биологическая безопасность населения - Карим_Хайдаров.
10.11.2021 - 12:34: ВОЙНА, ПОЛИТИКА И НАУКА - War, Politics and Science -> Проблема государственного терроризма - Карим_Хайдаров.
10.11.2021 - 12:34: ВОЙНА, ПОЛИТИКА И НАУКА - War, Politics and Science -> ПРАВОСУДИЯ.НЕТ - Карим_Хайдаров.
10.11.2021 - 12:34: ВОСПИТАНИЕ, ПРОСВЕЩЕНИЕ, ОБРАЗОВАНИЕ - Upbringing, Inlightening, Education -> Просвещение от Вадима Глогера, США - Карим_Хайдаров.
10.11.2021 - 09:18: НОВЫЕ ТЕХНОЛОГИИ - New Technologies -> Волновая генетика Петра Гаряева, 5G-контроль и управление - Карим_Хайдаров.
10.11.2021 - 09:18: ЭКОЛОГИЯ - Ecology -> ЭКОЛОГИЯ ДЛЯ ВСЕХ - Карим_Хайдаров.
10.11.2021 - 09:16: ЭКОЛОГИЯ - Ecology -> ПРОБЛЕМЫ МЕДИЦИНЫ - Карим_Хайдаров.
10.11.2021 - 09:15: ВОСПИТАНИЕ, ПРОСВЕЩЕНИЕ, ОБРАЗОВАНИЕ - Upbringing, Inlightening, Education -> Просвещение от Екатерины Коваленко - Карим_Хайдаров.
10.11.2021 - 09:13: ВОСПИТАНИЕ, ПРОСВЕЩЕНИЕ, ОБРАЗОВАНИЕ - Upbringing, Inlightening, Education -> Просвещение от Вильгельма Варкентина - Карим_Хайдаров.
Bourabai Research - Технологии XXI века Bourabai Research Institution