Hi Roman,
The return code for Fcodes is always 0, and there is no FA_errno either. This means you just have to assume that the command really worked, or find a way to check the document(s) after running the ApplyMasterPages command to make sure that the result is what you want.
To see whether it really works, create a document with a couple of pages, define the rules in the StructMasterPageMaps (for structured docs) or UnStructMasterPageMaps table, then run the Apply Master Pages command via the menu and see what the document looks like. Then manually overrule one or more body pages in the document, then run the ExtendScript and check the result.
Good luck
Jang