Try running the query
Select * from OOCR
This will give you the cost codes and the dimension codes they are assigned to.
If you are correct that the cost code is assigned to the dimension, try checking that the GL account that will be posted to from the invoice is relevant for that dimension & code in the Chart of Accounts