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

ITAB_DUPLICATE_KEY dump

Former Member
0 Likes
551

Hi all.

I have the following select statement in my program:

SELECT

bukrs

belnr

blart

bldat

budat

monat

cpudt

cputm

aedat

usnam

tcode

bktxt

waers

xnetb

ausbk

brnch

FROM bkpf

INTO TABLE gt_bkpf

WHERE bukrs IN s_bukrs

AND belnr IN s_belnr

AND gjahr EQ p_gjahr

AND blart IN s_blart

AND bldat IN s_bldat

AND budat IN s_budat

AND monat EQ p_monat

AND usnam IN s_usnam

AND tcode IN s_tcode.

Internal table GT_BKPF is declared as follows:

gt_bkpf TYPE HASHED TABLE OF tt_bkpf WITH UNIQUE KEY belnr,

Now BKPF table contains all FI documents. You can have the same FI document number belonging to 2 different fiscal years:

e.g 5100000000 2010 , 5100000000 2011

In my opinion, since BELNR is declared as unique key in GT_BKPF , when the table access is getting the same document numbers twice, it is dumping.

If i add GJAHR(fiscal year) to the select statement, will it correct the problem?

4 REPLIES 4
Read only

brad_bohn
Active Contributor
0 Likes
488

If i add GJAHR(fiscal year) to the select statement, will it correct the problem?

Why don't you try it and find out????

Read only

ThomasZloch
Active Contributor
0 Likes
488

Why don't you replicate (and fill) the full primary key of table BKPF, then you have uniqueness, guaranteed.

Thomas

Read only

Former Member
0 Likes
488

Hi,

add bukrs gjahr to the key of the hashed table.

gt_bkpf TYPE HASHED TABLE OF tt_bkpf WITH UNIQUE KEY bukrs belnr gjahr.

Also include field gjahr in the internal table structure as well as in select statement.

Regards

Praveen

Edited by: praveen reddy on Dec 15, 2010 6:05 PM

Read only

0 Likes
488

While fetching data make sure u include alll the primary keys of teh table is well.