AT Events in lists in abap

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

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.

RELATED POST

SYNTAX FOR CONTROL BREAK IN SAP ABAP

SAP architecture,its full form of working and enjoy sap products
SAP journey from R/3 towards MySAP.com

No comments :

Post a Comment