MoneyWorks Manual
GetNextReference (transType [, bank])
Result Type: string
Definition: Gets a reference number from the reference number service. This is an atomic operation, so no other user will receive the same reference number (so long as it is a numeric autoincrementing reference number). Call this when you are going to create a transaction (say an invoice) via importing and want a reference number from the invoice number sequence. If you need to relinquish the reference number, you can use TryPutBackReference. Supported values for the transType are "AP" ('Electronic' payments), "RT" (debtor receipts), "CR" (cash sales), "CP" (cash payments), "CQ" (cheque run payments), "DI", "PO", "CI", "QU", "SO", "JB" (job). For transaction types involving a bank account, you must supply a bank account code as well. Do not use "BK" or "JN".
See Also:
TryPutBackReference: Try to return an unused reference number (allocated by GetNextReference) to the reference number allocator.