Hi,
Since you need all the details data from your IDoc, and IDoc data segment table is a cluster table, I don’t think you will be able to access it directly via SQL Server query.
The best thing to do is to create an interface using RFC Function that will provide you all the data you need before you access it from non-SAP apps.
You can get all the data required from following tables:
EDIDC – control record
EDIDS – has status and message record
EDID4 – data segment record
You can filter by IDOC Message type and segment name and get only IDoc with status 51.
Hope its help,
Regards,
Edward