1 TRIGGER PROCEDURE FOR CREATE OF Creditor.
3 DEF BUFFER LastCreditor
FOR Creditor.
4 DEF VAR creditor-no
AS INT NO-UNDO.
6 FIND LAST LastCreditor
NO-LOCK NO-ERROR.
7 IF AVAILABLE(LastCreditor
) AND LastCreditor.CreditorCode
>= 99999 THEN DO:
8 FIND LAST LastCreditor
WHERE LastCreditor.CreditorCode
< 30000 NO-LOCK NO-ERROR.
9 IF AVAILABLE(LastCreditor
) AND LastCreditor.CreditorCode
= 29999 THEN DO:
10 FIND LAST LastCreditor
WHERE LastCreditor.CreditorCode
< 90000 NO-LOCK NO-ERROR.
11 /* sort this one out when we need to
*/
14 creditor-no
= IF AVAILABLE LastCreditor
THEN LastCreditor.CreditorCode
+ 1 ELSE 1.
16 ASSIGN Creditor.CreditorCode
= creditor-no.