Let's say we have an integrable function $f:\Omega \rightarrow \mathbb{C}$ on some measure space $(\Omega, \Sigma, \mu )$ for which the triangle inequality for integrals holds, i.e.: $$ \lvert \int_\Omega f d\mu \rvert = \int_\Omega \lvert f \rvert d\mu $$
If $f$ was real valued we could just write:
$$ \lvert \int_{\{ f > 0 \}} f d\mu + \int_{\{ f < 0 \}} f d\mu \rvert = \lvert \int_\Omega f d\mu \rvert = \int_\Omega \lvert f \rvert d\mu = \int_\Omega sgn(f) f d\mu = \int_{\{ f > 0 \}} f d\mu - \int_{\{ f < 0 \}} f d\mu $$
and look at the cases $ \int_{\{ f > 0 \}} f d\mu > -\int_{\{ f < 0 \}} f d\mu $ and $ \int_{\{ f > 0 \}} f d\mu < -\int_{\{ f < 0 \}} f d\mu $ to see that $f$ has to have the same sign almost everywhere.
I can't really see a way to extend the proof to the complex case. I read that equality in the first equation implies $f=e^{i \theta} \lvert f \rvert$ (almost everywhere) for some real constant $\theta$ - which sounds very natural. But how do I prove this?
We reduce the complex case to the real case by a rotation. We choose a $\theta \in \mathbb{R}$ with
$$e^{-i\theta} \int_{\Omega} f\,d\mu \geqslant 0.$$
If the integral vanishes, $\theta$ is completely arbitrary, otherwise it is determined modulo $2\pi$. In any case, we have
\begin{align} 0 &= \biggl\lvert \int_{\Omega} f\,d\mu\biggr\rvert - \int_{\Omega} \lvert f\rvert\,d\mu\\ &= e^{-i\theta}\int_{\Omega} f\,d\mu - \int_{\Omega} \lvert f\rvert\,d\mu\\ &= \int_{\Omega} e^{-i\theta} f - \lvert f\rvert\,d\mu\\ &= \int_{\Omega} \operatorname{Re}\, \bigl(e^{-i\theta} f\bigr) - \lvert f\rvert\,d\mu\\ &= \int_{\Omega} \operatorname{Re}\, \bigl(e^{-i\theta} f\bigr) - \lvert e^{-i\theta} f\rvert\,d\mu. \end{align}
For every $z \in \mathbb{C}$ we have $\operatorname{Re} z \leqslant \lvert z\rvert$, so the integrand of the last integral is a non-positive function. Since the integral is $0$, it follows that
$$E = \bigl\{ \omega \in \Omega :\operatorname{Re}\,\bigl(e^{-i\theta} f(\omega)\bigr) \neq \lvert e^{-i\theta} f(\omega)\rvert \bigr\}$$
is a $\mu$ null set. Since $\operatorname{Re} z = \lvert z\rvert$ implies $\operatorname{Im} z = 0$, we have
$$e^{-i\theta} f(\omega) = \operatorname{Re} \,\bigl(e^{-i\theta} f(\omega)\bigr) = \lvert e^{-i\theta}f(\omega)\rvert = \lvert f(\omega)\rvert,$$
i.e.
$$f(\omega) = e^{i\theta} \lvert f(\omega)\rvert$$
on $\Omega \setminus E$, that is, $\mu$ almost everywhere.