The following settings are needed for S7-1200 and S7-1500

1. Change the CPU protection level:

a. Open your PLC project in TIA Portal.

b. Select the PLC in the project tree and choose the Properties command.

c. Choose "Full Access".

2. Change DBs settings:

a. Open the "Program Blocks" folder in the project navigation.

b. Right-click the block the access type of which you want to change.

c. Select the "Properties..." item in the pop-up menu.

d. In the "Attributes" tab, Uncheck "Optimized block access".

For more information, review this document from Siemens website.