Application Development 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 Table With Key

Former Member
0 Kudos

I am trying to get the sy-tabix of a record in an internal table.

The key I am using is a field in the internal table that will be unique.

I get sy-sub = 4, so I assume I am not defining the key in full.

The code is:

CONCATENATE g_dimen i_bunit INTO l_nodename.

READ TABLE lt_e_t_rsnodes_lnk WITH KEY nodename =

l_nodename

BINARY SEARCH TRANSPORTING NO FIELDS.

Any suggestions? Thank-You.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Did you sort your Internal table lt_e_t_rsnodes_lnk before reading?

VInodh Balakrishnan

6 REPLIES 6

Former Member
0 Kudos

Did you sort your Internal table lt_e_t_rsnodes_lnk before reading?

VInodh Balakrishnan

former_member191735
Active Contributor
0 Kudos

If you use binary search, you need to sort the internal table first.

before read to the internal table you need to sort your internal table. lt_e_t_rsnodes_lnk

Reward if helpful

Former Member
0 Kudos

Is the table sorted by nodename?

Rob

Former Member
0 Kudos

Try without binary search and see if it works.

Also check if concatenate statement is populating the string same as in your internal table. Sometimes spaces may lead to different values.

-Cheers

former_member194669
Active Contributor
0 Kudos

Can you please check the values for the following

g_dimen

i_bunit

l_nodename.

may be try to use


CONCATENATE g_dimen i_bunit INTO l_nodename.
condense l_nodename no-gaps.

and also make sure your table lt_e_t_rsnodes_lnk will be sort properly

former_member156446
Active Contributor
0 Kudos

Hi Tom

I am asuusming that table lt_e_t_rsnodes_lnk have the value similar to that formed by concatenating g_dimen i_bunit.

if you are doing a binary search you need to sort the table for sure..

sort lt_e_t_rsnodes_lnk by nodename.

-


try the above if not...

becoz ur sy-subrc eq 4. looks like the table doesnt have a value similar to that formed by concatenating that fields. check ur data in the table.