‎2007 May 19 6:47 AM
hi all,
If i am using the syntax
INSERT <database table> from table <itab>. i am getting the syntax error
" the work area "itab" is not long enough long enough" . why i am getting this error even though itab has the same structure of database table.
Is it necessary to have the header line for the itab?
Pls help me.
Thanks,
Praveena
‎2007 May 19 6:49 AM
HI PRAVEENA,
I ANSWERED YOU IN THE OTHER THREAD.
yes the Itab should have the header line
then use
insert <db table> from ITAB.
Reward points if useful
Regards
Anji
‎2007 May 19 6:49 AM
Hi,
The internal table should of the structure of the database table..
Ex..
data: itab type standard table of ztable.
INSERT ztable FROM TABLE itab.
Thanks,
Naren
‎2007 May 19 6:49 AM
HI PRAVEENA,
I ANSWERED YOU IN THE OTHER THREAD.
yes the Itab should have the header line
then use
insert <db table> from ITAB.
Reward points if useful
Regards
Anji
‎2007 May 19 6:54 AM
Hi AnjiReddy,
Thank you for your answer. I am declaring the internal table by using types.so its not possible for me to declare it by using occurs 0. can you pls suggest me some other solution to insert into database table from internal table without using header line.kindly help me.
Thanks,
Praveena
‎2007 May 19 6:54 AM
‎2007 May 19 7:08 AM
Hi Narendran,
Thank you fro your reply.I declared itab as per your suggestion .syntax error is not coming now but records are not inserted into database table after executing insert statement.
kindly help me.
Thanks,
Praveena.
‎2007 May 19 7:10 AM
Hi,
Make sure you have all the key fields populated...Including MANDT..
Also check for SY-SUBRC after the INSERT statement..
If sy-subrc = 0. Then do a commit work.
if sy-subrc = 0.
COMMIT WORK.
endif.
Thanks,
Naren
‎2007 May 19 7:27 AM
hi Narendran,
i declared itab as follows
DATA: tb_final TYPE STANDARD TABLE OF ztable,
wa_final TYPE ztable. "work area
i am populating tb_final as follows:
wa_final-vkorg = wa_ycostctr_kunwe-vkorg.
wa_final-vtweg = wa_ycostctr_kunwe-vtweg.
wa_final-spart = wa_ycostctr_kunwe-spart.
wa_final-kunwe = wa_ycostctr_kunwe-kunwe.
wa_final-kondm = wa_ycostctr_kunwe-kondm.
wa_final-kschl = wa_ycostctr_2-kschl.
wa_final-hkont = wa_ycostctr_2-saknr.
wa_final-kostl = wa_ycostctr_kunwe-kostl.
APPEND wa_final TO tb_final.
CLEAR wa_final.
here i am not populating Mandt field.
finally in tb_final am not getting the proper data .
kindly help me.
Thanks,
Praveena
‎2007 May 19 7:35 AM
data: itab like standard table of ztable<b> with header line.</b>
itab-vkorg = wa_ycostctr_kunwe-vkorg.
itab-vtweg = wa_ycostctr_kunwe-vtweg.
itab-spart = wa_ycostctr_kunwe-spart.
itab-kunwe = wa_ycostctr_kunwe-kunwe.
itab-kondm = wa_ycostctr_kunwe-kondm.
itab-kschl = wa_ycostctr_2-kschl.
itab-hkont = wa_ycostctr_2-saknr.
itab-kostl = wa_ycostctr_kunwe-kostl.
append itab.
-
insert ztable from table itab.
-
OR
-
loop at itab.
insert ztable from itab.
endloop.
-
reward if it helps.
‎2007 May 19 7:44 AM
‎2007 May 19 7:52 AM
insert (table name) from <internal table >
This is the procedure to insert .
‎2007 May 19 8:03 AM
Hi,
I believe It is not necessary the internal table declared with header line for inserting records to the table..
Thanks,
Naren