Thursday, September 11, 2008

Table as Hierarchy in SAP Netweaver

You can display the ALV output as a hierarchy. To do this, you proceed as follows:

Specify hierarchy column

You specify one or more columns as hierarchy columns.

Specify display type

You define the ALV output as a hierarchy.

You can also specify that all hierarchy levels are to be expanded. By default, only the rows of the upper hierarchy level are visible when the ALV output is displayed.

Hierarchy

Displaying the ALV output as a hierarchy has the following effects on the columns:

The ALV output is automatically sorted according to all hierarchy columns.

By default, the sort sequence (and therefore the sequence of the hierarchy levels) is determined by the sequence of the column objects. You can change the sequence of the hierarchy levels in various ways:

You change the position of the (hierarchy) columns

You change the sequence used to sort the fields of the hierarchy columns

The columns that you defined as hierarchy columns are not displayed in the usual form. Instead, all values of all hierarchy columns are displayed together in the first column. The value is indented according to the hierarchy level to which it belongs.

The values in the first column of a hierarchy have a small arrow icon. The user can use this arrow icon to show or hide all lower-level data records.

You can specify that the data for the last hierarchy column is not to be displayed as a node with an arrow icon, but as a leaf with a point.

By default, only the rows of the upper hierarchy levels are displayed. The lower hierarchy levels are not expanded and are therefore not displayed.

The first column of a hierarchy is not an object instance of class CL_SALV_WD_COLUMN.

In the column header for this column, the column headers for each of the hierarchy columns are listed together.

Hierarchy columns or their values (since the columns themselves are not displayed) cannot be hidden.

The Settings dialog box displays hierarchy columns in green on the Column Selection tab page. The user cannot transfer them to the list of hidden columns.

Specifying the Hierarchy Column

To define a column as a hierarchy column, you use the methods of interface class IF_SALV_WD_COLUMN_HIERARCHY (implementing class CL_SALV_WD_COLUMN).

Methods for Defining Hierarchy Columns

Function

Method

Specify hierarchy column

SET_HIERARCHY_COLUMN

Check whether a column is a hierarchy column

IS_HIERARCHIY_COLUMN

Specifying the Display Type

To define your ALV output as a hierarchy and thereby define the type of display, you use the methods of interface class IF_SALV_WD_TABLE_SETTINGS (implementing class CL_SALV_WD_CONFIG_TABLE).

Methods for Specifying the Display Type

Function

Method

Specify display type

SET_DISPLAY_TYPE

Get display type

GET_DISPLAY_TYPE

Expanding Lower Hierarchy Levels

For the hierarchy display, ALV has to load all data when output is first displayed. Large amounts of data can result in long load times. By default, only the rows of the upper hierarchy level are displayed. The lower hierarchy levels are not expanded and are therefore not displayed.

You can also specify that all hierarchy levels are to be expanded. To do this, you use the methods of interface class IF_SALV_WD_TABLE_HIERARCHY (implementing class CL_SALV_WD_CONFIG_TABLE).

Methods for Initial Display of all Hierarchy Levels

Function

Method

Expand all hierarchy levels

SET_EXPANDED

Check whether all hierarchy levels are to be expanded

IS_EXPANDED

Displaying Data of the Last Hierarchy Column as a Leaf

To display the data of the last hierarchy column in the first column of the hierarchy as a leaf, you use the methods of interface class IF_SALV_WD_TABLE_HIERARCHY (implementing class CL_SALV_WD_CONFIG_TABLE).

Methods for Displaying Data as a Leaf

Function

Method

Display data of the last hierarchy column as a leaf

SET_LAST_HIER_COLUMN_AS_LEAF

Check whether the data of the last hierarchy column is displayed as a leaf

IS_LAST_HIER_COLUMN_AS_LEAF

No comments: