Hi,
Check the below code, Here we are sorting based on last changed time.
Data : lr_copy TYPE REF TO if_bol_bo_col.
CONSTANTS : lc_lastchange_time type NAME_KOMP value 'LASTCHANGETIME'.
lr_copy ?= me->typed_context->builheader->collection_wrapper->get_copy( ).
IF lr_copy IS BOUND.
* Sort collection by Date and time
CALL METHOD lr_copy->sort
EXPORTING
iv_attr_name = lc_lastchange_time
iv_sort_order = cl_bsp_wd_collection_wrapper=>sort_descending.
* Clear and set the collection
me->typed_context->builheader->collection_wrapper->clear_collection( ).
me->typed_context->builheader->collection_wrapper->set_collection( lr_copy ).
ENDIF.
Cheers!!!
Sugan