2010 Apr 06 12:24 PM
Hi,
how to update key fields for a table.The update statement is not working for the same.
Regards,
2010 Apr 06 12:25 PM
Hi,
how to update key fields for a table.The update statement is not working for the same.
Regards,
2010 Apr 06 12:25 PM
2010 Apr 06 12:26 PM
2010 Apr 06 12:27 PM
Key fields cannot be updated. Delete and create the records
Regards
Vinod
2010 Apr 06 12:39 PM
Hi,
See the below example.
TABLES SPFLI.
DATA WA TYPE SPFLI.
MOVE 'AA' TO WA-CARRID.
MOVE '0064' TO WA-CONNID.
MOVE 'WASHINGTON' TO WA-CITYFROM.
...
UPDATE SPFLI FROM WA.
MOVE 'LH' TO SPFLI-CARRID.
MOVE '0017' TO SPFLI-CONNID.
MOVE 'BERLIN' TO SPFLI-CITYFROM.
...
UPDATE SPFLI.
CARRID and CONNID are the primary key fields of table SPFLI. All fields of those lines where the primary key fields are "AA" and "0064", or "LH" and "0017", are replaced by the values in the corresponding fields of the work area WA or the table work area SPFLI.
Regards,
raj.
2010 Apr 06 1:00 PM
You must rely on an UPDATE SET WHERE to change primary keys, else use DELETE/INSERT. cause Open SQL use the value of the primary keys of the work area to identify records to update in the other alternatives of the statement.
Even with UPDATE SET WHERE, primary keys can only be changed if the respective database table is not linked with a search help and if pool and cluster tables are not accessed. ([ref|http://help.sap.com/abapdocu_70/en/ABAPUPDATE_SOURCE.htm#!ABAP_ALTERNATIVE_1@1@])
Regards,
Raymond