2009 Mar 06 3:18 AM
Hi friends,
how to modify the ztable records with key,my problem is am having 3 records for the key field.when ever am try to change these reocrds using
modify ztable from wa_Itab.
without taking any key referenece it is creating a new record,here want to modify the same record which having the record no as 1 .
next time record no2...like that.
loop itab into wa_tab.
modify ztable from wa_tab with reference..................
endloop.
if possible any one can provide the solution.
Thanks in advance,
sai.
2009 Mar 06 4:34 AM
Hi ,
Modify will insert a new record into ur Ztable whenever there is no record exist with same key combination in ur table,. so...
try like this....
loop at itab into wa.
modify ZTABLE from wa where k1 = wa-k1 and
k2 = wa-k2 and
k3 = wa-k3.
endloop.
here k1,k2 and k3 are key fiekds of ur ztable...
Hi friends,
how to modify the ztable records with key,my problem is am having 3 records for the key field.when ever am try to change these reocrds using
modify ztable from wa_Itab.
without taking any key referenece it is creating a new record,here want to modify the same record which having the record no as 1 .
next time record no2...like that.
loop itab into wa_tab.
modify ztable from wa_tab with reference..................
endloop.
if possible any one can provide the solution.
Thanks in advance,
sai.
2009 Mar 06 4:34 AM
Hi ,
Modify will insert a new record into ur Ztable whenever there is no record exist with same key combination in ur table,. so...
try like this....
loop at itab into wa.
modify ZTABLE from wa where k1 = wa-k1 and
k2 = wa-k2 and
k3 = wa-k3.
endloop.
here k1,k2 and k3 are key fiekds of ur ztable...
2009 Mar 06 5:37 AM
Hi MR A,
the problem it is not allowing the where condition in modifying table.
2009 Mar 06 4:41 AM
HI,
1. modify ztable from wa_tab
Modify Checks for the records from work area in the ztable comparing all fields . As in your case your are passing the workarea which hold updated values in the particular fields so the statment checks with this work area in ztable as it don't finds so it creates the new records.
2 . Use where clause in the Modify statement this will serve your pupose.
modify ztable from wa_tab WHERE <Condition>
2009 Mar 06 6:55 AM
Hi Sai,
U can modify in following way:
loop at it_ekko into wa_ekko.
wa_ekko-netpr = '100'.
MODIFY it_ekko INDEX sy-tabix FROM wa_ekko
endloop.
Thanks,
Smita
2009 Mar 06 6:56 AM
Hi Sai,
You can modify in following way:
loop at it_ekko into wa_ekko.
if wa_ekko-k1= '100' and wa_ekko-k2 = '2' and wa_ekko-k3 = '3' .
MODIFY it_ekko INDEX sy-tabix FROM wa_ekko.
endif.
endloop.
Thanks,
smita
Edited by: Smita Gupta on Mar 6, 2009 7:56 AM