Section 19.6.2 in the second edition of "Econometric Analysis of Cross Section and Panel Data," MIT Press, 2010.
see from https://www.statalist.org/forums/forum/general-stata-discussion/general/1295287-heckman-sample-selection-and-instrumental-variable-iv-or-simultaneous-equations-model