14.01.2020 Views

ABAP_to_the_Future

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

10

ALV SALV Reporting Framework

Each of the methods called in Listing 10.8 are discussed next; you’ll see how

they’re defined in the abstract interface and implemented in the concrete class.

Optimizing the Column Width

The method OPTIMIZE_COLUMN_WIDTHS has no parameters, because what it does is

very straightforward. Ninety-nine times ou t of 100, your report will have columns

such as customer names, and more often than not the longest customer

name in the report will not be long enou gh to fill the entire length of the customer

name field in the data dictionary. To avoid empty space in the report and

to get the maximum number of columns on one screen to prevent the users having

to scroll to the right (they hate doing that), you can tell the view technology to

work out the maximum length needed fo r each column dynamically at runtime

based on the actual contents of the table to be displayed.

Note

There are rare occasions when it’s vital that you maintain total control over how wide

each column is, and in such cases you do not want to call this method.

Setting the Column Attributes

The SET_COLUMN_ATTRIBUTES_METHOD is probably the most commonly used

method for making applicatio n-specific changes; it’s a way to define the special

attributes of the various columns in the internal table to be displayed. As you can

see in Figure 10.7, this consists of a number of optional input parameters that

control the following elements:

왘 The identity of the column in question. Todefine this, you pass in the field (column)

name, which is the name of the field in the internal table structure. You

have to have the table name as an optional parameter as well, because the interface

has to cater to several UI technologies. One of which, CL_GUI_ALV_GRID,

cannot live without the field name—so you have to pander to the lowest common

denominator.

왘 Whether the user can double-click on a column value and trigger an action,

such as viewing the underlying business document (a hotspot).

왘 Whether the column is hidden by default and the user can choose to display it

or whether the column is never to be displayed under any circumstances (socalled

technical columns, which are only used internally by the program).

426

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!