While an SPA includes comprehensive representations, warranties, covenants and indemnification provisions, an STA contains fewer clauses and may be suitable for simpler transactions.
You can create a Shareholder Agreement at any time but it's best to put one in place when you start your business. A Shareholder Agreement (SHA) is a contract entered into by the shareholders, ideally when the company is formed, that regulates their relationship and governs the management of the company.
The biggest difference is that an SPA is the sale of all shares, and an APA is the sale of selected assets. Therefore, they are both different transactions and have different procedures.