Saturday, October 11, 2008

SAP Position of Columns

By default, all columns are arranged in the same order as the attributes in the context node of your application. You can change the order of columns. You can do this in the following ways:

By changing the position number

By fixing columns

You can also specify whether the user is allowed to fix columns.

For information on the sequence of hierarchy columns, see Table as Hierarchy.

Changing the Position Number

Every column is automatically assigned the position number 0 initially. You can change the position of a column by changing this position number. The position number does not have to be unique.


Columns with the position number 0 are always left-justified. This means that if you want to align a column to the left, you must give all other columns a higher position number the column in question.

You can also use negative numbers as position numbers. This means that you can give a single column an appropriate position number without changing the 0 of all the other columns.

To change the position number of a column, you use the methods of class CL_SALV_WD_COLUMN.

Methods for Changing the Position Number

Function

Method

Set position number

SET_POSITION

Get position number

GET_POSITION

Fixing a Column

You can fix columns. This has the following effects:

You move the column in question to the edge of the ALV output.

The column can then no longer be moved when scrolling sideways with the horizontal paginators.

When fixing a column, you specify whether the column is to be fixed to the left-hand side or the right-hand side of the ALV output.

In this way, you can create up to three blocks of columns:

The columns fixed to left, the columns that are not fixed, and the columns fixed to right.

You can also change the position number of a column to fix its position (see above). This allows you to arrange all columns of a block according to their position numbers.

To fix columns, you use the methods of class CL_SALV_WD_COLUMN.

Methods for Fixing Columns

Function

Method

Fix column

SET_FIXED_POSITION

Check whether a column is fixed and where it is fixed

GET_FIXED_POSITION

Allowing the Fixing of Columns

You can specify whether the user is allowed to fix individual columns. You specify this separately for fixing to the right edge or to the left edge. In the Settings dialog box, a UI element is displayed by means of which the user can specify the number of fixed columns.

To allow the fixing of columns, you use the methods of interface class IF_SALV_WD_STD_FUNCTIONS (implementing class CL_SALV_WD_TABLE):

Methods for Allowing the Fixing of Columns

Function

Method

Allow the fixing of columns to the left edge of the ALV output

SET_FIXED_COLS_LEFT_ALLOWED

Check whether the user is allowed to fix columns to the left edge of the ALV output

IS_FIXED_COLS_LEFT_ALLOWED

Allow the fixing of columns to the right edge of the ALV output

SET_FIXED_COLS_RIGHT_ALLOWED

Check whether the user is allowed to fix columns to the right edge of the ALV output

IS_FIXED_COLS_RIGHT_ALLOWED

No comments:

Archive