Application Development 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: 

Insert and modify

Former Member
0 Kudos

Hi Experts,

I have an internal table itab with data.

i hace db table ztab.It has 0 entries.

if i want to populate data from itab..which is better method..is Insert or modify

in some cases i got short dump when using :

insert ztab from table itab.

this ztab is copied from ztable(in se11,copy option is there)

But when i use :

modify ztab from table itab..it is exicuting fine.

Can any body give me clarification on this?

Thanks in Advance.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi Jak,

THe insert will throw a short dump if you try to enter a row with same set of primry key field values..

modify will change the contents of the existing row if the set of key field values are same..

so it is better to use MODIFY as it updates if the entry is not found..

regards'

satesh

6 REPLIES 6

Former Member
0 Kudos

Use INSERT when you insert fields in the database.

MODIFY to change existing row or insert if not available.

You might have got error if you try to insert a record with the same key fields.

Message was edited by: Wenceslaus G

Former Member
0 Kudos

Hi Jak,

THe insert will throw a short dump if you try to enter a row with same set of primry key field values..

modify will change the contents of the existing row if the set of key field values are same..

so it is better to use MODIFY as it updates if the entry is not found..

regards'

satesh

suresh_datti
Active Contributor
0 Kudos

Hi Jak,

MODIFY: Inserts new lines or updates existing lines of a database table.

The short dump with insert may be due to a duplicate entry.

If you are not sure if an entry with the same key exists or not it is better to use MODIFY always..

Regards,

Suresh Datti

Former Member
0 Kudos

Hi

I think it depends on what you really want to do.

Anyway if your trx have to create and not update the records, it's better to use INSERT.

The stament INSERT <TABLE> FROM TABLE <ITAB> can get a dump if there are several records with the same key.

Max

Former Member
0 Kudos

Hi

INSERT ....only inerts data into datadabe table

MOdify ... inserts data when no similar entry is present; it modify if similar entry is present.

According to me for ur case u should use

<b>INSERT dbtab FROM TABLE itab ACCEPTING DUPLICATE KEYS</b>

because when u insert into data base from internal table ;

it will give dump if similar record are present in internal table

i mean that data which ur inserting from itab is already present in database table hence ur getting dump.

please revert bach if solved.

reagards

manoj

Message was edited by: Manoj Gupta

Former Member
0 Kudos

Hi,

if u want to insert data into database tables use <b>INSERT</b> satetment by using <b>ACCEPTING</b> duplicate values.your program gives short dump because ur passing the primary key more than once.Try to see that primary key feild value in <b>ITAB</b> should exist once.If u want to modify database table u can use <b>MODIFY</b> satement.