‎2007 Apr 19 12:57 PM
hi guys..
iam inserting one new record from itab to dbtable..
existing record is deleted.. so how can i solve the problem..
my coding
APPEND ITAB .
MOVE-CORRESPONDING ITAB TO ITAB2.
MODIFY ZQUERY1 from ITAB2.
loop is not necessary in my program because i get only one value at that time..
thanks
gowrishankar
‎2007 Apr 19 1:00 PM
Hi,
I feel u need not append as well modify.
both actually performs similar functionality!
try it out.
<<<reward if useful>>>
All the best
‎2007 Apr 19 1:03 PM
Hi Gowrishankar,
You can use Insert instead of modify in this case. Try the below code
Append Itab.
zquery1-field1 = itab-field1.
zquery1-field2 = itab-field2.
....
Insert zquery.
please reward if found useful.
‎2007 Apr 19 1:03 PM
Hi,
You need to use the TABLE other wise it will insert only one record, change it to like .....
APPEND ITAB .
MOVE-CORRESPONDING ITAB TO ITAB2.
MODIFY ZQUERY1 from TABLE ITAB2.Regards
Sudheer
‎2007 Apr 19 1:04 PM
Modify will check if there is a similar record in the DB Table (based on table keys).
If yes, it will update teh data from the itab to teh DB tab, else it will insert the data.
In your case, check whether there is a similar record in the db table based on teh table keys.
‎2007 Apr 19 1:04 PM
hi,
TRY CHANGING CODE LIKE THIS..
UPDATE ZQUERY1 from ITAB2.
REGARDS,
NAVNEETH.K
‎2007 Apr 19 1:04 PM
Hi gowrishankar
You need to use the INSERT command rather than MODIFY. Modify updates the existing record, insert creates a new one.
eg INSERT zquery1 FROM TABLE itab2.
Kind regards
Andy
‎2007 Apr 19 1:04 PM
hi,
While modifying records, it changes values of all the fields except the key fields.
So, make sure that itab2 contains all the fields of ddic tbale Zquery1.
select single * from zquery1 into wa_itab.
if sy-subrc eq 0.
wa_itab-test = 'ABC'.
endif.
append wa_itab to itab.
modify zquery1 from itab.This would replace the required fields.
Though it replaces all the fields, the others values wont get disturbed.
Regards
sailaja.
‎2007 Apr 19 1:06 PM
use this statement (there is no need of move and modify statements)
<b>Insert zquery.</b>
reward if it helps u
Vijay Pawar
‎2007 Apr 19 1:06 PM
insert <dbtab> from table itab [accepting duplicate keys].
but itab should have the same structure like dbtab.
regards
shiba dutta
‎2007 Apr 19 1:07 PM
Change the modify statement.
MODIFY ZQUERY1 from TABLE ITAB2.
Modify statement modify the existing records in DB table if the key field exists otherwise insert the new record.