‎2008 Feb 04 7:09 AM
hello. my insert statement is as follows:
insert zfin_netting from TABLE gt_tab_netting ACCEPTING DUPLICATE KEYS.
however only 1 record is inserted while the table contains 12.
there is no primary key in the table.
‎2008 Feb 04 7:14 AM
Hi,
How did u declared gt_tab_netting?
Try avoiding ACCEPTING DUPLICATE KEYS in your statement.
Write COMMIT WORK Statement after INSERT Statement.
Regards,
Satish
‎2008 Feb 04 7:14 AM
Hi,
Did you put Insert in loop Statement.?
After insert Statement use Modify Statement.
‎2008 Feb 04 7:20 AM
use the following statement
INSERT <DataBasetable> FROM TABLE <Internal table>.
‎2008 Feb 04 7:28 AM
im getting a dump when i use
insert zfin_netting from TABLE gt_tab_netting .
the declaration is:
BEGIN of tt_tab_netting,
mandt TYPE sy-mandt,
BELNR TYPE ZFIN_NETTING-BELNR,
BUKRS_DEST TYPE ZFIN_NETTING-BUKRS_DEST,
TYP_FACT TYPE ZFIN_NETTING-TYP_FACT,
NAT_FACT TYPE ZFIN_NETTING-NAT_FACT,
CODE_VENT TYPE ZFIN_NETTING-CODE_VENT,
MONT_HT TYPE ZFIN_NETTING-mont_ht,
TAUX_TVA TYPE ZFIN_NETTING-TAUX_TVA,
DATE_MOUV TYPE ZFIN_NETTING-DATE_MOUV,
NUM_FACT TYPE ZFIN_NETTING-NUM_FACT,
END of tt_tab_netting.
data: gt_tab_netting type standard table of tt_tab_netting.
‎2008 Feb 04 7:32 AM
Hi,
This program is working fine for me..
Check this Exmple..
TABLES:MARA.
DATA:ITAB LIKE MARA OCCURS 0 WITH HEADER LINE.
START-OF-SELECTION.
ITAB-MATNR = '123ABCDA'. .
ITAB-MBRSH = 'C'.
ITAB-MTART = 'FERT' .
ITAB-MEINS = 'KG' .
APPEND ITAB.
ITAB-MATNR = '123ABCDB'. .
ITAB-MBRSH = 'C'.
ITAB-MTART = 'FERT' .
ITAB-MEINS = 'KG' .
APPEND ITAB.
LOOP AT ITAB.
INSERT MARA FROM ITAB.
MODIFY MARA .
ENDLOOP.
‎2008 Feb 04 7:33 AM
‎2008 Feb 04 7:28 AM
Hi,
If the addition ACCEPTING DUPLICATE KEYS is specified den only the internal table records that are duplicates(already exists in DBtable) ll be inserted....others ll be ignored....
so the record inserted (out of 12) is a duplicate entry.....
SAP Keyword help
Use of ACCEPTING DUPLICATE KEYS
If the addition ACCEPTING DUPLICATE KEYS is specified, all rows are inserted for which this is possible. The remaining rows are rejected and sy-subrc is set to 4. The system field sy-dbcnt is set to the number of lines that are inserted.
USE MODIFY KEYWORD
Cheers,
Will.
Edited by: Will smith on Feb 4, 2008 8:29 AM
‎2008 Feb 04 7:31 AM
Since the caller of the procedure could not have anticipated that
exception would occur, the current program is terminated.
The reason for the exception is:
If you use an ABAP/4 Open SQL array insert to insert a record in
the database and that record already exists with the same key,
this results in a termination.
‎2008 Feb 04 7:34 AM