Order and Inventory Management Apex API Developer Reference

scmc.AccountPayableVouchersService

global with sharing class AccountPayableVouchersService

A service to provide accounts payable voucher functionality.

Methods

credit

global 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

Name Type Description
accountPayableVoucherIds Set<Id> The Ids of the documents to be credited.

Return Value

The Ids of the AP voucher credits created as a result of the operation.

match

global 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

Name Type Description
accountPayableVoucherIds Set<Id> The IDs of the accounts payable vouchers to be processed.

Exceptions Thrown

Value Description
An exception indicating a problem encountered during the match process.

Return Value

Does 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);

receive

global 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

Name Type Description
accountPayableVoucherIds Set<Id> The IDs of the accounts payable vouchers to be processed.

Exceptions Thrown

Value Description
An exception indicating a problem encountered during the receive process.

Return Value

Does 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);

reverseReceipt

global 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

Name Type Description
accountPayableVoucherIdSet Set<Id> The IDs of the accounts payable vouchers to be processed.

Exceptions Thrown

Value Description
An exception indicating a problem encountered during the reverse receipt process.

Return Value

Does 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);

updateAccountingDate

global static void updateAccountingDate(Set<Id> accountPayableVoucherIdSet)

This service updates the Accounting Date field on the accounts payable voucher to today’s date.

Input Parameters

Name Type Description
accountPayableVoucherIdSet Set<Id> The IDs of the accounts payable vouchers to be processed.

Exceptions Thrown

Value Description
Exception An exception indicating a problem encountered during the update.

Return Value

Does 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);
© Copyright 2009–2023 Certinia Inc. All rights reserved. Various trademarks held by their respective owners.