2009 Nov 23 6:30 AM
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
2009 Nov 23 6:32 AM
And what dump would that be, or do we have to take a wild guess first?
2009 Nov 23 6:35 AM
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
2009 Nov 23 6:36 AM
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®
2009 Nov 23 7:21 AM
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'.
2009 Nov 23 9:09 AM
HI
Try with
Insert table name FROM TABLE itab [ACCEPTING DUPLICATE KEYS] .
Regards
Srilaxmi
2009 Nov 23 9:15 AM
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.