Skip to Content
0
Dec 07, 2011 at 03:31 PM

ORDER BY from itab fields

21 Views

Hi,

is there a possibility to order data of a select statement by contents of an itab?

The order criteria of the itab are dynamic thus I cannot hard code them.

Example: (lt_order_criteria is actually an imported table)

I basically want to order by iobjnm1 iobjnm2 iobjnm3

append iobjnm1 to lt_order_criteria.

append iobjnm2 to lt_order_criteria.

append iobjnm3 to lt_order_criteria.

SELECT *

FROM dbtab

INTO TABLE itab

ORDER BY lt_order_criteria[1] lt_order_criteria[2] lt_order_criteria[3]

Thanks,

Alex