2005 Oct 12 9:14 AM
Hi,
In ALV reporting in the function
<b>'REUSE-ALV-GRID-DISPLY'</b> for sorting - we 'll pass value to the variable for 'IS_SORT'.
<i>EX:</i>
DATA : LV_S_SORT TYPE SLIS_SORTINFO_ALV,
LV_T_SORT TYPE SLIS_T_SORTINFO_ALV.
CLEAR LV_S_SORT.
<b>LV_S_SORT-SPOS = 1.</b>
LV_S_SORT-FIELDNAME = 'CURRENCY'.
LV_S_SORT-DOWN = 'X'.
LV_S_SORT-SUBTOT = 'X'.
APPEND LV_S_SORT TO LV_T_SORT.
CLEAR LV_S_SORT.
Why value '1' is passed to 'SPOS' and what is its purpose?
2005 Oct 12 9:18 AM
Its definition of sort order .If you want to sort on multiple fields you give SPOS as '1' / '2' and so on. its something similar to -
Sort ITAB by F1 F2 F3 . So F1 will be SPOS = 1, F2 will be SPOS = 2 , and so on.
Cheers
Hi,
In ALV reporting in the function
<b>'REUSE-ALV-GRID-DISPLY'</b> for sorting - we 'll pass value to the variable for 'IS_SORT'.
<i>EX:</i>
DATA : LV_S_SORT TYPE SLIS_SORTINFO_ALV,
LV_T_SORT TYPE SLIS_T_SORTINFO_ALV.
CLEAR LV_S_SORT.
<b>LV_S_SORT-SPOS = 1.</b>
LV_S_SORT-FIELDNAME = 'CURRENCY'.
LV_S_SORT-DOWN = 'X'.
LV_S_SORT-SUBTOT = 'X'.
APPEND LV_S_SORT TO LV_T_SORT.
CLEAR LV_S_SORT.
Why value '1' is passed to 'SPOS' and what is its purpose?
2005 Oct 12 9:18 AM
Its definition of sort order .If you want to sort on multiple fields you give SPOS as '1' / '2' and so on. its something similar to -
Sort ITAB by F1 F2 F3 . So F1 will be SPOS = 1, F2 will be SPOS = 2 , and so on.
Cheers
2005 Oct 12 9:24 AM
Hi,
you use spos if you want to sort order if the list is sorted by multiple columns
Using internal table IT_SORT, the caller determines the sort order and/or the subtotalling of the basic list.
The following fields of this internal table must be filled:
spos
Sort order
fieldname
Field name in the internal output table
up
'X' = Sorted in ascending order
down
'X' = Sorted in descending order
subtot
'X' = Subtotals for control level changes
comp (INTERNAL USE ONLY)
expa
Prequisite:
IT_SORT-SUBTOT = 'X', that is, the sort criterion is also the subtotals criterion.
If no complete breakdown but only a breakdown to totals level n that can be further expanded by the user should be displayed when the list is output for the first time, you must set the indicator for the totals level criterion of level n.
regards,
venu.
2005 Oct 12 10:19 AM
Thats for sorting more then one column. if you wanna sart tow columns you can tell the system it has to sort for column2 if the values fir column 1 are equal, e.g. sort by country and inside the country sort by lastname.
it is not the order the columns are stored in the internal table in which comlums are sorted!
2014 Sep 05 7:35 AM
spos is used to give the sort sequence (if you want to sort more than one colume)
for example: there are 2 colums
sid bid
22 101
22 103
22 104
31 101
31 103
now if you want sorting in such a way that first bid should get sort and then sid then give
for bid spos = 1 and for sid spos = 2
you get o/p as
sid bid
22 101
31 101
22 103
............
observe this first 101 then 103 so fist bid took sid in that
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |