If the current mode of entry is Alter, then the Method MasterID returns properly. If the current mode of entry is Create, Duplicate, or Insert, where new voucher is being entered, Method MasterID will not bear any value prior to saving the current voucher. In such cases, the same can be identified using the Method CmpVchID of the Object Company which holds the subsequent Master ID of the last entered Voucher in the Company.
Hence, $CmpVchID:Company:##SVCurrentCompany returns the MasterID which will be assigned to the current Voucher.
Ideally, this can be used along with the Event On: Form Accept, where the Voucher is being saved and MasterID is required to perform some further action like printing/exporting the voucher post saving using Action Print/Export by suppressing the Configuration screen.