Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Table entry was reset after "commit work"

former_member207732
Participant
0 Kudos

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

6 REPLIES 6

Former Member
0 Kudos

it must be getting overwritten again in the next update statement, possibly because of err in where condition.

Former Member
0 Kudos

Try without commit work. ofcourse its not problem with commitwork but lets see.

Peranandam
Contributor
0 Kudos

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

Former Member
0 Kudos

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

Former Member
0 Kudos

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

christine_evans
Active Contributor
0 Kudos

>

> 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.