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

Error in Table control

Former Member
0 Likes
1,279

Hi all,

I have created module prog with table control. I m updating the records from table control to data base table. But the updation is working only for the last record.

I m using UPDATE <DB_table> FROM <int_tab>.

But it is not working and also sy-subrc = 0.

How to update records in the db table, here user is not going to select the MARK field.

thanx.

Thankx.

Umesh

14 REPLIES 14
Read only

Former Member
0 Likes
1,222

When you want to update multiple records, you should use:

update <dbtable> from table <int_tab>.

REgards,

ravi

Read only

0 Likes
1,222

Hi,

I m using the same thing .

Update <tab> from table <it>.

But it is able to update only the last record.

Thannx.

-Umesh

Read only

Former Member
0 Likes
1,222

Are you sure <int_tab> is a table and not just a work area or a field symbol.

It sounds like its not a table, check the values of the same in debug mode.

Regards,

Ravi

Note : Please mark all the helpful answers

Read only

Former Member
0 Likes
1,222

hi,

this is correct umesh.

update <DB_table> from <work_area>.

just check this code

Read only

Former Member
0 Likes
1,222

Hi,

Check if the last record is there in the database table..

Thanks,

Naren

Read only

0 Likes
1,222

hi Naren,

It is there in the batabase.

But if i update first, fourth and last then only last record gets updated.

Thanx.

Read only

Former Member
0 Likes
1,222

Hi,

Try this..

DATA: ITAB_UPDATE LIKE ZTABLE OCCURS 0 WITH HEADER LINE.

UPDATE ztable FROM TABLE ITAB_UPDATE.

If this is not working..Post your code that does the update..

Thanks,

Naren

Read only

0 Likes
1,222

Hi,

Here is the code.

MODIFY G_TC100_ITAB FROM G_TC100_WA

INDEX TC100-CURRENT_LINE.

FORM user_command .

g_ucomm = sy-ucomm.

if g_ucomm = 'SAVE'.

update zusl_tc from table G_TC100_ITAB .

if sy-subrc <> 0.

message 'Error while saving the record' type 'E'.

else.

message 'Record saved successfully' type 'S'.

endif.

endif.

Check.

Thankx.

Read only

Former Member
0 Likes
1,222

Hi,

Do you have the MODIFY code inside the LOOP AT.. ENDLOOP of the PAI module for the table control..

<b>MODIFY G_TC100_ITAB FROM G_TC100_WA

INDEX TC100-CURRENT_LINE.</b>

Thanks,

Naren

Read only

0 Likes
1,222

Hi,

Yes, in PAI I have written the same statement and alos while debugging I checked the values also in the G_TC100_ITAB. It contains the changed values from table control and after that only I have updated table.

-Umesh

Read only

Former Member
0 Likes
1,222

Hi,

Check if you doing this..

PROCESS AFTER INPUT.

LOOP AT ITAB.

MODULE MODIFY_TC.

ENDLOOP.

MODULE USER_COMMAND.

In the user_command module only you are updating the records right??Which is after the ENDLOOP of PAI..

Thanks,

Naren

Read only

0 Likes
1,222

Hi,

I m not doing the same.

But still not getting the result even though I m doing update only in the user_command which is afte the modify_tc .

Thanks.

-umesh

Read only

Former Member
0 Likes
1,222

Hi,

><b>I m not doing the same.</b>

>But still not getting the result even though I m doing update only in the >user_command which is afte the modify_tc .

Use the UPDATE in the USER_COMMAND module which should be after the ENDLOOP of the PAI (as mentioned in my earlier reply)..

Thanks,

Naren

Read only

0 Likes
1,222

Hi,

Thanks I will check with some other options.

Thanks,

Umesh