I need to add a new field to the structure of an existing table which contains data.Is there any risk of losing the data if the structure is modified.
A1:
Use append structure and there is no risk.
Recently I have extended VEKP (Shipping unit header) this way.
Dominik
A2:
I've had experience with this in the past. I've found that as long as you
follow the SAP recommended approach, which is to create an APPEND structure by
hitting the "Append Structures..." button when in Table Display / Change,
everything should be okay. This also ensures that your custom data is not lost
in the event of an upgrade.
A3:
Remeber these alterations when you, or your Basis staff, upgrades your SAP
system(s). There is a phase in the upgrade where the R/3 tool (transaction)
SPDD is executed. SPDD compares SAP tables that are being imported/changed
in the applied upgrade with the current state of those same tables in the
existing system. When it detects differences (i.e. customer has added
custom fields to SAP table) it ASKS you what to do. Your choices are to
"Return to SAP standard" or to add the custom fields to "append
structures".
Returning to SAP standard is easy to explain; the custom fields are dropped
and the table is "converted". This means the ENTIRE contents of the
altered table is exported to disk, the table is dropped and re-defined
according to the current SAP standard for that table (including any new
fields that SAP added during the upgrade) and then the data is re-imported.
This means two things: the data in the custom fields is lost forever AND
if the table is huge, the upgrade process takes several more hours to allow
for the table conversion.
If you choose to keep your custom fields during the upgrade, R/3 adds them
automatically to an append structure. Any fields that SAP themselves have
added to the table are appended to the end of the physical table.
Append structures is an SAP R/3 concept. Logically, it looks like you have
all the fields in one table. In reality, any fields that are part of the
table in a the append structure (look in SE11 for append structure
information for a table) are actually stored in a separate, R/3 maintained
table. When operations occur against a table with append structures,
special ABAP/4 auto-generated routines are executed that use additional SQL
to go after the custom fields stored elsewhere through append structures.
The benefit here is that when new "custom" fields are added to an SAP table
with append structures, the base SAP table is not changed. This means no
conversion needs to occur during an upgrade. The problem is that now you
have extra overhead, i.e. 2 reads versus 1, updaters may also experience
hits if fields are indexed, for every access to your table.
Bottom line, you can do this, no problem, but there are down-stream
ramifications that should be considered....