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

Update a Custom Table

Former Member
0 Likes
2,301

Hi,

Now I created a module pool program in which I usde following code to insert values in to custom table, but now I get a ABAP DUMP at the time of executing the Insert statement

I used the following code

*Declear an Internal Table is having the same structure of Custom Table

DATA : ty_znew_customer TYPE STANDARD TABLE OF znew_customer WITH HEADER LINE.

*Move the Values to internal Table ty_znew_customer

*Lock Table

CALL FUNCTION 'ENQUEUE_E_TABLE'

EXPORTING

mode_rstable = 'X'

tabname = 'ZNEW_CUSTOMER'

x_tabname = ' '

x_varkey = ' '

_scope = '2'

_wait = ' '

_collect = ' '

EXCEPTIONS

foreign_lock = 1

system_failure = 2

OTHERS = 3.

*Insert Records In to Custom Table

BREAK-POINT.

INSERT znew_customer FROM TABLE ty_znew_customer.

COMMIT WORK.

BREAK-POINT.

while executing that insert statement Sy-subrc is set to 4 and I get an Error

*un Lock Table

CALL FUNCTION 'DEQUEUE_E_TABLEE'

EXPORTING

mode_rstable = 'X'

tabname = 'ZNEW_CUSTOMER'

  • VARKEY = 'CUSTOMER'

x_tabname = ' '

x_varkey = ' '

_scope = '3'

_synchron = ' '

_collect = ' '

.

Please help me to solve this

Regards

Nausal

6 REPLIES 6
Read only

Sm1tje
Active Contributor
0 Likes
1,464

And what dump would that be, or do we have to take a wild guess first?

Read only

Former Member
0 Likes
1,464

Hi,

Could you specify what error are you getting exactly? Insert statement gives dump if the record with the same primary key values already exists in the table.

Regards

Radhika

Read only

former_member194669
Active Contributor
0 Likes
1,464

My wild guess will that your custom table znew_customer have records with same key that you are inserting

Please make sure before inserting that same key records that already not available in custom table

a®

Read only

Former Member
0 Likes
1,464

Hi,

In addition to wat a®s has suggested, please check this.

I am not too sure, but may be you can just check them.

Try changing the mode of the lock to 'E'.

Read only

Former Member
0 Likes
1,464

HI

Try with

Insert table name FROM TABLE itab [ACCEPTING DUPLICATE KEYS] .

Regards

Srilaxmi

Read only

Former Member
0 Likes
1,464

Hi,

When you use the SYNTAX ...INSERT FROM TABLE.... it will dump if for any entry in the internal table an entry already

exists in the databse....

So check for existing entries before inserting.