From time to time it is usual that there is an error of query while checking it (button Check Query in toolbar) in BEx Query Designer. This function is checking the query definition for errors. It is the same whenever you use Quit or Use Query function system is doing same check function automatically.
If there is an error like:
Unable to generate query XYZ without errors
Message no. BRAIN125
You need to check ABAP report which is behind your broken query. Query has a ABAPs called like GP* (GP means Generated Program) followed by some hash string e.g. GP44ZX6QULYHYDO4R27HWIHRIQ8. Once there is an error system copies GP* to ABAP report called RSR_BAD_CODING. Afterwards you need to investigate this ABAP report. You can use transaction SE38 (ABAP Editor) for that. Once you reach this transaction hit Display button to display source code of report. Then check syntax of report by Check button on toolbar (CTRL+F2). This functionality tells you exactly the line of report there error is. Using the type of syntax error returned you need to realize if you need to adjust your query back in BEx Query Designer or you can apply an SAP Note to correct this problem.
This story continues in second part here: Further checking of broken BEx queries 2