Dynamic SORT of dynamic internal table

Use the following example in your program:

* Dynamically sort data using table key
DATA: ls_sort_key_field TYPE abap_sortorder. 
DATA: lt_sort_key_field TYPE abap_sortorder_tab.

LOOP AT it_key INTO ls_key.
  ls_sort_key_field-name = ls_key-fieldname.
  APPEND ls_sort_key_field TO lt_sort_key_field.
ENDLOOP.

TRY.

  SORT BY (lt_sort_key_field).

   CATCH cx_sy_dyn_table_ill_comp_val.
*    Unable to process dynamic sort 

ENDTRY.

Comments

Add a comment

Your email address will not be published. Required fields are marked *

 

Your personal information will be exclusively used for processing current comment only. Personal data protection policy