First off and as a general remark: It's always a good idea to include the error message itself or a screenshot thereof in your original post, as the qualification "it doesn't work" is pretty useless information to work on. Community members do not often post "it works the first time!" at the beginning of a thread. Actually they never do.
An easy test you could try to check the root cause is what you already explained in you first post: comment out the STORE and DROP statements in the Non-working document, reload it again and open the Table Viewer (Ctrl-T). Does it display any tables to store? If not, then why? We cannot check the conditions of the SQL Select statements, as we do not have your data sources at our disposal. But you do. Maybe the (changed) WHERE clauses do not extract any data from your source DB and as a result won't create an internal QlikView table to store on disk?