Hi, Can we sort a result set(table view) with multiple fields at a time.
In General we use a sort statement as:
Sort TTT table by f1 f2 f3.
but, in this table view i'm trying to sort a collection.
me->typed_context->resultnode->collection_wrapper->SORT( iv_attr_name = 'GROWER_NAME' ).
with the above sort, the result set is sorted w.r.t to one field.
Can we sort the collection with multiple fieds at a time.
I tried this, but coudnot get.
Pls provide some pointers on this.
Check this option.
1. Using 'get_propertiesu2019, get required fields information and store it into an internal table. Once all the entities data is stored to internal table, sort the internal table based on required sort order (sort order based on multiple fields). Now the internal table having the data in required sort order.
2. Store the 'collection_wrapper' data into temporary collection and clear the existing data , now loop through the internal table and read the collection using 'IF_BOL_BO_COLFIND' Method , find the object and add it to the collection using 'if_bol_bo_coladd'.
3. Now the data collection will be in required sort order.
I doubt whether the sort method offers such fucntionality.
You can try sth like this as a workaround, though it may not sound wise.
me->typed_context->resultnode->collection_wrapper->SORT( iv_attr_name = ATTR1 ).
Now the collection wrapper is sorted on ATTR1, use the sort method again though this time pass different attribute name.