Rational functions invariant under a finite abelian group