2014 Feb 24 9:51 AM
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.
2014 Feb 24 9:58 AM
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
2014 Feb 24 9:55 AM
2014 Feb 24 9:58 AM
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
2014 Feb 25 8:20 AM
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