Paraphrasing L.I.Schiff, "Quantum Mechanics", the $S$-matrix $S=\langle \beta | \alpha^{+} \rangle $ is the amplitude of the asymptotic state $\beta $ contained in what became of an initial asymptotic state $\alpha $ after the scattering has taken place. So you should construct this for a complete set of states $\alpha $ and $\beta $. In your case, this infinite-dimensional matrix decomposes into $2\times 2$ blocks on the diagonal, associated with given energy $p^2 /2m$, which indeed contain your amplitudes $\tilde{A} $ and $\tilde{B} $, namely,
$$
S(p)=\left( \begin{array}{cc}
\tilde{A} (p) & \tilde{B} (p) \\
-\tilde{B}^{*} (p) & \tilde{A}^{*} (p)
\end{array} \right)
$$
(I hope I got the phases right in the second row - will check. I just used unitarity).