The condition of determining a group homomorphism between two finite abelian group There is an exercise (Exercise 10.25 in Gallian's Contemporary Abstract Algebra  8/e) which asks:
How many group homomorphisms are there from $\Bbb{Z}_{20}$ onto $\Bbb{Z}_{10}$?
How many are there to $\Bbb{Z}_{10}$?
The answer is $\varphi(10)=4$ and $10$, respectively.
It is sufficient to determinet the image of the generator of $\Bbb{Z}_{20}$.
But I found an example which seems to be a homomorphism, but it is not.
The example is: $\theta:\Bbb{Z}_3\times \Bbb{Z}_2\to S_3$, $\theta(1,0)=(123)$ and $\theta(0,1)=(12)$.
This mapping preserve the operation.
But it is not well-defined.
$$(123)(12)
=\theta(1,0)\cdot \theta(0,1)
=\theta((1,0)+(0,1))
=\theta(1,1)
=\theta((0,1)+(1,0))
=\theta(0,1)\cdot \theta(1,0)
=(12)\cdot (123).$$
Is the following statement true?
Let $G\cong \Bbb{Z}_{p_1^{r_1}}\times \Bbb{Z}_{p_2^{r_2}}\times \cdots \times \Bbb{Z}_{p_s^{r_s}}$ and $H$ be two finite additive abelian groups.
If a mapping $f:G\to H$ satisfy $p_1^{r_1}f(1,0,...,0)=0_{H}$, $p_2^{r_2}f(0,1,0,...,0)=0_{H}$, ..., $p_s^{r_s}f(0,0,..., 0,1)=0_{H}$, 
then $f$ must be a homomorphism from $G$ to $H$.
Remark.
There is an error in my question.
I can't just only define $f$ as a ``function''.
For example, 
define $f:\Bbb{Z}_2\to \Bbb{Z}_2$ by $f(0)=f(1)=1$. 
Which satisfy the condition. 
But it is not a homomorphism.
 A: The statement is true and you could probably spend hours trying to prove it, but it's much nicer to use group presentations which give us something much more general (apologies, I will be using multiplicative notation). 
You may be aware that any group $G$ can be written $\langle P|R\rangle =F(P)/\langle\langle R\rangle\rangle$ where $P\subset G$ generates $G$, $F(P)$ is the free group on $P$, and $\langle\langle R\rangle\rangle$ is the smallest normal group in $F(P)$ containing the set $R\subseteq F(P)$. $P$ is a set of generators of $G$ and $R$ is a set of relators. 
In general an arbitrary map $\psi_0:P\to H$ defines a homomorphism $\psi:G\to H$ if and only if $\psi_0(r)=1_H$ for each $r\in R$. 
In your question specifically $G$ is generated by $e_1,\ldots,e_s$, where $e_i$ can be thought of as an $s$-tuple with $1$ in the $i^{th}$ entry and $0$ elsewhere. One set of relators that define $G$ is $R=\{e_ie_je_i^{-1}e_j^{-1},e_i^{p_i^{r_i}}|1\le i,j\le s\}$. The $e_ie_je_i^{-1}e_j^{-1}$ just mean that $G$ is abelian and since $H$ is abelian, these certainly map under $f$ to $1_H$. The $e_i^{p_i^{r_i}}$ just mean that $e_i$ has order $p_i^{r_i}$ and by assumption, these map under $f$ to $1_H$: so  $f$ does indeed define a homomorphism. 
