‎2008 May 22 5:07 AM
What r the names of global internal tables and work area that r used to specify the sort criteria 4 columns i n ALVs?
‎2008 May 22 5:18 AM
Hi,
Declaration:
data : ig_sort type slis_t_sortinfo_alv,
wg_sort type slis_sortinfo_alv.
Specify the column to be sorted:
wg_sort-fieldname = 'MAKTX'.
wg_sort-tabname = 'MAKT'.
append wg_sort to ig_sort.
Give the internal name in ALV GRID DISPLAY
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
...............
............
.............
...........
.
......
...
.
.
.
.
IT_SORT = IG_SORT
........
...........
.........
.
.
.
.
..
Regards,
Raghu
‎2008 May 22 5:10 AM
Hi,
In Detail:
Sorting by Columns
Use
You are able to change the sequence of data records according to specific rules by sorting the ALV output. You specify which column includes the value that is to be sorted alphabetically or numerically, determining the sequence of all rows.
You are able to specify up to nine columns that can be used to sort the ALV output.
Control Level
Data records have the same value in a sorted column for a control level. If this value changes in regard to the next data record, it is called a control level change.
You have various options to highlight a control level change.
Integration
The sort settings for a column are represented by an object of type CL_SALV_SORT. The total of all the sort objects is represented by an object of type CL_SALV_SORTS.
You are able to make calculations using the values of numeric columns. By default all values of a column are used for this. If you need intermediate results in addition to the overall result of the calculation, the rows that contain the subvalues of an intermediate result need to be next to each other: They sort the ALV output. The sort is then a prerequisite for ALV being able to determine and display intermediate results.
Declaration:
data : ig_sort type slis_t_sortinfo_alv,
wg_sort type slis_sortinfo_alv.
Specify the column to be sorted:
wg_sort-fieldname = 'MAKTX'.
wg_sort-tabname = 'MAKT'.
append wg_sort to ig_sort.
Give the internal name in ALV GRID DISPLAY
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
IT_SORT = IG_SORT
Features
You are able to make the following settings for sorting:
· Get sort objects
· Create and delete sort objects
· Set sort direction
· Set column sequence of sorting
· Forbid changes
· Highlight control level change
For all of the following functions, this is valid:
Display type
ALV Tool
Classic ABAP list
Full screen
In the Container
Simple, two-dimensional table
Yes
Yes
Yes
Hierarchical-sequential list
Yes
Tree structure
No
No
Get Sort Objects
In every main ALV class where sorting is possible, the GET_SORTS method exists. This method returns the sort objects for all columns in the ALV output (class CL_SALV_SORTS). Using this object with the methods GET or GET_SORT you get the sort object for the desired column.
Methods
Function
Class
Method
Get SORTS object
CL_SALV_TABLE
CL_SALV_HIERSEQ_TABLE
GET_SORTS
Get all sort objects
CL_SALV_SORTS
GET
Get all sort objects for a hierarchy level
CL_SALV_HIERSEQ_LEVEL
GET_SORTS
Get a specific sort object
CL_SALV_SORTS
GET_SORT
Check whether a column is sorted (a sort object exists)
IS_SORT_DEFINED
Create and Delete Sort Objects
You are able to create a maximum of one sort object for a column You are able to sort the ALV output using up to nine columns.
You are able to delete sort objects either individually or all at once.
Methods
Function
Class
Method
Create sort object
CL_SALV_SORTS
ADD_SORT
Delete individual sort object
REMOVE_SORT
Delete all sort objects
CLEAR
If you assign a new data table with a new structure to your ALV output, all aggregation objects will be deleted automatically.
Set Sort Direction
For each individual sort object, you are able to determine whether you want to sort the column ascending (for example a, b, c) or descending (for example c, b, a): You set the sort direction.
Methods
Function
Class
Method
Set sort Direction
CL_SALV_SORTS
ADD_SORT (Parameter SEQUENCE)
CL_SALV_SORT
SET_SEQUENCE
Get sort direction
CL_SALV_SORT
GET_SEQUENCE
Set Column Sequence of Sorting
If you sort the ALV output by multiple columns, the result changes depending on the sequence of columns that is used to sort.
By default, the columns are sorted in the sequence in which you generated your sort objects. You are able to change this sequence.
Methods
Function
Class
Method
Change column sequence of sorting
CL_SALV_SORTS
ADD_SORT (Parameter POSITION)
SET_POSITION
Forbid Changes
By default, the user can change sort settings that you have specified using the application. However, you are able to expressly forbid this.
Methods
Function
Class
Method
Forbid changes to sort object
CL_SALV_SORTS
ADD_SORT
(Parameter OBLIGATORY)
CL_SALV_SORT
SET_OBLIGATORY
Check whether user is able to make changes to the sort object
CL_SALV_SORT
IS_OBLIGATORY
Highlight Control Level Change
If a value changes in a sorted column between two data records, this is called a control level change. You are able to highlight the control level change in two ways:
· You separate the group levels with a horizontal line.
· You start a new page for each control level.
Prerequisite
· You have activated grouping of the ALV output.
Methods
Function
Class
Method
Activate grouping of the ALV output
CL_SALV_SORTS
SET_GROUP_ACTIVE
Check whether grouping of the ALV output has been activated.
IS_GROUP_ACTIVE
Set display of control level change
ADD_SORT (Parameter GROUP)
CL_SALV_SORT
SET_GROUP
Get display of the control level change
GET_GROUP
For more details,
http://help.sap.com/saphelp_nw04/helpdata/en/e9/e5eb40c4f8712ae10000000a155106/content.htm
http://sap.niraj.tripod.com/id64.html
http://www.erpgenie.com/sapgenie/docs/Using%20ALV.pdf
Regards,
Jagadish.
‎2008 May 22 5:18 AM
Hi,
Declaration:
data : ig_sort type slis_t_sortinfo_alv,
wg_sort type slis_sortinfo_alv.
Specify the column to be sorted:
wg_sort-fieldname = 'MAKTX'.
wg_sort-tabname = 'MAKT'.
append wg_sort to ig_sort.
Give the internal name in ALV GRID DISPLAY
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
...............
............
.............
...........
.
......
...
.
.
.
.
IT_SORT = IG_SORT
........
...........
.........
.
.
.
.
..
Regards,
Raghu