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

Hashed table

rohit_trivedi
Product and Topic Expert
Product and Topic Expert
0 Likes
444

Hi,

I've a select query which is selecting data in a hashed internal table ( gt_but100 ).

The table key is defined as 'Partner'.

SELECT * FROM but100 INTO TABLE gt_but100

FOR ALL ENTRIES IN gt_blocked_bp

WHERE partner EQ gt_blocked_bp-partner

AND rltyp IN s_parro.

The query works fine is there is only entry in s_parro.

But gives a ITAB_DUPLICATE_KEY short dump when it has more then 1 value.

How could i avoid that?

Regards,

Rohit.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
395

Hi rohit,

1. Duplicate key

2. define your internal table gt_but100

like this

(and then u won't get any error)

3.

*----


<b>data : gt_but100 like hashed table of but100

with unique key <b>MANDT PARTNER RLTYP DFVAL</b>

with header line.</b>

4. Hashed tables don't take any duplicate record,

hence,

we have to specify all the KEY FIELDS,

when declaring the table.

regards,

amit m.

2 REPLIES 2
Read only

athavanraja
Active Contributor
0 Likes
395

thats the way hashed tables work.

you can go for normal itab where duplicates are not checked

or change the hashed table definition to extend the key definition

Regards

Raja

Read only

Former Member
0 Likes
396

Hi rohit,

1. Duplicate key

2. define your internal table gt_but100

like this

(and then u won't get any error)

3.

*----


<b>data : gt_but100 like hashed table of but100

with unique key <b>MANDT PARTNER RLTYP DFVAL</b>

with header line.</b>

4. Hashed tables don't take any duplicate record,

hence,

we have to specify all the KEY FIELDS,

when declaring the table.

regards,

amit m.