Technical description
The setup fields need to be implemented on at least two levels, for example, a Singleton and Supplemental table. The setup options should be identical.
To read the setup values, we need to provide a function that first checks the most detailed level, the Supplemental table, and then the Singleton table.
The following code snippet is a part of Codeunit 11 Gen. Jnl.-Check Line, and checks the values of Allow Posting From and Allow Posting To in reference to a PostingDate variable:
DateNotAllowed(PostingDate : Date) : Boolean IF (AllowPostingFrom = 0D) AND (AllowPostingTo = 0D) THEN BEGIN IF USERID <> '' THEN IF UserSetup.GET(USERID) THEN BEGIN AllowPostingFrom := UserSetup."Allow Posting From"; AllowPostingTo := UserSetup."Allow Posting To"; END; IF (AllowPostingFrom = 0D) AND (AllowPostingTo = 0D) THEN BEGIN GLSetup.GET; AllowPostingFrom := GLSetup."Allow Posting From"; AllowPostingTo...