Semantic Error (SEM1222): 'THIS' is not allowed in functions.
You have programmed an internal method call in a POU of the type function. Method calls are only allowed in function block instances.
You can either move the suspected code into a function block where method calls are allowed or remove the method call from the function.
Double-clicking the error message opens the affected worksheet.