‎2008 Mar 24 11:39 AM
In ECC I am using
INSERT ZTable statement in my program.
In EPC check i am getting obsolete stmts error like,
An explicit work area is necessary in the OO context. Use "INSERT wa INTO dbtab"
or "INSERT INTO dbtab VALUES wa" .
How to solve this. Plz anyone tell me..
‎2008 Mar 24 11:43 AM
Hi
First declare an internal table without header line. Then declare a work area(structure) like your internal table, while looping, use 'loop at itab into wa'. Then insert wa in to database table.
Reward points if helpful.
Regards,
CS
Edited by: CSY on Mar 24, 2008 5:23 PM
‎2008 Mar 24 11:44 AM
Insert as below ..
Loop at itab into wa_tab.
INSERT wa_tab INTO dbtab.
endloop.
‎2008 Mar 24 11:49 AM
Hi,
Either the values can be from Work area or Internal table:
That is:
INSERT INTO (dbtabname) VALUES wa.
INSERT (dbtabname) FROM TABLE itab.
‎2008 Mar 24 11:54 AM
Hi,
In ECC you are not supposed to declare internal Tables without header lines. Even though it does not give you a syntax error it does give an EPC error.
So in order to avoid your EPC error , just declare a header line for your internal table and loop through your internal table into the header line and insert data into the database table.
Regards,
Soumya
‎2008 Mar 24 12:16 PM
Hi Sowmya,
IN ECC, we have to declare the internal table with some type and with separate work area.. it will work
‎2008 Mar 24 12:40 PM
Sorry..i think there was a typo in my post.. I meant that in ECC we should not declare internal tables with header lines.
It does not give a syntax error but appears in EPC error.
Regards,
Soumya
‎2008 Mar 25 12:23 PM
Hi,
Thanku for ur reply.
I used the insert stmt how u mentioned , I am getting sy-subrc value as 0 after INSERT stmt is processed, but no record is added in my database table.
what might be the problem? help me plz..
My code is :(no loop stmt here), i hav values in wa directly.
zmmgp_h-zz_gpno = g_gpno_count.
zmmgp_h-zz_gptype = wa_zmmgp_h-zz_gptype.
zmmgp_h-zz_gpdate = wa_zmmgp_h-zz_gpdate.
zmmgp_h-zz_gpreturn = wa_zmmgp_h-zz_gpreturn.
zmmgp_h-zz_gpexpdt = wa_zmmgp_h-zz_gpexpdt.
zmmgp_h-zz_gpactdt = wa_zmmgp_h-zz_gpactdt.
zmmgp_h-zz_locissue = wa_zmmgp_h-zz_locissue.
zmmgp_h-zz_personname = wa_zmmgp_h-zz_personname.
zmmgp_h-zz_destination = wa_zmmgp_h-zz_destination.
zmmgp_h-zz_remark1 = wa_zmmgp_h-zz_remark1.
zmmgp_h-zz_remark2 = wa_zmmgp_h-zz_remark2.
INSERT zmmgp_h.
insert into ZMMGP_H values wa_zmmgp_h.