Sorting

Hi ,
I want to show records “Last in first” Format based on Document No in Form 7171. How to sort .