I agree with Mr Monesh Nair that 2 transactions are involved in bill to ship to model.
1. transaction between Mr.P and Mr. A, where Mr.P will give invoice to Mr.A.
2. transaction between Mr. S and Mr.P, where Mr. S will give invoice to Mr.P.
Central Board of Indirect Taxes (CBIC) had clarified the manner in which E-way has to be generated in case of bill to ship to model.Please see this video to understand person who is liable to generate E-way bill in case bill to ship to model and also the manner of invoicing.
The link for the video is as follows:
https://www.youtube.com/watch?v=eb6zpFwE-CU