Thursday, September 11, 2008

SAP Appearance of ALV Output in SAP Netweaver

Substitute Text for Empty Output in SAP Netweaver

If no data is available, you can specify a text that is displayed in the area of the ALV output.

To display the substitute text, the number of visible rows has to be set to -1 (see Size of ALV Output, Columns, and Cells, under Changing the Height).

To display the substitute text for empty ALV output, use the methods of the interface class IF_SALV_WD_TABLE_SETTINGS (implementing class CL_SALV_WD_CONFIG_TABLE):

Methods for Displaying Substitute Text for Empty ALV Output

Function

Method

Specify substitute text

SET_EMPTY_TABLE_TEXT

Get substitute text

GET_EMPTY_TABLE_TEXT

Table Data as Business Graphic in SAP Netweaver

You can display the data from ALV output as a business graphic. You can make the following settings for business graphics:

Display business graphic

Specify data use

Change appearance of business graphic

Allow or disallow display as business graphic

If you allow users to display data as business graphic, they can select from a range of chart types. Most users select the vertical bar chart or bar chart to display the data from the ALV output.

Displaying Business Graphics

You can specify whether a business graphic is to be displayed when the ALV output is first displayed. You can choose from the following variants:

Display as table only

Display as table and business graphic

Display as business graphic only

To do this, you use the methods of interface class IF_SALV_WD_TABLE_SETTINGS (implementing class CL_SALV_WD_CONFIG_TABLE):

Methods for Displaying Data as Business Graphic

Function

Method

Specify type of display

SET_DISPLAY_AS

Get type of display

GET_DISPLAY_AS

Specifying Data Use

The data displayed in the business graphic depends primarily on whether and in which columns you make calculations:

If you do not make any calculations:

The first column with an alphanumeric data type is used for the axis that contains the characteristics of the chart.

In vertical bar charts, this is usually the X axis; in bar charts, this is usually the Y axis.

The first column with a numeric data type is used for the axis that contains the key figures of the chart.

In vertical bar charts, this is usually the Y axis; in bar charts, this is usually the X axis.

For example, the first column with an alphanumeric data type is the Airlines column, which contains names of the airlines. The first column with a numeric data is the Occupied column, which contains the number of occupied seats for each flight.

The business graphic is a vertical bar chart.

A column containing the name of the airline is displayed for each data record. The value in the Occupied column determines the height of each column in the chart.

The user may not want to display each data record as a separate column. In the above example, the user may want the business graphic to display one column for each airline. You can achieve this, for example, by generating intermediate results in the Occupied column using the Airlines column. This produces a figure that is displayed in a single column in the chart.

If you make calculations:

The first column with an alphanumeric data type is used for the axis that contains the characteristics of the chart.

Each column that involves a calculation is displayed in the axis that contains the key figures for the chart.

If you generate intermediate results:

Each column that is a criterion for intermediate results is displayed in the axis that contains the characteristics for the chart. If you specified more than one criterion, the combination of the criteria is displayed.

Each column that involves a calculation is displayed in the axis that contains the key figures for the chart.

You specify which data is to be displayed in the business graphic by moving the relevant column in the ALV output to the left, or by making calculations in the column. You cannot influence the content of the business graphic.

See also:

Position of Columns

Calculation (Aggregation)

Intermediate Results

Changing the Appearance of the Business Graphic

You can determine the appearance of a business graphic by:

Specifying dimensions of the business graphic

Specifying the chart type

Specifying the size of the business graphic

Dimensions

You can set the following dimensions for your business graphic:

2D

The display is two-dimensional.

In vertical bar charts, the columns are displayed next to one another; in bar charts, they are displayed above one another.

This graphic is explained in the accompanying text

Pseudo 3D

The display is three-dimensional.

In vertical bar charts, the columns are displayed next to one another; in bar charts, they are displayed above one another.

This graphic is explained in the accompanying text

3D

The display is three-dimensional.

In vertical bar charts and bar charts, the columns and bars for each of the characteristics are displayed behind one another.

This graphic is explained in the accompanying text

Chart Type

You can choose from the following chart types:

Area chart

Bar chart

Vertical bar chart

Doughnut chart

Line chart

Pie chart

Split pie chart

Stacked area chart

Stacked bar chart

Stacked vertical bar chart

Stacked line chart

For more information, see Structure linkBusinessGraphics Properties.

To change the appearance of a business graphic, use the methods of interface class IF_SALV_WD_GRAPHIC_SETTINGS (implementing class CL_SALV_WD_COLUMN).

Methods for the Appearance of the Business Graphic

Function

Method

Specify dimensions of business graphic

SET_DIMENSION

Get dimensions of business graphic

GET_DIMENSION

Specify height of business graphic

SET_HEIGHT

Get height of business graphic

GET_HEIGHT

Specify chart type

SET_TYPE

Get chart type

