2009 Dec 04 11:17 AM
Hi all,
I have to insert the Internal table records into the DB table.
the problem is the structure of internal table and DB table is not same
Internal table is having 10 fields and DB table is having 20 fields.
how can i do it?
Thanks
2009 Dec 04 11:39 AM
Let us summarise your requirment like below :
You have table T1 whose rcord you want to update in DB_tab1
but the structure you have maintained is different than the structure of DB_tab1
Here is the soln :
create an internal table T2
Data: T2 type standard table of DB_tab1 initial size 0.
data: wa_t2 type DB_tab1 .
Loop at T1.
wa_t2-field1 = t1-field1.
wa_t2-field2 = t1-field3
wa_t2-field2 = t1-field3
>>>>>>>>>>>>>>>>>>>
wa_t2-fieldn = t1-fieldn.
append t2 from wa_t2.
endloop.
Insert into DB_tab1 from T2.
Hi all,
I have to insert the Internal table records into the DB table.
the problem is the structure of internal table and DB table is not same
Internal table is having 10 fields and DB table is having 20 fields.
how can i do it?
Thanks
2009 Dec 04 11:20 AM
Hello,
If the structure is not same then create another internal table similar to the DB and move the corresponding values to it and insert in the DB table.
Vikranth
2009 Dec 04 11:22 AM
Create a internal table of structure Ztbale.
append the data into itab.
then
modify Ztest from table itab.
2009 Dec 04 11:23 AM
Hi,
Declare one internal table as DB table strcure.. Now pass the required fields to this new internal table with the values you have in your other internal table ...Then modify the DB table with the new internal table.
Regards,
Nagaraj
2009 Dec 04 11:39 AM
Let us summarise your requirment like below :
You have table T1 whose rcord you want to update in DB_tab1
but the structure you have maintained is different than the structure of DB_tab1
Here is the soln :
create an internal table T2
Data: T2 type standard table of DB_tab1 initial size 0.
data: wa_t2 type DB_tab1 .
Loop at T1.
wa_t2-field1 = t1-field1.
wa_t2-field2 = t1-field3
wa_t2-field2 = t1-field3
>>>>>>>>>>>>>>>>>>>
wa_t2-fieldn = t1-fieldn.
append t2 from wa_t2.
endloop.
Insert into DB_tab1 from T2.
2009 Dec 04 11:47 AM
2009 Dec 04 11:43 AM
Hi,
You can create your internal table of the type of structure of the
Ztable which needs to be modified.
Then after populating the required fields data into the
internal table you need to use MODIFY statement i.e,
MODIFY ZTABLE FROM TABLE ITAB.
Hope it helps
Regards
Mansi
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |