‎2007 Oct 04 11:16 AM
hi i am using the below statement to modiby a ztable created by me but it is not working
the record is not modified but ADDED TO THE TABLE PLS SUGGEST ON THE PROBLEM
if not t_zcust_em_modify[] is initial.
loop at t_zcust_em_modify.
modify zcustemail from table t_zcust_em_modify.
message s001 with 'Data saved'(004).
refresh:t_zcust_em_modify.
**nv modify problem
clear:t_zcust_em_modify.
**Nv
endloop.
REGARDS
NISHANT
‎2007 Oct 04 11:18 AM
Hi,
if not t_zcust_em_modify[] is initial.
try with this alone
<b>modify zcustemail from table t_zcust_em_modify.</b>
if sy-subrc eq 0.
endif.
<b>no need of this</b>
loop at t_zcust_em_modify.
modify zcustemail from table t_zcust_em_modify.
message s001 with 'Data saved'(004).
refresh:t_zcust_em_modify.
**nv modify problem
clear:t_zcust_em_modify.
**Nv
endloop.
regards,
Venkatesh
‎2007 Oct 05 2:48 AM
hi you are removing the refresh and loop what if there are several records?
in the internal table
in that case loop is necessary?
‎2007 Oct 04 11:36 AM
Hi,
The data what you enter in the table might not be there so it has got inserted.so check the key fields and get the data from the table and modify the data by means of your data.
Thanks
Yogesh
‎2007 Oct 05 2:47 AM
‎2007 Oct 05 3:22 AM
hi yogesh the data in the temp table is the data which i am mofifying
but how to match it with the data which i have modified? so that is is modified
‎2007 Oct 05 4:14 AM
Hi Nishant,
There is no need to do a loop for modifying the database. There would be a need for loop only if you modify any values of the internal table before you update the Z table.
Because the data base table is being modified from the table <internal table itself> which contains all the records which is specified in the modify syntax itself
More over you have been using refresh in your code which will delete all the entries of the internal table. Just for your info you should always use a clear statement inside a loop to clear the internal table headerline, but not refresh. See the ABAP Syntax fro more information by pressing F1 on it.
so just write ur modify statement like this.
if not t_zcust_em_modify[] is initial.
modify zcustemail from table t_zcust_em_modify.
if sy-subrc = 0.
message s001 with 'Data saved'(004).
endif.
endif.Regards
Gopi
‎2007 Oct 05 4:33 AM
hi gopi
this statement is not working as the modified record is not in the
t_zcust_em_modify[] but it is inserting in the database table rather then modifying
pls suggsest
as this recored is modified one obviously it does not exists in the database table
i want to use modify using index
how to use it?
regards
Nishant
‎2007 Oct 05 12:10 PM
Hi Nishant,
u r modifying the database table from the work area (header line in ur case) only. thats why u wrote modify statement inside the loop. then why r u using modify statement with TABLE keyword. take the keyword 'table' off. n then try.