1 TRIGGER PROCEDURE FOR ASSIGN OF NewDocument.BatchCode.
3 IF NewDocument.DocumentCode
> 0 THEN .
ELSE
6 DEF BUFFER LastDoc
FOR NewDocument.
7 DEF VAR doc-code
AS INT NO-UNDO.
9 FIND LAST LastDoc
WHERE LastDoc.BatchCode
= NewDocument.BatchCode
12 doc-code
= IF AVAILABLE LastDoc
THEN
13 LastDoc.DocumentCode
+ 1 ELSE 1.
15 ASSIGN NewDocument.DocumentCode
= doc-code.