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: 

modifying DB table

former_member671224
Participant
0 Kudos

Hi,

Im populating the internal table from DB table. and deleting one record from that internal table. and also im changing one record in that internal table. so the same should be updated to DB table also.<b>ie.,</b> deleted record should be deleted in DB table and also modified record should be modified in DB table.

How i can do this?

Regards,

Amal

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi here is what the code should look like...


data : tab1 type standard table,
         tab2 type standard table.

select * from DBTAB into table tab1.

tab2[] = tab1[].

*** change table one!

loop at tab2 into wa_tab2.

read table tab1 with key....
if sy-subrc ne 0. " record was deleted from tab2
delete DBTAB where KEY
endif.
endloop.

3 REPLIES 3

former_member192429
Active Participant
0 Kudos

How are you displaying internal table from DB table or modifying the internal table? Are you using any Table control in screens?

-Kriss

Former Member
0 Kudos

Hi here is what the code should look like...


data : tab1 type standard table,
         tab2 type standard table.

select * from DBTAB into table tab1.

tab2[] = tab1[].

*** change table one!

loop at tab2 into wa_tab2.

read table tab1 with key....
if sy-subrc ne 0. " record was deleted from tab2
delete DBTAB where KEY
endif.
endloop.

0 Kudos

hI stephen,

use modify <db tab name> while looping the valies from itab.

reward if useful.

kishore