This should not be to hard as I just completed a script for linking the GL table to Projects.

In the PA_COST_DISTRIBUTIONS_LINES table you need to take the CR_CODE_COMBINATION_ID or DR_CODE_COMBINATION_ID and link it to the CODE_COMBINATION_ID in the GL_CODE_COMBINATIONS table. they need to be linked independently as on is for debit and the other for credit. It worked for me. Good luck.