scmc.AccountPayableVouchersServiceglobal with sharing class AccountPayableVouchersService A service to provide accounts payable voucher functionality. Methods
creditglobal static Set<Id> credit(Set<Id> accountPayableVoucherIds) This method fully credits a collection of account payable (AP) vouchers. Only creditable AP vouchers are processed. AP Vouchers that are not creditable are ignored. The process creates AP voucher credits for all AP voucher Ids that are creditable and for each AP voucher, credits all creditable lines. The process creates an AP voucher credit line for each creditable AP voucher line. Input Parameters
Return ValueThe Ids of the AP voucher credits created as a result of the operation. matchglobal static void match(Set<Id> accountPayableVoucherIds) This service updates the accounts payable voucher status to "Matched", and if all of the line items on the purchase order have been received, the purchase order status is updated to "Closed". For internal purchase orders, the received quantity and amount vouchered are updated as appropriate during the match process. These are not updated on drop ship purchase orders. Input Parameters
Exceptions Thrown
Return ValueDoes not return a value. Sample Code//Note: This sample code is for demonstration purposes only. It is not intended for //use in a production environment, is not guaranteed against defects or errors, and //is in no way optimized or streamlined. Set<Id> accountPayableVoucherIds = new Set<Id>{'a069E0000004NBO'}; SCMC.AccountPayableVouchersService.match(accountPayableVoucherIds); receiveglobal static void receive(Set<Id> accountPayableVoucherIds) The receive method is only valid for drop ship purchase orders that are associated with a sales order. Drop ship orders are not delivered to the warehouse but are instead be delivered to a customer or a supplier site and therefore cannot have a receipt issued. This method updates the accounts payable voucher status to "Received" and if all of the line items on the purchase order have been received, the purchase order status is updated to "Closed". The sales order associated with the purchase order is also adjusted as appropriate, for instance if new lines are added to the AP voucher that were not on the original purchase order, then these lines will be added to the sales order. Input Parameters
Exceptions Thrown
Return ValueDoes not return a value. Sample Code//Note: This sample code is for demonstration purposes only. It is not intended for //use in a production environment, is not guaranteed against defects or errors, and //is in no way optimized or streamlined. Set<Id> accountPayableVoucherIds = new Set<Id>{'a069E0000004NBO'}; SCMC.AccountPayableVouchersService.receive(accountPayableVoucherIds); reverseReceiptglobal static void reverseReceipt(Set<Id> accountPayableVoucherIdSet) The reverse Receipt method is only valid for drop ship purchase orders that are associated with a sales order. This method updates the accounts payable voucher status to "New" and the purchase order status is updated to "Approved". The sales order associated with the purchase order is also adjusted as appropriate. Input Parameters
Exceptions Thrown
Return ValueDoes not return a value. Sample Code//Note: This sample code is for demonstration purposes only. It is not intended for //use in a production environment, is not guaranteed against defects or errors, and //is in no way optimized or streamlined. Set<Id> accountPayableVoucherIdSet = new Set<Id>{'a00000000000AAA'}; SCMC.AccountPayableVouchersService.reverseReceipt(accountPayableVoucherIds); updateAccountingDateglobal static void updateAccountingDate(Set<Id> accountPayableVoucherIdSet) This service updates the Accounting Date field on the accounts payable voucher to today’s date. Input Parameters
Exceptions Thrown
Return ValueDoes not return a value. Sample Code//Note: This sample code is for demonstration purposes only. It is not intended for //use in a production environment, is not guaranteed against defects or errors, and //is in no way optimized or streamlined. Set<Id> accountPayableVoucherIdSet = new Set<Id>{'a0u0R000001AQ6rQAG'}; SCMC.AccountPayableVouchersService.updateAccountingDate(accountPayableVoucherIds); |