This issue is usually due to a missing Analysis code. Please take a look at the main transaction window (where you can see the header details and detail lines all at once) and make a note of the "Analysis" used on the detail line(s) at the bottom.
You will then need to check in Financials under Debtors, Settings, Analysis and make sure that this code exists. If it does not, you will need to create it.
