My question regards proposition 3.2 in Hartshornes Algebraic Geometry, the statement that a scheme is locally noetherian if and only if for every affine open subset $\operatorname{spec}(A)$, the ring $A$ is noetherian.
One part of the proof is unclear to me: We take an open subset $U = \operatorname{spec}(B)$ of an affine scheme $X = \operatorname{spec}(A)$, where $B$ is a noetherian ring. Then there exists some $f \in A$ with $D(f) \subset U$, which is clear. But how can we take the image of $f$ in $B$?
The terminology leads me to believe that we have a morphism from $A$ to $B$, but I don't know where this should come from. If $U \hookrightarrow X$ was a morphism of schemes, this would of course be clear (by the fact that the categories of rings and affine schemes are equivalent), but I was under the impression that we merely have an inclusion of open sets, and not additionally a morphism of sheaves of rings, as in the definition of a morphism of locally ringed spaces. Thanks in advance!