  In this paper, we study the relation between periodicity of two-dimensional
words and their abelian pattern complexity. A pattern $\cal{P}$ in
$\mathbb{Z}^n$ is the set of all translations of some finite subset $F$ of
$\mathbb{Z}^n$. An $F$-factor of an infinite word is a finite word restricted
to $F$. Then the pattern complexity over a pattern $\mathcal{P}$ counts the
number of distinct $F$-factors of an infinite word, for $P\in \mathcal{P}$. Two
finite words are called abelian equivalent if for each letter of the alphabet,
they contain the same numbers of occurrences of this letter. The abelian
pattern complexity counts the number of $F$-factors up to abelian equivalence.
As the main result of the paper, we characterize two-dimensional convex
patterns with the following property: if abelian pattern complexity over a
pattern $\cal{P}$ is equal to 1, then the word is fully periodic. Similar
result holds for a function on $\mathbb{Z}^2$ instead of a word and for
constant sums instead of abelian complexity equal to 1. In dimensional 1, we
characterize patterns for which there exist non-constant functions with
constant sums.
