SAP ABAP Syntax for Describe part five

This post is in continuation with SAP ABAP SYNTAX FOR DESCRIBE PART FOUR.

Variant 2

DESCRIBE LIST NUMBER OF PAGES n.

Addition

... INDEX idx

Effect

Returns the number of pages 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 pages in the displayed list:
 
DATA: PN LIKE SY-PAGNO. ...
 
AT LINE-SELECTION.
  DESCRIBE LIST NUMBER OF PAGES PN.

The variable PN now contains the number of pages in the displayed list (i.e. the contents of the system field SY-PAGNO after the list has been generated!).

Variant 3

DESCRIBE LIST LINE lin PAGE pag.

Addition

... INDEX idx

Effect

Returns the number of the page for the line lin in the list.

Note

In interactive reporting, line selection causes a value to be assigned to the system field SY-LILLI (absolute number of selected list line). The system field SY-CPAGE contains the page number for the first displayed line in the list. The selected line does not have to belong to this page (in cases where several pages are displayed at the same time). The page number may be of interest even with direct reading of lines .

SY-SUBRC = 0 OK
SY_SUBRC = 4 Line does not exist
SY-SUBRC = 8 List does not exist

Addition

... INDEX idx

Effect

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

Example

After line selection, determine the page number for the selected line (SY-LILLI) :
 
DATA: PAGENUMBER LIKE SY-PAGNO. ...
 
AT LINE-SELECTION.
  DESCRIBE LIST LINE SY-LILLI PAGE PAGENUMBER.

The variable PAGENUMBER now contains the page number for the line SY-LILLI (i.e. the contents of the system field SY-PAGNO when outputting the line SY-LILLI !).

No comments :

Post a Comment