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

Using Hashed table

former_member463678
Participant
0 Likes
759

Hello experts,

Suppose a database table has key fields A, B, C, D, E, F and G. I define a Hashed internal table to fetch data from this database table.

types begin of ty_str,

          a,

          b,

          c,

          d,

          e,

          f,

          .................

          .................

          end of ty_str.

itab TYPE HASHED TABLE OF ty_str WITH UNIQUE KEY a b c d e.

Now my question is, database table is having A, B, C, D, E, F and G as key fields and itab is defined with A, B, C, D, E.

Does it make any data discrepancy while fetching data from database table to itab since itab key is defined with subset of database table.

loop at itab where a b c d.

................

endloop.

How it makes impact if am using only subset of itab key in WHERE condition.

Thanks,

Zak.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
717

Hi,

If the key in the DB table contains more fields than your internal hashed table, you might have data discrepancy (if not an error). The reason is that the hashed tables always must have a unique key.

Hope that helps.

Regards,

Leszek

3 REPLIES 3
Read only

RamanKorrapati
Active Contributor
0 Likes
717

Please check at

Read only

Former Member
0 Likes
718

Hi,

If the key in the DB table contains more fields than your internal hashed table, you might have data discrepancy (if not an error). The reason is that the hashed tables always must have a unique key.

Hope that helps.

Regards,

Leszek

Read only

former_member463678
Participant
0 Likes
717

Hi

When Hashed table is defined with Unique key which is subset of database table key, there might be duplication of data going into hashed table based on its key and it may give dump. Since Hashed tables don't take any duplicate record based on its key, it would be always better to define hashed table Unique key with all key fields of database table from where the data is selected.

Thanks,

Zak