Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

obsolete INSERT Statement

Former Member
0 Likes
831

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..

7 REPLIES 7
Read only

Former Member
0 Likes
765

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

Read only

Former Member
0 Likes
765

Insert as below ..

Loop at itab into wa_tab.

INSERT wa_tab INTO dbtab.

endloop.

Read only

0 Likes
765

Hi,

Either the values can be from Work area or Internal table:

That is:

INSERT INTO (dbtabname) VALUES wa.

INSERT (dbtabname) FROM TABLE itab.

Read only

0 Likes
765

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

Read only

0 Likes
765

Hi Sowmya,

IN ECC, we have to declare the internal table with some type and with separate work area.. it will work

Read only

0 Likes
765

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

Read only

0 Likes
765

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.