‎2010 Dec 15 4:50 PM
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?
‎2010 Dec 15 5:01 PM
If i add GJAHR(fiscal year) to the select statement, will it correct the problem?
Why don't you try it and find out????
‎2010 Dec 15 5:01 PM
Why don't you replicate (and fill) the full primary key of table BKPF, then you have uniqueness, guaranteed.
Thomas
‎2010 Dec 15 5:04 PM
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
‎2010 Dec 16 10:33 AM
While fetching data make sure u include alll the primary keys of teh table is well.