Below are the steps on how to generate an XSD Schema / IDoc Schema from SAP.
1. In the SAP System in which the IDoc is defined, call transaction WE60 (IDoc Documentation).
2. Enter the name of the IDoc in the Basic type field (or the Enhancement field if your IDoc is an Enhancement of a standard SAP IDoc).
3. Choose menu Documentation, XML Schema.
4. Respond Yes, if prompted to ‘Generate Documentation for Unicode File’.
5. On the resulting screen containing the XSD of the IDoc, choose menu XML, Download.