GET_TYPE

Specify width of business graphic

SET_WIDTH

Get width of business graphic

GET_WIDTH

Allowing or Disallowing Display as Business Graphic

By default, users are permitted to display data from ALV output as business graphic. Using a dropdown list box in the toolbar, users can select from the following options:

Display as table only

Display as table and business graphic

Display as business graphic only

You can disallow users to display data as business graphic. To do this, you use the methods of interface class IF_SALV_WD_STD_FUNCTIONS (implementing class CL_SALV_WD_CONFIG_TABLE).

Methods for Allowing Display of the Business Graphic

Function

Method

Allow display as business graphic

SET_DISPLAY_AS_ALLOWED

Check whether display as business graphic is allowed

IS_DISPLAY_AS_ALLOWED

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

Lines Between Columns and Rows in SAP Netweaver

You can define whether lines between columns and rows are to be shown or hidden in the ALV output. You can choose between the following variants:

· Only show lines between columns

· Only show lines between rows

· Show lines between columns and rows

· No lines

You use the methods of the interface class IF_SALV_WD_TABLE_SETTINGS for this (implementing class CL_SALV_WD_CONFIG_TABLE).

Methods for Showing Grid Net Lines

Function

Method

Show or hide lines

SET_GRID_MODE

Check which lines are shown

GET_GRID_MODE

SAP Text Properties in SAP Netweaver

You can specify how text is displayed in individual areas of the ALV output as follows:

Horizontal alignment within a column

Horizontal alignment within a cell variant

Font size and style in a cell

This function is only available in the cell editor TEXT_VIEW. Here, you can choose the preconfigured formatting that you want to use (seeDesign in Structure linkTextView Properties).

You can also set the read direction here.

Line break in a cell

This function is only available in the cell editors TEXT_VIEW, LINK_TO_ACTION, and LINK_TO_URL. If the text contains characters that permit a line break (such as spaces and hyphens), the text can be distributed across multiple lines.

For more information about how to permit line breaks in column headers, see Column Headers.

Font color in a cell (see Color of ALV Output, Columns, and Cells)

Alignment, font size, and font style in a design object for the header or footer area (see Design Object Settings)

Methods for Text Properties

Function

Class

Method

Horizontal alignment within a column

CL_SALV_WD_
COLUMN

SET_H_ALIGN

GET_H_ALIGN

Horizontal alignment within a cell variant

CL_SALV_WD_
CV_STANDARD

SET_H_ALIGN

GET_H_ALIGN

Font size and style in a cell

CL_SALV_WD_
UIE_TEXT_VIEW

SET_DESIGN or
SET_DESIGN_FIELDNAME

GET_DESIGN or
GET_DESIGN_FIELDNAME

Line break in a cell

CL_SALV_WD_
UIE_TEXT_VIEW

CL_SALV_WD_
UIE_LINK_TO_ACTION

CL_SALV_WD_
UIE_LINK_TO_URL

SET_WRAPPING or
SET_WRAPPING_FIELDNAME

GET_WRAPPING or
GET_WRAPPING_FIELDNAME

Color of ALV Output, Columns, and Cells in SAP Netweaver

You can specify the color of various areas of the ALV output. The following options are available:

ALV output:

You can choose between two variants:

Standard Color Assignment

All rows and columns have the same color.

Alternating

The rows of the ALV output alternate between light and dark

Transparent

The background is transparent. The individual cells are displayed without gridlines.

Note

You only have these options if write-protection is switched on (see Write-Protection and Activation).

Column

You can change the background color of a column. You can use pre-configured semantic colors for this (see Structure linkTableColumn Properties).

Note

You only have these options if write-protection is switched on (see Write-Protection and Activation).

Cell variant

You can specify a background color for a cell variant. You can use pre-configured semantic colors for this (see Structure linkTableColumn Properties).

Note

You only have these options if write-protection is switched on (see Write-Protection and Activation).

Cell

The only UI element whose color you can change is the cell editor TEXT_VIEW. You can choose the combination of background and text color that you want to use (see Structure linkTextView Properties, under SemanticColor).

Note

You also have this option in the editable ALV.

Methods for Changing the Colors

Area

Class

Method

ALV output

IF_SALV_WD_
TABLE_SETTINGS

SET_DESIGN

GET_DESIGN

Column

CL_SALV_WD_
COLUMN

SET_CELL_DESIGN

GET_CELL_DESIGN

Cell variant

CL_SALV_WD_
CV_STANDARD

SET_CELL_DESIGN or
SET_CELL_DESIGN_FIELDNAME

GET_CELL_DESIGN or
GET_CELL_DESIGN_FIELDNAME

Cell

CL_SALV_WD_
UIE_TEXT_VIEW

SET_SEMANTIC_COLOR or
SET_SEMANTIC_COLOR_FIELDNAME

