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

insert into dbtab

Former Member
0 Likes
2,924

Hi to all.

i wanna insert records from itab into dbtab/

when i use this command:

INSERT dbtab FROM TABLE itab.

the program is fall on this line and i get this msg:

"It is too big".

what i wanna do is just transfer from itab the corresponding fields to the dbtab.

plz help me.

thanks.

16 REPLIES 16
Read only

Former Member
0 Likes
1,832

Hi gil,

1. Simple.

2. declare your itab EXACTLY like dbtab.

3. then use this logic.

LOOP AT ITAB.

MODIFY DBTAB FROM ITAB.

ENDLOOP.

(THIS WILL TAKE CARE OF ADD/EDIT

BASED UPON THE PRIMARY KEY,

AUTOMATICALLY)

regards,

amit m.

Read only

Former Member
0 Likes
1,832

use workarea instead oof whole internal table data.

INSERT INTO dbtab VALUES wa.

Read only

Former Member
0 Likes
1,832

use Modify statement of Inserting or Updating records.

The MODIFY statement changes existing lines and inserts lines which do not exist.

Syntax is :

Modify dbtablename from itab(internal table name).

Read only

Former Member
0 Likes
1,832

Hi Gil,

You can insert record in DB table using.

<b>Insert statement</b>

INSERT dbtab FROM TABLE itab

<b>Modify Statement</b>.

MODIFY dbtab FROM wa

  • If record doesn't exsist it will insert a new record in that.

Cheers

Sunny

Read only

vinod_gunaware2
Active Contributor
0 Likes
1,832

Use

MODIFY dbtab FROM TABLE itab. or

MODIFY (dbtabname) FROM TABLE itab.

befor modify populate all data into itab.

Regards

vinod

Read only

Former Member
0 Likes
1,832

Hi,

Your itab must match with the dbtab.

Have you declared the internal table as dbtable.

If yes, then your command is perfect.

Just check the structures are matching or not.

Regards,

Shashank

Read only

0 Likes
1,832

Hi,

Such type of errors pops up when you are trying to upload entire data of Internal table in to database table... So as to overcome such situation use work area

i.e,

<b>INSERT INTO dbtab VALUES wa.</b>

Read only

0 Likes
1,832

i know that t itab have more fields the the dbtab ,

i just wanna insert the corresponding fields to the dbtab.

thanks.

Read only

0 Likes
1,832

Hi,

If the itab has more fields, then check the sequence of fields. It should match with that in the actual dbtab.

Regards,

Shashank

Read only

0 Likes
1,832

declare an internal table (say itab1) like dbtab.

then use move-corresponding to copy lines of itab into this internal table.

now use the insert statement using itab1.

Read only

Former Member
0 Likes
1,832

Hi,

INSERT dbtab FROM TABLE itab.

The structure of itab must be at least as wide as the table work area dbtab and its alignment must correspond to that of the table work area, otherwise a runtime error will occur.

Riyaz

Read only

hymavathi_oruganti
Active Contributor
0 Likes
1,832

PROBABLY THE INTERNAL TABLE STRUCTURE AND DBTAB ARE NOT SIMILAR

Read only

Former Member
0 Likes
1,832

if ur itab is not matching the dbtab then u go for modify statement.

i thought it was

itab like DBTAB occurs 0 with header line.

but as per ur reply it is not.

so now ur option has to be this one.

see that u r itab is containg all the primary keys as that of the DBtab.

if this is not so then there may be a CONFLICT OF INSERTING DUPLICATE ENTIRES.

say ur DBTAB has primary keys P1, P2, P3.

so ur ITAB has to contain the three keys .

then get the content into itab.

loop at itab.

modify table DBTAB from ITAB.

endloop.

hope this helps ,

vijay.

Read only

Former Member
0 Likes
1,832

Hi Gil

U have to declear the same structure as dtab and then try to insert.

u can use move corresponding itab to dbtab.

it will move all the fields that are matching in itab or else i wont move.

i think this will solve u r prob

Thanks

Vikranth Khimavath

Read only

0 Likes
1,832

ok...

the problem is that the itab that i read from is declare like this:

DATA: BEGIN OF invctab OCCURS 0,

k LIKE vbrk,

p LIKE vbrp,

x LIKE extras.

DATA: END OF invctab.

and i need to move-corresponding fields to dbtab.

i try to move-corresponding to my dbtab.

and the msg its to big return.

any idea?

Read only

0 Likes
1,832
loop at invctab.
  move-coresponding invctab to dbtab.
  append dbtab.
  clear dbtab.
endloop.

Message was edited by: Sekhar