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: 

updating database table

Former Member
0 Kudos

Hi All,

I am using following code in a custom-function module.

tables: z_time.

move emp_no to z_time-empid.

move name to z_time-name.

move date to z_time-zdate.

move proj_id to z_time-projid.

move act_id to z_time-actid.

move hrs to z_time-hrs.

move remarks to z_time-remarks.

update z_time.

Now while debugging, the values are moving from variable to databse fields.

But finally sy-subrc is showing '4' value when the system executes "update z_time" statment executes....

How to come out of this error and update the table?

Regards

Pavan

1 ACCEPTED SOLUTION

abdulazeez12
Active Contributor
0 Kudos

use Update <DBTAB> from <Internal table name>.

then use.

commit-work.

cheers

7 REPLIES 7

abdulazeez12
Active Contributor
0 Kudos

use Update <DBTAB> from <Internal table name>.

then use.

commit-work.

cheers

Former Member
0 Kudos

Hi,

Try this,

Data: wa_z_time type z_time.

move emp_no to wa_z_time-empid.

move name to wa_z_time-name.

move date to wa_z_time-zdate.

move proj_id to wa_z_time-projid.

move act_id to wa_z_time-actid.

move hrs to wa_z_time-hrs.

move remarks to wa_z_time-remarks.

update z_time from wa_z_time.

Former Member
0 Kudos

Hi Pavari,

Use modify instead of update.

Regards,

Chester

Former Member
0 Kudos

Hi Pavan,

I understand you are trying to use UPDATE to update the DB table, but the z_time fields you declared are taken as WA, so you need to use the synatx as follows :

<b>UPDATE z_time from z_time.</b>

Here, second z_time is WA.

Hope this resolves your query.

Regards,

Nagaraj

Former Member
0 Kudos

Hi Pavan

Upto my knowledge update keyword is used for database table only.

If you want to change the contents of internal table then use modify,append or insert.

If z_time is database table then see to that you have declared the table using TABLES keyword in declaration part,even then if you get the error use update z_time from z_time.

Regards

Varalakshmi.K

Former Member
0 Kudos

Hi Pavan,

How does the system know, which record to update.

Shouldn't first point to a specific record using a select statement?

I always first select a record, and after I'm sure to point to right one I update it.

regards

Sven

Former Member
0 Kudos

Thanks for your Help....

Regards

Pavan