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

Edit field in a Data Base Table

Former Member
0 Likes
1,104

Hi Everyone,

I am trying to change field VERME(available stock) in LQUA table. The requirement is whenever the value is less than zero in VERME, we should change that to 0.

I know its not good to update the DB table directly, but there is no other alternative. The scope is very limited and I am trying to write some program just for this only purpose.

Have you guys any sample program for this requirement?

Thanks

Kumar.

1 ACCEPTED SOLUTION
Read only

Sm1tje
Active Contributor
0 Likes
950

select all the rows where VERME LT 0 together with the whole key in an internal table. Change the field VERME to zero.

Next use UPDATE statement like this:

UPDATE dbtable FROM TABLE db_itab.

If you have a lot of records that need to be updated, you might want to consider to select packages of a 1000 records at once.

5 REPLIES 5
Read only

Sm1tje
Active Contributor
0 Likes
951

select all the rows where VERME LT 0 together with the whole key in an internal table. Change the field VERME to zero.

Next use UPDATE statement like this:

UPDATE dbtable FROM TABLE db_itab.

If you have a lot of records that need to be updated, you might want to consider to select packages of a 1000 records at once.

Read only

Former Member
0 Likes
950

While updating any data base , You should use the Lock Object concept also. So is some one else also trying to update the same table it doesn't give you short dump.

Read only

Former Member
0 Likes
950

Hi,

You can update a database table by first locking the table using Function module

ENQUEUE_TABLE_E

by passing table name.

Then update record in table using statement

update LQUA set VERME = 0

WHERE VERME le 0.

After this statement unlock the database table using function module

DEQUEUE_TABLE_E.

Reward points if answer is helpfull.

Regads,

Mukul Sharma

Read only

Former Member
0 Likes
950

hi,

you can use the lock object concept here firsst create one lock object in se11 and

update a database table by first locking the table using Function module

ENQUEUE_En by passing table name.Then update record in table using statement

update LQUA set VERME = 0WHERE VERME le 0.After this statement unlock the database table using function module

DEQUEUE_dE.

may be useful,

regards,

dilip

Read only

Former Member
0 Likes
950

Closing the thread because no longer in search for that answer.