Skip to Content
Author's profile photo Former Member

Sap List Viewer queries using code in the END-OF-SELECTION section

The Problem

Reports and Queries using the “Sap List Viewer” format are a huge improvement from the old “ABAP List” format. Columns can be moved by drag and drop, export options are better, looks are nicer and it has many other advantages.

fig 1.png

The END-OF-SELECTION section is very handy. It runs after the records have been processed by the query but before the report is displayed. It is the right section to do aggregated calculations and actions that can only be done when data from all the selected records has been extracted.

However, there is a problem when queries use code in the END-OF-SELECTION section in combination with the Sap List Viewer format. In short, the code is never reached.

Here is a trick to make the combination work.

The Trick

When defining the query change the output format option to ABAP List. This will trigger the old source code generation that includes the code in the END-OF-SELECTION section.

fig 2.png

Run the query and in the selection screen change the option to SAP List Viewer.

fig 3.png

Save a default variant 


Include any other default values that you may need for the selection fields in the query.

fig 4.png

Change the query and add the default variant as the standard variant of the query.

fig 5.png

In this way, the query is generated internally for an “ABAP List” report and it will include the END-OF-SELECTION code. When the query is executed, the default variant will change the option and the query will display with a flexible “SAP List Viewer” format.


Assigned Tags

      Be the first to leave a comment
      You must be Logged on to comment or reply to a post.