Sort Datetime Type in SAP ABAP

There are two operation LT (Less than) and GT (Greater Than) which you can use to perform basic comparisons between two variables.

You can frame the logic as per your requirement whether you have a set of variables or a table. If it involves set of variables then you need to do manual comparisons.