‎2006 Nov 13 4:13 PM
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
‎2006 Nov 13 4:15 PM
When you want to update multiple records, you should use:
update <dbtable> from table <int_tab>.
REgards,
ravi
‎2006 Nov 13 4:22 PM
Hi,
I m using the same thing .
Update <tab> from table <it>.
But it is able to update only the last record.
Thannx.
-Umesh
‎2006 Nov 13 4:16 PM
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
‎2006 Nov 13 4:19 PM
hi,
this is correct umesh.
update <DB_table> from <work_area>.
just check this code
‎2006 Nov 13 4:24 PM
Hi,
Check if the last record is there in the database table..
Thanks,
Naren
‎2006 Nov 13 4:32 PM
hi Naren,
It is there in the batabase.
But if i update first, fourth and last then only last record gets updated.
Thanx.
‎2006 Nov 13 4:35 PM
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
‎2006 Nov 13 4:47 PM
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.
‎2006 Nov 13 5:01 PM
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
‎2006 Nov 13 5:08 PM
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
‎2006 Nov 13 5:12 PM
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
‎2006 Nov 13 5:22 PM
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
‎2006 Nov 13 5:29 PM
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
‎2006 Nov 13 5:38 PM