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

Problem - Inserting Records into Hashed Tables

Former Member
0 Likes
1,553

Help for an ABAP Newbie...

How do I insert records into a hashed table?

I am trying the following, but get the error message,

*You cannot use explicit or implicit index operations with types "HASHED TABLE" or "ANY TABLE". "LT_UNIQUE_NAME_KEYS" has the type "HASHED TABLE".


 TYPES: BEGIN OF idline,
    id TYPE i,
    END OF idline.

  DATA: lt_unique_name_keys TYPE HASHED TABLE OF idline WITH UNIQUE KEY id,
        ls_unique_name_key LIKE LINE OF lt_unique_name_keys.

" Create a record and attempt to insert it into the internal table.
" Why does this cause a compilation error message?
 ls_unique_name_key-id = 1.
  INSERT ls_unique_name_key INTO lt_unique_name_keys.

Thanks,

Walter

1 ACCEPTED SOLUTION
Read only

matt
Active Contributor
0 Likes
768

INSERT ls_unique_name_key INTO TABLE lt_unique_name_keys.

2 REPLIES 2
Read only

matt
Active Contributor
0 Likes
769

INSERT ls_unique_name_key INTO TABLE lt_unique_name_keys.

Read only

Former Member
0 Likes
768

Thanks, Matthew!