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 command not working

Former Member
0 Likes
835

Hi all,

I have created a custom program in which i am updating 3 custom tables using :

Update ....

set .... = ....

where ....= ....

The program is working correctly in Sandbox & Development system but in the quality system 2 updates are working but the third one returns with sy-subrc = 4.

As sy-subrc = 4 reflects that the entry doesn't exists but the entry does exists in the table..

I am not updating the key field...

Can any one explain why this thing is happening?

6 REPLIES 6
Read only

Former Member
0 Likes
786

I think you'll find the problem lies in the WHERE:

One side or the other is in upper/lower case and the other is not.

Or one side or the other needs to go through a conversion exit to be padded with the correct number of zeroes.

Rob

Read only

0 Likes
786

Hi All,

Thanks for the responses...

There is no issue with the WHERE clause..

As said in the WHERE clause there is only one parameter and that too CHAR type and all the leading zeroes are padded to it before UPDATE..Also the value will always be numeric (0-9)...

Also the program has the option to update only one entry at a time...

Read only

0 Likes
786

Are you able to replicate this error consistently in QA system? or Did this happen once and you are going back to find out the cause? because if it happened before, is there a guarantee that Table was not updated to add the entry afterwards?

What is the data type of the field? Is it standard or custom data type? Do you have any conversion routines attached to this data type?

I would have a new set of eyes to look at your code and table content... fresh look may catch something, that you may have overlooked

Read only

Former Member
0 Likes
786

Hi,

If the fields used in the where condition of the update are Character fields, then check if there are leading zeros that are required for meeting the criteria.

Incase the number if entries that you are updating are less, try using the update inside a loop statement, where you update one record at the time. In this case make sure that the you have selected the required data into the Internal table (which is being looped).

In your case, I think this is happening because the WHERE criteria is not being met (or) may be the entry that you are trying to edit is locked by someother program or object.

Let us know, how you solved it.

Thanks,

S.Dakshna Nagaratnam.

Read only

Clemenss
Active Contributor
0 Likes
786

Hi mani,

most has been said.

If the field(s) in the WHERE clause have been appended to the table structure they may not yet have any value, here you find them using IS NULL which is different from = space or = 0.

The downside is: You can not "see" Null values - when selected they are automatically converted to initial values. But in the WHERE clause they are different.

Regards,

Clemens

Read only

madhu_vadlamani
Active Contributor
0 Likes
786

Dear Mani kant,

What is the type of the field? Are you using any conversion for date or any other filed. If it is a issue with filed like date or time check the user parameter ans system parameters. Tell me where exactly you are getting the error.

Regards,

Madhu.