If you want to define the accessibility for all variables in a structured type you can set the pragma before its declaration as in this example for the CLASS:
{S7.extern=ReadOnly}
CLASS Motor
VAR PUBLIC
Run : BOOL; // ReadOnly by common definition
ReverseDirection : BOOL; // ReadOnly by common definition
END_VAR
VAR INTERNAL
{S7.extern=Hidden}
ActualVelocity : LReal; // Hidden by variable definition
END_VAR
...
END_CLASS
or you collect all related variables into a section and set the accessibility for the whole section:
CLASS Motor
{S7.extern=ReadOnly}
VAR PUBLIC
Run : BOOL; // ReadOnly by section definition
ReverseDirection : BOOL; // ReadOnly by section definition
END_VAR
VAR INTERNAL
ActualVelocity : LReal; // Hidden by default
END_VAR
...
END_CLASS
Nevertheless, you can additionally define the accessibility for individual variables which will take precedence. In this example the variable ActualVelocity will not be accessible at all.
In case of a FUNCTION_BLOCK the common setting for the block applies not to variables which are allocated temporarily like variables in VAR_TEMP or VAR_IN_OUT. These variables will never be accessible.