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

loading internal table to database table

Former Member
0 Likes
1,564

Hi all,

I have created a ztable .also i created an internal table with the same structure as ztable.I have some data in internal table.how to load these data from internal table into database table.how thre insert statement will be.

8 REPLIES 8
Read only

former_member378318
Contributor
0 Likes
1,018

INSERT <database table> FROM TABLE <internal table>

Read only

Former Member
0 Likes
1,018

If the table is empty, then use

INSERT ZTABLE FROM TABLE ITAB

if u have some data in table , then use

MODIFY ZTABLE FROM TABLE ITAB

Read only

Former Member
0 Likes
1,018

Hi,

If u want to create new entry u can use INSERT Command , for updating existing record use UPDATE command.

But One more command called MODIFY is there which will take care of both insert and update based on key fields.

Reward points if input is usefull.

Regards,

A.Thuyavan.

Read only

Former Member
0 Likes
1,018

hi,

u can use INSERT or INSERT LINES OF statement depening on your requirement as

ex: INSERT MARA[database table] FROM TABLE itmara [ uinternal table]

INSERT LINES OF MARA[database table] FROM TABLE itmara [ uinternal table]

if helpful reward some points.

with regards,

Suresh.A

Read only

Former Member
0 Likes
1,018

use

MODIFY ZTABLE FROM TABLE ITAB

as if when a record exists it will modify the database entry and if no record exists it will insert the data into the database.

Read only

Former Member
0 Likes
1,018

Hi,

Check whether entries are there in the internal table. Also check for the structure.

MODIFY dbtab FROM TABLE itab.

UPDATE dbtab FROM TABLE itab.

just read this.

If you just want to write (INSERT) 1.5 million rows of an internal table into a database table, use:

INSERT <table name> FROM TABLE <itab>.

Transaction Log Size could be a problem, therefore writing in packages could help, but this depends on your row size, your database configuration and on the current changes to your database. May be it runs in one package, if the rows are small (few bytes) then one package will be the fastest but you'll not much faster than with reasonable packages (3-20 MBytes). On Oracle with rollback segments you will probably have no problems at 1.5 million rows.

<b>Rewrad points</b>

Regards

Read only

Former Member
0 Likes
1,018

HI Hemavathi

Go through this example:

-


TABLES spfli.

DATA wa TYPE spfli.

wa-carrid = 'LH'.

wa-cityfrom = 'WASHINGTON'.

...

INSERT INTO spfli VALUES wa.

wa-carrid = 'UA'.

wa-cityfrom = 'LONDON'.

...

INSERT spfli FROM wa.

spfli-carrid = 'LH'.

spfli-cityfrom = 'BERLIN'.

...

INSERT spfli.

-


Thanx

Adhir.

Read only

0 Likes
1,018

see following links

itab_zgseg-docno = ge_no.

insert into znor values ITAB_znor.

insert into zgseg values itab_zgseg.

Modify should be used instead of insert

MODIFY statement will AUTOMATICALLY

insert/update the records

based upon the primary key combination value

found/ not found in database.