Overview
Adding a new variable (row) to a global data block (DB) in Siemens TIA Portal is a routine commissioning task, but a common stumbling block is that the Add row, Insert row, Delete row, and Rename commands become greyed out. The most frequent cause on SIMATIC S7-1500 projects (TIA Portal V17, firmware V2.9) is that the user is attempting to edit inside a nested PLC data type (UDT) or an array of struct rather than at the top-level declaration table of the global DB. This reference walks through the correct workflow, the relevant project settings, and the pitfalls that lock the editor.
Prerequisites
- TIA Portal V17 (Build tested on Update 5) or later with a compatible S7-1500 CPU in the project. The procedure is the same for V16/V18/V19, but the menu ribbon can differ slightly.
- An S7-1500 CPU (verified on 6ES7513-1AM02-0AB0, firmware V2.9). The same logic applies to S7-1200 firmware V4.2+.
- The project must be in offline state with the DB closed (no online connection to the PLC is required to edit declarations).
- Read/write access to the project file and the DB must not be opened on a second station or by a second TIA Portal instance (exclusive write lock required).
- For non-optimized (classic) DBs, the resulting block size must remain ≤ 64 KB; otherwise the compiler rejects the change.
Understanding Global Data Blocks in TIA Portal
A global DB in TIA Portal is a memory area in the S7-1500 load/work memory that holds user-defined tags accessible from any OB, FB, or FC. Two project properties determine how tags are laid out and accessed:
| Property | Optimized Block Access | Standard (Classic) Block Access |
|---|---|---|
| Default on S7-1500 | Yes (recommended) | No |
| Maximum DB size | Limited only by CPU work memory | 64 KB per block |
| Addressing | Symbolic only (no absolute offsets in declaration) | Symbolic + absolute (e.g., %DB5.DBX0.0) |
| Tag alignment | Automatic packing (no gaps shown) | Manual/fixed offsets, gaps possible |
| Download behavior | Single-value download possible (no re-initialization required when adding tags at the end) | Full re-initialization of retentive areas when structure changes |
| Use with HMI / OPC UA | Fully supported | Supported but not recommended for new projects |
When the editor shows relative offset values, it does not mean the access mode is necessarily non-optimized — TIA Portal V17 always displays offsets in the declaration table, but the addressing method in user code remains symbolic when Optimized Block Access is on. The offsets are informational and used internally by the compiler; they cannot be edited manually.
Step-by-Step: Adding a Row to a Global DB
- Open the project and locate the global DB. In the project tree, expand PLC_x → Program blocks → System blocks or Program blocks and double-click the target DB (e.g., DB_Parameters).
- Confirm offline state. The status bar at the bottom of TIA Portal should read OFFLINE. If it reads ONLINE, click Online → Go offline.
- Verify the DB type. Right-click the DB → Properties → General. The Type field should read Global DB. If it reads Instance DB, it is owned by a specific FB/FB instance and cannot be edited freely; you must edit the associated FB interface instead.
- Verify the access mode. In Properties → Attributes, note whether Optimized block access is enabled. This does not affect the ability to add a row, but it does affect download behavior and the 64 KB limit if it is disabled.
- Click the declaration table of the DB (not a row nested under a struct). The cursor must be in the top-level table that contains the DB's own tags, not inside an expanded PLC data type or Array.
- Place the cursor on an existing row in the top-level table where the new tag should be inserted (above or below).
-
Insert the new row. Use one of the following:
- Right-click → Insert row (places a new empty row above the selected one)
- Right-click → Add row (appends a new row at the end of the current table level)
- Toolbar → Insert icon (or keyboard shortcut Ctrl+I)
-
Fill in the tag properties:
-
Name: symbolic identifier (e.g.,
PT_NewTimer) — must be unique within the block and not start with a digit -
Data type: e.g.,
TIME,INT,BOOL, or a user-defined"Type_MyStruct" -
Default value: e.g.,
T#5s - Comment (optional)
-
Name: symbolic identifier (e.g.,
- Compile the project. Press F7 or click Compile → Software (rebuild all blocks). The compiler updates the block interface; for optimized DBs, the actual values of existing tags are preserved (single-value download). For non-optimized DBs, the retentive areas are re-initialized if the block interface changes.
- Download to the PLC (when ready): Right-click the DB → Download to device → Software. For an optimized DB, TIA Portal will offer to download only the new tag without resetting existing values.
Special Case: Adding Tags Inside a Nested PLC Data Type (UDT) or Array
This is the case that produces the symptom described in the original report: Add row, Insert row, and Rename are all greyed out while the cursor is inside an expanded PLC data type (UDT) or an Array of struct. The editor intentionally does not allow inline editing of a type that is reused across the project — modifications to a UDT must be made at the type definition so that every instance is updated consistently.
Workflow for adding a member to a UDT used in a global DB
- In the project tree, expand PLC_x → PLC data types.
- Double-click the type (e.g., Type_Motor) to open the type editor.
- Add the new member in the type's declaration table exactly as you would in a DB: Insert row, set Name / Data type / Default value.
- Compile the project. Every DB that uses
Type_Motorautomatically inherits the new member, with the same name and offset layout. - Reference the new member in your code:
"DB_Plant".Motor_1.NewMember.
Workflow for adding a member to a struct instance inside a DB
If the struct was declared inline in the DB (not as a separate PLC data type), expand the struct row in the DB's declaration table and add a member directly in the expanded child table. The greyed-out menu only appears if the struct is a named PLC data type; inline structs are always editable.
How to Tell the Difference: UDT, Inline Struct, Array
| Declaration in DB | What the data type column shows | Where to edit |
|---|---|---|
| PLC data type (UDT) |
"Type_MyStruct" (name in quotes) |
PLC data types folder in the project tree |
| Inline struct |
Struct (with + expand arrow) |
Inside the DB declaration, expand the row and edit the child table directly |
| Array of struct |
Array[0..9] of "Type_MyStruct" or Array[0..9] of Struct
|
UDT case: edit the type. Inline case: expand the array to add an element, then add struct members |
Common Pitfalls and Greyed-Out Menu Causes
| Symptom | Likely Cause | Resolution |
|---|---|---|
| Add row/Insert row/Rename all greyed out | Cursor is inside a UDT body that is being shown read-only because the UDT is opened in a second window | Close the UDT editor, then edit the UDT in PLC data types |
| Editor is read-only when offline | The project is opened in a TIA Portal instance with read-only protection (e.g., multi-user server with no checkout) | Check out the DB from the multi-user server (TIA Portal ≥ V17 multi-user) |
| New row appears, but compile fails with Maximum size of DB exceeded | Non-optimized DB has hit the 64 KB limit | Enable Optimized block access or split the data into multiple DBs |
| Existing values reset to defaults after download | Non-optimized DB where the new tag was inserted before existing tags, shifting offsets | Append new tags at the end of the table, or convert the DB to optimized access |
| Symbol is unresolved / shown in red in the user program | Tag name was renamed instead of added; the new symbol does not yet exist in the interface | Recompile (F7) to refresh the symbols |
| Cannot add row inside an Array | Arrays are sized at declaration; you can change the bounds ([0..N]) but not insert/remove elements |
Edit the lower/upper bound in the row's Data type field, or add a second array |
Verification
- Compilation check: After the edit, the project should compile without errors or warnings. The Info → Compile editor pane should show 0 errors.
- Symbol table check: In the DB declaration table, the new tag should appear with a green dot (used) once the program references it, or an orange dot (declared but unused) if not yet referenced. A grey dot indicates an untyped placeholder; check the Data type field.
- Online consistency: Go online with the PLC. Right-click the DB → Monitor / Modify. The new tag should appear with its current value and the Offset column should display a sensible value (e.g., +0, +4, +6 relative to the previous tag, depending on data type size).
-
Runtime check: In a TON instance, assign the new tag to the
PTinput, e.g."DB_Parameters".PT_NewTimer. Trigger the timer and confirm the elapsed time matches the configured PT. - Download integrity: If the project uses optimized access and an HMI is bound, verify that the HMI tag list picks up the new symbol (re-compile the HMI or refresh the connection in WinCC / TIA Panel).
Commissioning Notes for S7-1500 (CPU 1513-1 PN, FW V2.9)
- CPU 1513-1 PN (6ES7513-1AM02-0AB0) with firmware V2.9 supports all DB features including optimized access, retain/permanent areas, and single-value download. See the S7-1500 system manual for the full feature matrix.
- For non-optimized DBs larger than 64 KB on S7-1500, the compiler will reject the change with error Block too large. Convert to optimized access instead, or split the data.
- If the global DB is referenced by an FB as a multi-instance or single-instance (instance DB), edits must be made in the FB interface, not the DB itself.
- Tags declared with Retain = Set in IDB are preserved across power cycles; for optimized DBs the actual values are preserved even when the interface is expanded, provided new tags are appended at the end of the table.
- Use the Find and replace function in the DB editor (Ctrl+F) to confirm that the new tag name is unique and consistent with the rest of the project.
Related TIA Portal Settings Worth Knowing
| Setting | Location | Effect |
|---|---|---|
| Optimized block access | DB → Properties → Attributes | Switches between symbolic-only and absolute-addressable access; also changes download behavior and the 64 KB limit |
| Data block write-protected in the PLC | DB → Properties → Attributes → Protection | Prevents runtime writes from the user program; does not affect editor access |
| Know-how protection | DB → Properties → Protection | Locks the block against reading the declaration; editor is still usable from the project |
| Accessible from HMI / OPC UA | DB → Properties → Attributes | Controls whether the symbols are published to HMI/OPC UA tag generators |
| IEC checking / Library version | Project → Properties → PLC programming | Can enforce strict type checks; if you cannot add a row in a library-derived DB, check out the master copy from the project library first |
Field-Proven Workflow Summary
- Go offline. Verify you are not editing a UDT body by mistake.
- Open the global DB's top-level declaration table.
- Append the new row at the bottom of the table (preserves any existing offsets).
- Compile. Resolve any remaining errors before downloading.
- Download to the PLC (single-value download if optimized).
- Online → Monitor to confirm the new tag's value and offset.
Why are Add row and Insert row greyed out in my global DB in TIA Portal V17?
The most common reason is that the cursor is inside a nested PLC data type (UDT) or an array of struct rather than in the DB's top-level declaration table. UDTs must be edited in the PLC data types folder of the project tree. Other reasons include being online with the PLC, having the project opened read-only on a multi-user server, or trying to edit an instance DB instead of a global DB.
How do I add a new variable to a global DB without resetting existing values?
Use an optimized-access DB (the default on S7-1500) and append the new tag at the end of the declaration table. TIA Portal then performs a single-value download that preserves all existing tag values across CPU restart. If the DB is non-optimized, inserting a tag in the middle of the table shifts absolute offsets and triggers a re-initialization of the block.
What is the difference between a global DB and an instance DB in TIA Portal?
A global DB is a standalone block whose tags are accessible from any code block via symbolic addressing (e.g., "DB_Params".MyTag). An instance DB belongs to a specific FB and stores that FB's static variables, including its multi-instance data. You can add tags to a global DB directly, but to add a tag to an instance DB you must edit the parent FB's interface and recompile.
What is the maximum size of a non-optimized global DB on S7-1500?
Non-optimized DBs on SIMATIC S7-1500 are limited to 64 KB. If your project requires a larger block, enable Optimized block access in the DB's attributes or split the data across multiple DBs. The 64 KB limit does not apply to optimized DBs, which are limited only by the CPU's work memory.
Can I add a row to a global DB while the project is online with the PLC?
No. The DB editor is read-only while TIA Portal holds an online connection to the CPU. Click Online → Go offline (or press Ctrl+Q to toggle) and confirm the status bar reads OFFLINE before editing the declaration. After compiling, download the modified block with Download to device → Software.