List Programming

Reporting is one of main goals of an SAP system. ABAP provides many ways for this reporting mechanism. ALV is the most popular and powerfool platform for reporting but it will be discussed later. On the other hand ABAP Lists are the earlier tool of SAP for reporting.As classic lists are no longer intended for direct use in production programs, SAP recommends that you use other suitable output media instead. Therefore i will refer the most crucial parts of List Programming.

ABAP provides WRITE keyword and many other commands like ULINE,SKIP,NEW-PAGE etc. WRITE statement has many additions which provides output to be formatted according to your needs. Here i will mention most used variations and present examples for just these variants.

List processing is activated either activated by SUBMIT(direct call of ABAP Report) or LEAVE TO LIST-PROCESSING command from another dialog screen.
  1. WRITE statement with format options
    numbers before text determines offset of the text field
    FORMAT [variants] statement effects next write statement
  2. WRITE statement to create a list with multiple lines
    WRITE UNDER ‘header’ provides a formatted list with each field under the related field
  3. TOP-OF-PAGE, END-OF-PAGE events
    this events helps SAP to generate page according to your definitions (for example  no standard page heading line-count 10)after REPORT statement.
  4. AT LINE-SELECTION event to code callback functionality of line selection
    user interaction is obtained by AT LINE-SELECTION or AT USER-COMMAND events. for AT USER-COMMAND event you have to first define a pf-status whereas AT LINE-SELECTION works with HIDE and GET CURSOR commands.
  5. HIDE command to hold selected line
    thanks to HIDE command , selected values can be reached in at line-selection
  6. GET CURSOR command to hold selected field,value,line etc.
    this command and its variations works in dialog screens as well as list screens. It provides the clicked values to be imported ABAP program fields.
You can examine DEMO_LIST_* examples in SAP Dictionary under SABAPDEMOS package.

Here is a sample code as a start point for ABAP List Programming.