Mahmoud offers a General Ledger Journals with Multi Dimensional Analysis Details – SQL Script.
Dynamics GP Essentials: General Ledger Journals with Multi Dimensional Analysis Details – SQL Script
SQL & DataDevelopment & IntegrationGeneral Ledger & Financials
Archived post from 2015. Dynamics GP and the links it points to have changed since; check current documentation before relying on version-specific steps.