‎2008 Apr 28 9:23 AM
Hi!
Moving the contents of these Internal Tables into the Database Table
Internal tables have not the same structure like db_Table.
I need a code example. Can u pls help.
itab1
itab2
itab3
itab4
Regards
Ilhan
‎2008 Apr 28 9:28 AM
hi,
Inorder to move the data from an intertable to database table the structure of internal table has to be same as that of data base table ...for suppose if you are updating the entries to mara the table has to be declared in this way ...
data: it_mara type standard table of mara. else if you already have an internal table filled with values and is not of database table format then do this way ...
loop at itab.
move-corresponding itab to it_mara.
append it_mara.
clear it_mara.
endloop.
‎2008 Apr 28 9:29 AM
hi chech this..
first send all the data into a final interna table and loop the final table like this..
loop at it_final.
ztable-field1 = it_final-field1.
ztable-field2 = it_final-field2.
ztable-field3= it_final-field3.
ztable-field4 = it_final-field4.
insert ztable .
endloop.
regards,
venkat
‎2008 Apr 28 9:29 AM
Hi,
Create a new Internal Table itab5 with the same structure as DB Table and Move the Contents of these 4 Internal tables into the 5th and then write the foll Code:
LOOP AT itab5.
INSERT itab5 TO DBTALBE.
ENDLOOP.Regards,
Sunil
‎2008 Apr 28 10:27 AM
hi ,
Store all the data into a final internal table than iterate the intertable like this.
loop at itab_final.
ztab-field1 = itab-field1.
ztab-field2 = itab-field2.
ztab-field3 = itab-field3.
append ztab.
Endloop.
Regards,
Rao
‎2008 Apr 28 10:48 AM
‎2008 Apr 28 11:00 AM
Hey Fren,
You need to create the internal table of the same line type as of the Database Table....
TABLES: DBTABLE.
DATA:
it_final LIKE STANDARD TABLE OF dbtable.Then dump the data from all the internal tables itab1, itab2, itab3, itab4, itab5 into it_final.
also ensure that all the key-fields of the line-type are filled and ARE NOT LEFT BLANK......
You can also use COLLECT statement to avoid the problem of duplicate entries while updating the Database table.
Then using the Modify statement you can update the DB table in this way.
MODIFY dbtable FROM TABLE it_final.Inspire if Needful,
Abhi...
‎2008 Apr 28 11:05 AM
Here some fields matching :-
move-corresponding itab1 to itab2.
append itab2.
or
itab2-field1 = itab1 - fld1.
itab2-field2 = itab1 - fld2.
itab2-field3 = itab1 - fld3.
itab2-field4 = itab1 - fld4.
append itab2.
or any doubt just reply me (:
‎2008 Apr 28 11:26 AM
Hi llhan,
data: itab type zs1 occurs 0 with header line.
move-corresponding zs1 to itab.
or
insert zs1 from table itab.
Reward if useful,
Regards,
S.Suresh.