The holomorphicity property of N=1 superpotentials or of N=2 F-terms involving vector multiplets is generalized to the case of N=4 1/2-BPS effective operators defined in harmonic superspace. The resulting harmonicity equations are shown to control the moduli dependence of the couplings of higher dimensional operators involving powers of the N=4 Weyl superfield, computed by N=4 topological amplitudes. These equations can also be derived on the string side, exhibiting an anomaly from world-sheet boundary contributions that leads to recursion relations for the non-analytic part of the couplings.