The solution uses the formula ##\frac{n_1}{u}+\frac{n_2}{v}=\frac{n_2-n_1}{R}## (this is more common than the one you used) with the sign convention: R is positive if the spherical surface is convex as viewed by the incoming ray. R is negative if the surface is concave from the direction the light arrives. The image distance u is positive if the image is at that opposite from where the light arrives, and negative if it is at the same side. The object distance is positive if it is in front of the surface, ( at that side from where the light arrives).
The sign convention in case of the formula you cited is that the distances to the left from the surface are negative and they are positive if they are to the right of the surface. In that case u would be -30 cm.
In case of the problem you show, R is negative, R=-20 cm. n1=1, n2=1.5, n2-n1=0.5. If you calculate the image distance with the formula ##\frac{n_1}{u}+\frac{n_2}{v}=\frac{n_2-n_1}{R}##, ##\frac{1}{u}+\frac{1.5}{v}=\frac{0.5}{-20}## you get the result in the book.
Using your previous formula, both the object and the centre of the sphere are to the left from the refracting surface, so both u and R are negative. u=-30 cm, R=-20 cm, so you get ##\frac{1.5}{v}-\frac{1}{-30}=\frac{0.5}{-20}## which gives the same result.
Do not put absolute value anywhere.
ehild