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

Standard Internal Table with KEY

Former Member
0 Kudos
1,870

Hi,

I created a standard internal table with character and non-character fields. So the internal table will be created with non-unique key by default containing only character fields as non-unique key. Whereas Non-character/numeric fields wont be key for the internal table.

My Question is.

When i read the internal table with key using one character field and one numeric field, it is fetching the first identified record.

But i have mentioned in statement as WITH KEY, even though numeric field is not key field in internal table it fetched the record.

Please clarify either it should have some exception/compile time error or atleast SY-SUBRC NE 0.

Example code.

READ TABLE i_tab TRANSPORTING NO FIELDS WITH KEY char = value1 num = value2.
1 ACCEPTED SOLUTION
Read only

retired_member
Product and Topic Expert
Product and Topic Expert
1,465

Simply use F1 on WITH KEY and read the documentation!

It is clearly said there, that WITH KEY allows you to enter a free search key that is independent from the table key. In order to enter the table key, you use WITH TABLE KEY.

https://help.sap.com/http.svc/rc/abapdocu_752_index_htm/7.52/en-US/index.htm?file=abapread_table_fre...

3 REPLIES 3
Read only

retired_member
Product and Topic Expert
Product and Topic Expert
1,466

Simply use F1 on WITH KEY and read the documentation!

It is clearly said there, that WITH KEY allows you to enter a free search key that is independent from the table key. In order to enter the table key, you use WITH TABLE KEY.

https://help.sap.com/http.svc/rc/abapdocu_752_index_htm/7.52/en-US/index.htm?file=abapread_table_fre...

Read only

0 Kudos
1,465

Thanks Horst. I will read it.

Read only

matt
Active Contributor
0 Kudos
1,465

Do you think that next time you might read the documentation before asking a question here?