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: 

How to modify DataBase Table with an internal Table

Former Member
0 Kudos

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

1 ACCEPTED SOLUTION

Former Member
0 Kudos

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

3 REPLIES 3

Former Member
0 Kudos

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

former_member206439
Contributor
0 Kudos

HI

use the statement

MODIFY (dbtabname) FROM TABLE itab

it will update the DB table from itab

Former Member
0 Kudos

Hi,

After using MODIFY (dbtabname) FROM TABLE itab also give COMMIT statement inorder to commit the records in DB

Regards,

Shan