GET_SEMANTIC_COLOR or
GET_ SEMANTIC_COLOR_FIELDNAME

SAP Visibility of Individual Areas in SAP Netweaver

You can show or hide the different areas of the ALV output.


If an area is in an invisible area, the area is also invisible.

You can show and hide the following areas individually:

Entire ALV output

Individual column

Every UI element used as a cell editor or cell variant

Entire toolbar with all functions

Individual UI elements of standard ALV functions in the toolbar

Design object for the header area of the ALV output

Design object for the footer area of the ALV output


To hide another object, such as the header of the ALV output or a column header, you have to delete the relevant object.

Classes and Methods for Hiding Areas

Area

Class

Method

Entire ALV output

IF_SALV_WD_
TABLE_SETTINGS

SET_VISIBLE

GET_VISIBLE

Individual column

CL_SALV_WD_
COLUMN

Every UI element used as a cell editor or cell variant

CL_SALV_WD_UIE
(base class of all UI elements)

Entire toolbar with all functions

IF_SALV_WD_
FUNCTION_SETTINGS

Design object for the header area of the ALV output

IF_SALV_WD_
TABLE_SETTINGS

SET_TOP_OF_LIST_

VISIBLE

Design object for the footer area of the ALV output

IF_SALV_WD_
TABLE_SETTINGS

SET_END_OF_LIST_

VISIBLE

Individual UI elements of standard ALV functions in the toolbar

IF_SALV_WD_
STD_FUNCTIONS

SET__
ALLOWED

IS__
ALLOWED

SAP Size of ALV Output, Columns, and Cells in SAP Netweaver

By default, the size of the ALV output, columns, and rows depends on their content. This means:

A column is at least as wide as its widest cell.

The ALV output is at least as wide as all its columns together.

A row is at least as high as its highest cell.

You can easily increase the width of the ALV output and columns by specifying the required width. Decrease the width, however, is not as easy. First of all, you freeze the layout of the ALV output. This assigns the same width to all columns. You can then specify the required width for each column. You can make the following settings for the size of the individual areas:

Change the width

Change the height


You can only control the height of the rows using their content (for example, using the graphic size or multiline text).

Freeze the table layout

Changing the Width

To change the width of an area, you use the methods of the classes for the areas.

Methods for Changing the Width

Function

Class

Method

Specify width of ALV output

IF_SALV_WD_TABLE_SETTINGS

SET_WIDTH

Specify width of column

CL_SALV_WD_COLUMN

Specify width of business graphic

IF_SALV_WD_GRAPHIC_SETTINGS

Specify width of cell

Only with the following cell editors:

SET_WIDTH or SET_WIDTH_FIELDNAME

Button

CL_SALV_WD_UIE_BUTTON

Dropdown list box

CL_SALV_WD_UIE_DROPDOWN_

BY_KEY

Image

CL_SALV_WD_UIE_IMAGE

InputField

CL_SALV_WD_UIE_INPUT_FIELD

ProgressIndicator

CL_SALV_WD_UIE_PROGR_

INDICATOR

ToggleButton

CL_SALV_WD_UIE_TOGGLE_

BUTTON

ValueComparison

CL_SALV_WD_UIE_VALUE_CMP

Get width of ALV output

IF_SALV_WD_TABLE_SETTINGS

GET_WIDTH

Get width of column

CL_SALV_WD_COLUMN

Get width of business graphic

IF_SALV_WD_GRAPHIC_SETTINGS

Get width of cell (only with cell editors listed above)

GET_WIDTH or GET_WIDTH_FIELDNAME

Changing the Height

You specify the height of the ALV output using the number of rows that are to be displayed at a time.


If the number of data records is less than the number of visible rows, empty rows are automatically appended to the end of the ALV output. You can specify that no empty rows are to be appended and that the height of the ALV output therefore adjusts itself according to the number of data records.

To do this, you use the methods of interface class IF_SALV_WD_TABLE_SETTINGS (implementing class CL_SALV_WD_CONFIG_TABLE).

Methods for Changing the Height

Function

Method

Specify number of visible rows

SET_VISIBLE_ROW_COUNT

Get number of visible rows

GET_VISIBLE_ROW_COUNT

Append empty rows

SET_DISPLAY_EMPTY_ROWS

Check whether empty rows are appended

GET_DISPLAY_EMPTY_ROWS


To display all data records of the internal data table, set the number of visible rows to -1.

Freezing the Table Layout

Freezing the layout of the ALV output can be used to make columns narrower than their content dictates.

To do this, you use the methods of interface class IF_SALV_WD_TABLE_SETTINGS (implementing class CL_SALV_WD_CONFIG_TABLE).

Methods for Freezing the Table Layout

Function

Method

Freeze the table layout

SET_FIXED_TABLE_LAYOUT

Check whether table layout is frozen

GET_FIXED_TABLE_LAYOUT