‎2010 Dec 08 11:09 AM
hi everyone
in a program, im doing an INSERT into a ztable from an internal table
Now this program is getting executed by several users at the same time and the program is getting a short dump
The ABAP/4 Open SQL array insert results in duplicate database records.
anybody can help me how i can handle this?
I tried to replace INSERT by MODIFY but its not working
‎2010 Dec 08 11:16 AM
Hi,
You cannot insert duplicate values into the table using INSERT statement. MODIFY or UPDATE would work but that would overwrite the date with the same key fields.
If this table is used to maintain some log, then you have to use INSERT and to help further please post the key fields in the table ?
Thanks,
Sri.
‎2010 Dec 08 11:16 AM
Hi,
You cannot insert duplicate values into the table using INSERT statement. MODIFY or UPDATE would work but that would overwrite the date with the same key fields.
If this table is used to maintain some log, then you have to use INSERT and to help further please post the key fields in the table ?
Thanks,
Sri.
‎2010 Dec 08 11:20 AM
‎2010 Dec 08 11:24 AM
Hi,
As you said earlier, that different users may insert records at the same time and if the table contains some time field then that would give a dump for having duplicate values. So you better make the time field along with the ID as a key field in the table.
Thanks,
Sri.
‎2010 Dec 08 11:31 AM
Define your own number range object for your key field.
Look at transaction SNRO
As you said earlier, that different users may insert records at the same time and if the table contains some time field then that would give a dump for having duplicate values. So you better make the time field along with the ID as a key field in the table.
There is still a change to have duplicates.
‎2010 Dec 08 11:31 AM
‎2010 Dec 08 11:35 AM
hi sri
another question
when doing the INSERT, its not necessary to specify the field time
i just have to define this field, UZEIT TYPE SY-UZEIT and during the INSERT, this field will be populated automatically, right?
‎2010 Dec 08 11:38 AM
>
> hi sri
> another question
> when doing the INSERT, its not necessary to specify the field time
>
> i just have to define this field, UZEIT TYPE SY-UZEIT and during the INSERT, this field will be populated automatically, right?
Nope.
But again: i bet you still will have some duplicates. So just go for your own number range object for your key field. Than you'll know the value will be unique.
To clarify: you said at the same time'. What time will be in that UZEIT field if you get the time for several users at the same time ?
It's the value of your key field that must be unique,
‎2010 Dec 08 11:44 AM
hi maen
with the field uzeit, hows its possible to have the dump?there will always be a difference of 1 second, isnt it?
‎2010 Dec 08 11:47 AM
i think i must make user as well a key field
the users dont want to go for the option of object range
is making the id, time and user the key fields a plausible solution?
‎2010 Dec 08 11:47 AM
with the field uzeit, hows its possible to have the dump?there will always be a difference of 1 second, isnt it?
Nope. Not always.
Why not a number range?
‎2010 Dec 08 11:51 AM
>
> is making the id, time and user the key fields a plausible solution?
Sure it's plausible. You may add date as well. And their date of birth... and their zipcode. And the date of birth of their firstborn child... the name of their secret lover...
Why complicate things if you can solve it easily with just a simple number range?
‎2010 Dec 08 12:22 PM
Hi Prema,
Why don't you make use of lock objects on the table?
Regards,
Jaya krishna.K
‎2010 Dec 08 12:24 PM
Sorry if it sounds a bit out of context, but wouldnt this be a perfect scenario for a enqueue/dequeue process?
‎2010 Dec 08 12:28 PM
>
> Sorry if it sounds a bit out of context, but wouldnt this be a perfect scenario for a enqueue/dequeue process?
Would that be a viable option when only inserting new records?
Truth be told: i have no clue what the purpose of his Z-table is and whether he only inserts new records or also need to update existing ones.
‎2010 Dec 08 12:51 PM
‎2010 Dec 08 11:36 AM
Hi,
Before inserting the data into internal table we need to check whether that data is already available in database or not.
if the data is already in database no need to insert the data.Then if parallel users are using no problem.
STEP1:Select the data from table.
STEP2:LOOP The data and check the data whether data is already there or not.
STEP3:Other wise insert the data into table.
regards,
muralii.