SAP ABAP Syntax for Describe part four

DESCRIBE - supply attributes of a list

Variants

1.DESCRIBE LIST NUMBER OF LINES lin.

2. DESCRIBE LIST NUMBER OF PAGES n.

3. DESCRIBE LIST LINE lin PAGE pag.
4. DESCRIBE LIST PAGE pag.

Effect

Returns the attributes of a list. All variants have the addition ... INDEX idx allowing you to determine the attributes of a particular list level ( SY-LSIND = 0,1,2,3,... ).

Note

You should use this key word only in exceptional cases (e.g. when editing an 'anonymous' list in a program other than that which generated the list). In all other cases, you should save the relevant values when you generate the list.
Take care when attempting to retrieve the list attributes being set up ( ...INDEX SY-LSIND ), since some attributes (number of pages, number of lines, ...) may not have been updated yet.

Variant 1

DESCRIBE LIST NUMBER OF LINES lin.

Addition

... INDEX idx

Effect

Returns the number of lines in the list.

The return code value is set as follows:


SY-SUBRC = 0 OK
SY-SUBRC <> 0 List does not exist (only with the addition INDEX )

Addition

... INDEX idx

Effect

Returns the attributes of the list level idx (0, 1,2,3,...).

Example

After line selection, determine the number of lines in the displayed list:
 
DATA: LN LIKE SY-PAGNO. ...
 
AT LINE-SELECTION.
  DESCRIBE LIST NUMBER OF LINES LN.

The variable LN now contains the number of lines in the displayed list.

No comments :

Post a Comment