1. The SAP Interface Repository. In the IFR you will find a complete list of the interface definitions of all officially released IDocs and BAPIs along with the corresponding XML Schemata and XML templates for request and response. They are all well sorted by release and business case.
2. You can also generate an XML schema from a running SAP instance directly with transaction WE60. Unfortunately this feature is not available in elder SAP releases. 4.6 and earlier allow only download of a DTD schema, later releases will generate a proper XML template.
3. Technical data:
The function that generates an XML from an IDoc is SDIXML_IDOC_TO_SCHEMA. The resulting XML DOM document object can be resolved into display format with the utility functions found in function group SDIXML.
This was first published in July 2004