11-09-2008 5:35 AM
Hi, Friends.
I am coping Data from a Database table to an internal table after modifying data in the internal table I want to modify the db table according to the modification in the internal table. can some one help me out in this way, i am doing this modification in Table Control in Screen programing.
My Code is as follow.
MODULE zfsl_stinf_tc_init OUTPUT.
IF tc_copy IS INITIAL.
SELECT * INTO CORRESPONDING FIELDS OF TABLE it_zfsl_stinf FROM zfsl_stinf.
tc_copy = 'X'.
REFRESH CONTROL 'TC_FOR_ZFSL_STINF' FROM SCREEN '0001'.
ENDIF.
ENDMODULE. " zfsl_stinf_init OUTPUT
&----
*& Module zfsl_stinf_tc_move OUTPUT
&----
text
----
MODULE zfsl_stinf_tc_move OUTPUT.
MOVE-CORRESPONDING wa_it_zfsl_stinf TO zfsl_stinf.
ENDMODULE. " zfsl_stinf_tc_move OUTPUT
&----
*& Module STATUS_0001 OUTPUT
&----
text
----
MODULE status_0001 OUTPUT.
SET PF-STATUS 'ZFSL_SCREEN_1ONLY'.
SET TITLEBAR 'xxx'.
ENDMODULE. " STATUS_0001 OUTPUT
&----
*& Module zfsl_stinf_tc_modify INPUT
&----
text
----
MODULE zfsl_stinf_tc_modify INPUT.
MOVE-CORRESPONDING zfsl_stinf TO wa_it_zfsl_stinf.
MODIFY it_zfsl_stinf FROM wa_it_zfsl_stinf INDEX tc_for_zfsl_stinf-current_line.
_*"" here i have the modified internal table " it_zfsl_stinf "*_
ENDMODULE. " zfsl_stinf_tc_modify INPUT
Kind regards,
Faisal
11-10-2008 5:19 AM
Hi
Here you are modifying your dbtable in module pool programming
so better to use work area to modify the database table
example:
data: itab type table of zfsl_stinf .
data: wa_itab type itab.
select single * from zfsl_stinf INTO itab WHERE <condition>
(pass your values to wa_itab.)
modify zfsl_stinf from values of wa_itab.
Regards
Srinivasu
11-10-2008 5:19 AM
Hi
Here you are modifying your dbtable in module pool programming
so better to use work area to modify the database table
example:
data: itab type table of zfsl_stinf .
data: wa_itab type itab.
select single * from zfsl_stinf INTO itab WHERE <condition>
(pass your values to wa_itab.)
modify zfsl_stinf from values of wa_itab.
Regards
Srinivasu
11-10-2008 5:36 AM
HI
use the statement
MODIFY (dbtabname) FROM TABLE itab
it will update the DB table from itab
11-11-2008 6:27 AM
Hi,
After using MODIFY (dbtabname) FROM TABLE itab also give COMMIT statement inorder to commit the records in DB
Regards,
Shan