You can use local or global variables, it really doesn't matter.
I am not familiar with the FLAGFLEXT table, but assuming GJAHR is one of its columns, you can simply have a where-clause GJAHR = $G_Year.
Alternatively, if you're in DS 4.2, you could use the same condition in a normal data flow with FLAGFLEXT as a source. Don't do this in previous versions of DS, because the condition will not be pushed down to ECC and your job will read the full table into memory !!!