An homomorphism between the function fields of integral schemes induces a morphism between schemes Following Hartshorne, AG, Chapter 1, Theorem 4.4, I am trying to prove that given a field homomorphism between the function fields of two integral scheme $\phi:k(Y)\longrightarrow k(X)$ there exists a morphism $X\longrightarrow Y$ induced by $\phi$.
Now the problem is: taking an affine cover $U_i$ of $Y$, $U_i\cong \rm Spec A_i$, one can find an homomorphism between $A_i$ and $\mathcal O_X(V_i)$ for some open set $V_i\subset X$, hence a morphism $V_i\longrightarrow U_i$. Now I don't know how to conclude: is there a way to glue these morphisms to a morphism $X\longrightarrow Y$?
Thank you in advance.
 A: Now that the question is clear, let me answer. 
This is a general procedure in algebraic geometry: reduction to an affine open set is useful to prove properties that depend only on open sets.
In you case, you know that a rational map $X\dashrightarrow Y$ between two varieties is the equivalence class of morphisms $f:U_f\longrightarrow Y$ where $U_f$ is an open set, such that $f\sim g$ if and only if $f|_{U_f\cap U_g} =g|_{U_f\cap U_g}$. 
In other words, the value of such a function depends only on an open set of $X$, not on the entire variety.
In particular, if you variety $X$ has an affine open cover, a set of representatives for rational functions are morphisms $U_i\longrightarrow Y$ where $U_i$ is an affine open set.
There is no gluing, just application of the definition of rational map.
Edit.
In the comment you ask about the parallel situation in schemes. There is indeed a similarity but it is not so straightforward. The reason is that schemes are not simply topological spaces but they carry another piece of information attached with them - the structure sheaf (of rings of regular functions).
The power of schemes is exactly realising that topological informations only does not suffice to do algebraic geometry, and we can not forget about the regular functions defined on the open sets. This is in some sense a generalisation of the correspondence between morphisms of affine varieties and morphisms on the coordinate ring: if $\varphi :X\longrightarrow Y$ is such a morphism, then there is a morphism of rings $\varphi:k[Y]\longrightarrow k[X]$. 
In schemes you have the same situation, but globally. A morphism of schemes $\varphi:(X,\mathscr{O}_X)\longrightarrow (Y,\mathscr{O}_Y)$ is defined as a couple $(f,f^\sharp)$, where $f:X\longrightarrow Y$ is a continuous map (between the underlying Zariski-spaces) and $f^\sharp : \mathscr{O}_Y\longrightarrow f_* \mathscr{O}_X$ is a morphism of sheaves.
This is not enough as you want that your morphism remembers the locally affine structure of $(X,\mathscr{O}_X)$, so you need to ask also that $f$ and $f^\sharp$ glue from a collection of morphisms $f_i:\mathrm{Spec}(S_i)\longrightarrow \mathrm{Spec}(R_i)$ and $f^\sharp_i : R_i\longrightarrow S_i$ where $\mathrm {Spec} (S_i)$ cover $X$ and $\mathrm{Spec}(R_i)$ cover $Y$.
In the affine case, since the structure sheaf defined by means of the coordinate ring, $f^\sharp$ gives rise to the forementioned ring morphism and it is completely determined by that. But now it doesn't come out like a mysterious object which keeps wandering around varieties without reason: it's really part of the story!
