SAP NEWS-30-LIST

Get Example source ABAP code based on a different SAP table
  



List Processing in Release 3.0

1 WRITE and ULINE with variable position and length specifications

2 Variable format specifications with FORMAT, WRITE and MODIFY LINE

3 List backup 4 Leave list with return to the selection screen 5 SET CURSOR and GET CURSOR with addition LINE... (without FIELD)

6 Handling of EXIT in list events 7 SET PF-STATUS SPACE activates standard list status 8 Fixed list columns during list display 9 New effect of SKIP at end of page 10 New additions with WRITE [TO] for alignment 11 Help (F1) and Possible entries (F4) now also in ' LIKE' fields

12 GET CURSOR on field symbols and literals 13 System tables %_LIST ... protected against access 14 Symbols in lists 15 Hotspots in lists 16 Display of QUAN fields (WRITE addition UNIT)

ABAP_MODIFICATION_1 WRITE and ULINE with variable position and length specifications

With WRITE and ULINE, you can now use the addition 'AT' which allows dynamic position and/or length specifications.



Example ABAP Coding
DATA: POS TYPE I VALUE 5,
LEN TYPE I VALUE 10,
F(20) VALUE 'Test output'.

WRITE AT /POS(LEN) F.
ULINE AT /POS(LEN).


ABAP_MODIFICATION_2 Variable format specifications with FORMAT , WRITE and MODIFY LINE

With FORMAT, WRITE and MODIFY LINE, you can now use variables to parametrize all format specifications ( INPUT, INTENSIFIED, INVERSE, COLOR). In any of these additions, a '=' is followed by the variable.



Example ABAP Coding
DATA: COL TYPE I,
INT TYPE I,
F(20) VALUE 'Test output'.

IF condition.
INT = 1.
COL = 5.
ENDIF.

WRITE F COLOR = COL INTENSIFIED = INT INPUT ON.
FORMAT COLOR = COL INTENSIFIED = INT.



ABAP_MODIFICATION_3 List backup

You can now save ABAP/4 lists as list objects.
To save the basic list or the details list of the current application, you use the function module 'SAVE_LIST'. This function module returns the desired list as a list object to an internal table of the structure ABAPLIST. Alternatively, SUBMIT ... EXPORTING LIST TO MEMORY allows you to place the basic list of any report, rather than the display, in SAP memory and, after return from the called report, to retrieve it with the function module 'LIST_FROM_MEMORY' as a list object. You can then save the list object like any other internal table (in a database, file system, ...).
For further processing, use the function modules 'WRITE_LIST' (output a list object as a list), 'DISPLAY_LIST' (output a list object in a pop-up) and any existing or planned converters (' LIST_TO_ASCI', 'LIST_TO_RTF', ...).
In SAPoffice, you can save any displayed list in the private folders of the currently logged on user by choosing System >ListSave (SAPoffice). More functions are planned.


ABAP_MODIFICATION_4 Leave list with return to the selection screen

When you leave the list display of a report, you now return to the report selection screen where your previous entries remain displayed. This applies only provided the selection screen has not been suppressed by the request (SUBMIT...VIA SELECTION-SCREEN ). Leaving the list may be triggered by any of the following:

- F3 / Back to the basic list of the report
- F15 / Exit in any list of the report
- The function LEAVE SCREEN in the application program.



Latest notes:For reasons of compatibility, the
LEAVE function does not offer this functionality. Instead, Release 3.0 includes a special variant LEAVE LIST-PROCESSING.


ABAP_MODIFICATION_5 SET CURSOR and GET CURSOR with addition LINE... (without FIELD)

The functions SET CURSOR LINE and GET CURSOR LINE allow you to position the cursor or to determine the cursor position in lists at line level. This is useful in cases where the whole list line - and not the field within the line - is relevant. Previously, the syntax rules required you to use FIELD.



Latest notes:In general, you should use the GET CURSOR LINE l OFFSET
o function if you have to evaluate the absolute cursor position (column) within a list line during an interactive list event. The system field SY-CUCOL refers not to the list line, but to the displayed list section. After horizontal scrolling, the relative cursor position ( SY-CUCOL) and the absolute cursor position differ. Moreover, the system field SY-CUCOL contains the value 2 if (for reasons of compatibility) the cursor is on the first visible list column. The calculation of the absolute position makes this difficult.




Example ABAP Coding
The following example shows how the previous usage of
SY-CUCOL can be replaced by the function GET CURSOR:
DATA: CURSORPOSITION TYPE I,
CURSOROFFSET TYPE I,
CURSORLINE TYPE I.

AT LINE-SELECTION.
CURSORPOSITION = SY-CUCOL - 2 + SY-STACO. 'old

AT LINE-SELECTION.
GET CURSOR LINE CURSORLINE OFFSET CURSOROFFSET. 'new
CURSORPOSITION = CURSOROFFSET + 1. 'new


ABAP_MODIFICATION_6 Handling of EXIT in list events

