2008 Mar 07 9:40 AM
Hi,
I need to update a Z table.. ( update is a primary key .. this table has 7 P. keys )
Bcoz of performance reasons, I can not go line by line and use SET command..
IS there any other way i can upadte the records of this table in one shot.. like..
UPDATE <ztable? from <internal table> but I think this can not update the P. key
Modify will not work as it would insert a new entry in the table....
Any ways to handle this issue.. apart from looping it through...
Hi,
I need to update a Z table.. ( update is a primary key .. this table has 7 P. keys )
Bcoz of performance reasons, I can not go line by line and use SET command..
IS there any other way i can upadte the records of this table in one shot.. like..
UPDATE <ztable? from <internal table> but I think this can not update the P. key
Modify will not work as it would insert a new entry in the table....
Any ways to handle this issue.. apart from looping it through...
2008 Mar 07 9:59 AM
Hi Dhruv,
FIRST TEST IN SANDBOX or DEV REGION/SERVER.
THIS METHOD IS NOT TESTED BUT MIGHT JUST WORK , TRY ONLY IF NO OTHER SOLUTION AVAILABLE.
TAKE THE BACKUP OF THE TABLE BEFORE DOING ANY CHANGES.
Consider a following example.
ZT00_EMP has employee data and the PK of this constituted by MANDT, EMP_NO and ACC_NO.
Now you want to change the values in say ACC_NO column for all the entries.i.e. you want to update records.
Add a new column (in SE11 ) in the table say - ACC_NO_1
and update the new/changed values in this column in the table. After this , in SE11 change the table defination by removing the ACC_NO from key and adding ACC_NO_1 in the key. So the new key will be MANDT, EMP_NO and ACC_NO_1. You can either delete column ACC_NO and rename column ACC_NO_1 to ACC_NO or leave it as it is but then you will have to change all programs for name from ACC_NO to ACC_NO_1.
You can always do this in INTERNAL TABLE first and then UPDATE ZTABLE from ITAB..... (FOR DATA PART)
Hope this works.
PLEASE TAKE BACKUP FIRST.
Regds,
Gaurav
Edited by: Gaurav P Fadnis on Mar 7, 2008 11:05 AM
2008 Mar 07 10:05 AM
Helo,
Check this out (a sample code).
DATA:it_spfli TYPE TABLE OF spfli,
wa_sp LIKE LINE OF it_spfli.
SELECT *
FROM spfli
INTO table it_spfli
WHERE carrid = 'UA'.
LOOP AT it_spfli INTO wa_sp.
wa_sp-fltime = '800'.
MODIFY it_spfli FROM wa_sp INDEX sy-tabix TRANSPORTING fltime.
ENDLOOP.
UPDATE spfli FROM TABLE it_spfli.
if sy-subrc = 0.
write :'updated'.
endif.
Hope this solve ur issue.Be sure that u have all the fields with data in the internal table.
Neeraj.
2008 Mar 10 6:45 AM
hi
try to use
INSERT into <db table name > VALUES <WA name>.
OR
INSERT dbtab FROM TABLE itab.
2008 Mar 14 5:15 AM
hi,
use the following.
update target source.
This changes the content of one or more lines of the dbtable specified in TARGET .The entries in source determine which columns of which lines are changed, and how they are changed.
The changes are definitively copied to the database with the next database commit. Until that point, they can still be undone using a database rollback .
regards
sandhya
2008 Mar 14 12:15 PM
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |