*&---------------------------------------------------------------------*
* & Report
* & Author: XiaoYu
*&---------------------------------------------------------------------*
* & Production date: 2009/08/03
* & Summary: At-events in lists
*&---------------------------------------------------------------------*
Report.
*&---------------------------------------------------------------------*
* & At line-selection
*&---------------------------------------------------------------------*
Data Text (20 ).
Start-of-selection.
Perform write_and_hide using 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.
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.
*&---------------------------------------------------------------------*
* & Hide
*&---------------------------------------------------------------------*
Data: Square type I,
Cube type I.
Start-of-selection.
Format hotspot.
Do 10 times.
Square = sy-index ** 2.
Cube = sy-index ** 3.
Write/sy-index.
Hide: Square, cube.
Enddo.
At line-selection.
Write: Square, cube.
*&---------------------------------------------------------------------*
* & At user-command
*&---------------------------------------------------------------------*
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 'mresult '.
Result = number1 * number2.
When 'divi '.
Result = number1/number2.
When others.
Write 'unknown function Code '.
Exit.
Endcase.
Write:/'result: ', result.
*&---------------------------------------------------------------------*
* & At PFN
*&---------------------------------------------------------------------*
Data number type SY-INDEX.
Start-of-selection.
Do 9 times.
Write:/'row', (2) SY-INDEX.
Number = SY-INDEX.
Hide number.
Enddo.
At pf8.
Check number is initial.
Write:/'cursor was in row', (2) number.
Clear number.