My solution would be to use a temporary table that can store an integer and all PK fields of your table. Declare it as temp, fill it, sort it and then create a report using an Integer dataitem and using your "buffer" as a source to select the correct record.
Like.
bufferTable.SETCURRENTKEY(some key);
IF intRec.No = 1 THEN
bufferTable.FINDFIRST ELSE
bufferTable.NEXT;
Comments
Like.
bufferTable.SETCURRENTKEY(some key);
IF intRec.No = 1 THEN
bufferTable.FINDFIRST ELSE
bufferTable.NEXT;
MyRealRecord.GET(bufferTableField1,bufferTableField2,...);
...
In the body section print the contents of MyRealRecord.