Franz Schubert's Piano Sonata in A-flat major D 557 was composed in May 1817.
The sonata is cheerful and uncomplicated, and carries remembrances of Mozart and the Baroque era.
At the time this was written it was quite unusual to end a composition in another key than its tonic, however Schubert did do this in some of his early works, e.g. D. 553 ("Auf der Donau", beginning in E-flat major and ending in F-sharp minor).
The autograph of the sonata, dated May 1817, is incomplete — it stops at the 28th measure of the third movement, but there is a contemporary complete manuscript.
3 of the Piano Sonatas volume (Series X) of the Kritisch durchgesehene Gesammtausgabe.