03-09-2009 7:37 AM
Hi,
I met a problem: in my function, I update an entry in a table by using:
update zs_aa set filed_a = value_a where field_b = value_b.
commit work.
when I do debugging, I found the table can be updated after processing first statement. But after running "commit work", the entry was reset to original.
Do you know the reason?
Thanks and Best regards,
Long
03-09-2009 8:17 AM
it must be getting overwritten again in the next update statement, possibly because of err in where condition.
03-09-2009 8:24 AM
Try without commit work. ofcourse its not problem with commitwork but lets see.
03-09-2009 8:51 AM
First you have to evaluate sy-subrc after processing update statement.
If sy-subrc = 0, It will update else you have to check value you have assigned in set field and in where condition.
Regards,
Peranandam
03-09-2009 8:58 AM
Hi,
As per my knowlege this should not happen. Check once again what record updated in DB table. After update statement use SY_SUBRC then you can check that record is updated in DB or not.
Regards
Md.MahaboobKhan
03-09-2009 10:21 AM
Hi,
Once update stmnt executed it will automatically added to the table.....check the code like this in ur Zprogram...
update zs_aa set filed_a = value_a where field_b = value_b.
if sy-subrc eq 0.
message "record updated successfully" type 'S'.
endif.
write like this..and chcek it...
Regards
Kiran
03-09-2009 10:31 AM
>
> Hi,
>
> I met a problem: in my function, I update an entry in a table by using:
>
> update zs_aa set filed_a = value_a where field_b = value_b.
> commit work.
>
> when I do debugging, I found the table can be updated after processing first statement. But after running "commit work", the entry was reset to original.
>
> Do you know the reason?
>
> Thanks and Best regards,
> Long
I don't think that your update is working properly. How are you checking in the debugger that the database table has been updated before the commit? How do you know that the update has done something? If you're not checking the SY-SUBRC and not querying the database table again after the update and before the commit, then you can't know for you. Just issuing a commit will not undo any successful updates already done.