‎2009 Jul 21 12:29 PM
Hi experts..
I want to modify the database table , by using internal table.
but we can use this modify statement "modify database_table from internal_table" when bothe tables are of same structure.
but my internal table has different structure, means i have built my internal table by using some fields not all fields from database table.
so i want to modify the database table by using internal table.
how to do this?
‎2009 Jul 21 12:34 PM
Hi,
Declare a new internal table SAY B with the structure same as that of database table to be modified.
transfer the contents of the old internal table say A to the new table B.You can use Loop and Move Corresponding statements.
Then Modify the database table from internal table B.
Regards,
Vimal.
‎2009 Jul 21 12:34 PM
Hi,
You cannot directly modify the db table from an internal table whose structure is not same as the db table.
What you will have to do is to copy the internal table to another table which has the same structure as the db table and then write the modify statement. There is no other way.
BR,
Advait
‎2009 Jul 21 12:40 PM
Hi
In an alternate way you can try this.
MODIFY DBTAB FROM wa .
in the work area put the values of the internal table work area for that you have use loop or real table statement.
This is the example taken from help.sap.com.
DATA message_wa TYPE t100.
message_wa-sprsl = 'EN'.
message_wa-arbgb = 'MYMSGCLASS'.
message_wa-msgnr = '100'.
message_wa-text = 'Some new message ...'.
MODIFY t100 FROM message_wa.
Thanks&Regards,
Viquar Iqbal
‎2009 Jul 21 1:09 PM
Hi,
Declare a internal table of type database table.
DATA itab1 TYPE <database table> OCCURS 10.
LOOP AT itab.
MOVE-CORRESPONDING itab1 TO itab1.
ENDLOOP.Now you can modify your database tabel using the itab1.
Thanks,
Sri.
‎2009 Oct 07 8:23 AM
if u want to modify database table from internal table the structure of internal table should be same as database table therefore define one more internal table with same structure like database table that u want to modify and move data of first internal table to second internal table then u can modify database table from second internal table.
‎2009 Oct 07 8:36 AM