Application Development and Automation 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: 
Read only

UPDATE statement not working , please help

Former Member
0 Likes
1,395

Hello Guys,

Please see the below code and its not working. please help if thers is any bug.

UPDATE table

SET field1 = 'X'

WHERE condition.

Thanks in advance,

Angelo

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,176

It would help to know the condition and table used.

10 REPLIES 10
Read only

Former Member
0 Likes
1,177

It would help to know the condition and table used.

Read only

0 Likes
1,176

alright, here is the complete code.

LOOP AT itab INTO work_area.

UPDATE Ztable

SET field1 = 'X'

WHERE field2 = work_area-field2.

ENDLOOP.

Thank guys,

Angelo

Edited by: SAPBW2010 on May 11, 2010 10:01 PM

Read only

0 Likes
1,176

I must use the UPDATE statement inside LOOP.

Thanks

Angelo

Read only

0 Likes
1,176

Hi,

Are you sure that you have a record in Ztable as per WHERE condition? What is the SY-SUBRC after update? If zero, add COMMIT WORK statement after update.

Thanks,

Vinod.

Read only

0 Likes
1,176

added COMMIT WORK but its not working.

Yes we have matching records.

Thanks

Angelo

Read only

0 Likes
1,176

If you really want help, don't say things like "it's not working". This gives no information. You have to say what is not working. Are you getting a dump? A return code? No changes?

And you haven't given you real source code. You also have to look at the WHERE to see if there really are any matches. Conversion exits may be confusing the issue as well.

Please do some analysis and let the forum know what the problem is.

Rob

Read only

0 Likes
1,176

Hi,

There may be a possibility of having conversion exit for that field. If yes, you can convert and then use in update statement.

Check if the where clause field is case sensitive.

For testing purpose, can you write a select query on that table with the same WHERE condition just before the update statement and see if you have the data. I am sure that your select should also fail.

By the way, you didn't tell the sy-subrc value after the update statement.

Thanks,

Vinod.

Read only

0 Likes
1,176

SY-SUBRC = 0.

Read only

0 Likes
1,176

Hi,

If sy-subrc is zero and commit work is used, i can't see any possibility of failure. Check with your basis team if the update work processes are fine.

Thanks,

Vinod.

Read only

0 Likes
1,176

Thank you all guys, there was some problem in code, now its fixed.

Good luck yuo all,

Angelo