This is how to get applied documents with applied amount from related customer or vendor document using codeunit in C/AL programming.
I created a codeunit to get applied document.You can download the codeunit (fob/txt formats) using following links.
navuser.com/GetAppliedDocuments.php