The EXIT function now has the same effect in all list events ( AT LINE-SELECTION, AT USER-COMMAND, AT PF..., TOP-OF-PAGE ..., END-OF-PAGE ) as in MODULE, FORM and FUNCTION. The event thus ends at once and the processing continues at the call location (e.g. after EXIT from TOP-OF-PAGE, the triggering WRITE statement is executed; after EXIT from AT LINE-SELECTION, the list is immediately displayed). Previously, the list was displayed here in both cases (the triggering WRITE was ignored!) and, if there was also indented list processing ( LEAVE TO LIST-PROCESSING from CALL SCREEN), the entire list processing was terminated.



Latest notes:In report processing (with a logical database), EXIT
from TOP-OF-PAGE and END-OF-PAGE previously terminated processing of the logical database and branched directly to the list display. Now, only the event TOP-OF-PAGE or END-OF-PAGE is terminated. Any remaining logical database events ( START-OF-SELECTION, GET, ...) are not affected by this change.

ABAP_MODIFICATION_7 SET PF-STATUS SPACE activates standard list status

If you want to use a standard list status (STLI, PICK, INLI) in the list processing, but first want a dialog with your own user interface, you can achieve this with SET PF-STATUS SPACE (when creating the list).
Previously, you could only do this by copying the standard list status to your own PF status.

ABAP_MODIFICATION_8 Fixed list columns when displaying a list

SET SCROLL-BOUNDARY allows you to restrict the area of a list page affected by horizontal scrolling. You can use NEW-LINE NO-SCROLLING to flag individual list lines as 'unmovable'.

ABAP_MODIFICATION_9 New effect of SKIP at end of page

Previously, if SKIP occurred at the end of a page and there was a fixed number of lines per page (as defined by NEW-PAGE LINE-COUNT), a new page was started and the blank line was output as the first line of that new page (after TOP-OF-PAGE).
This resulted in unwanted line shifts on a new page, although the only purpose of SKIP was to separate different areas of the list. Therefore, SKIP is no longer executed on the next page unless explicitly requested by NEW-PAGE.

ABAP_MODIFICATION_10 New additions with WRITE [TO] for alignment

WRITE now has the additions LEFT-JUSTIFIED, CENTERED and RIGHT-JUSTIFIED for left-justified, centered or right-justified output. You can use them when outputting to a list and for string processing with WRITE ... TO. In the former case, the alignment refers to the output field in the list. In the latter case, it refers to the target field specified after TO.

ABAP_MODIFICATION_11 Help (F1) and Possible entries (F4 ) now also in 'LIKE' fields

Previously, you could only get field help (F1) and possible entries (F4) for fields which had a direct reference to a data element (usually table fields). In Release 3.0, this is supported for work fields that refer to a table field with DATA ... LIKE. This of course also applies to field symbols and parameters of subroutines.

ABAP_MODIFICATION_12 GET CURSOR on field symbols and literals

The GET CURSOR FIELD function now always returns the name of a 'global symbol', i.e. a field that is still valid when the list is displayed. Names of field symbols and local variables are invalid in this context.
For field symbols and reference parameters of subroutines, the function returns the name of the global symbol that may have been assigned when the list was displayed. With literals, the return code is no longer set to 4, but the field name becomes SPACE and the return code 0. The contents of the literal are returned as ... VALUE.

ABAP_MODIFICATION_13 System tables %_LIST ... protected against access.

Previously, it was possible to address the system tables involved in list processing (%_LIST ...) in all ABAP/4 programs and in debugging. This is no longer supported since the most common reason for wanting to do this - determining the number of lines in a list (with DESCRIBE TABLE %_LIST LINES lin) - can now be achieved with DESCRIBE LIST NUMBER OF LINES lin • SY-LSIND.

ABAP_MODIFICATION_14 Symbols in lists

You can now use WRITE with the addition '...AS SYMBOL' to output certain characters in a list as symbols.



Example ABAP Coding
ABAP Code Snippet
WRITE: / SYM_PHONE AS SYMBOL. 'Output: Telephone symbol

ABAP_MODIFICATION_15 Hotspots in lists

By using the addition '...HOTSPOT' with the FORMAT and WRITE statements, you can now define particular areas in a list as hotspots.
When you click once with the mouse in one of these areas, it is as if you had placed the cursor on the clicked position in the list and then pressed the function key F2 (i.e. like double-clicking, but achieved with a single click).




Example ABAP Coding
DATA F.
FORMAT HOTSPOT.
* or
WRITE: / F HOTSPOT.

ABAP_MODIFICATION_16 Output of QUAN fields (WRITE addition UNIT)

WRITE now has the addition UNIT which allows you to format quantity fields according to a unit. Quantity fields are packed fields and usually have the type QUAN in the ABAP/4 Dictionary. Apart from their defined number of decimal places, you can format them according to the unit specified in UNIT, e.g. for item specifications without fractional portion.