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

Read on nonunique key

Former Member
0 Likes
659

Hi All,

I have a question, I have this internal sorted table on nonunique key Acct.Number.

I 'read' this internal table on this key Acct.number (I am using binary search).

The internal table looks like this(just a sample) there are lot of records in the internal table.

Acct.Num Date_start Date_end Amount

12345 20060401 20060502 10.00

12345 20060503 20060610 50.00

12345 20060401 99991231 100.00

My creteria is to read a record 12345 20060401 99991231 100.00,

since all the three records have key 12345 and I cannot have Date_start <= current_date and Date_end >= current_Date.

I am not able to use read with key as it is struck in the first record and I don't want to use 'loop at'.

Please let me know how can I get it worked.

Thanks,

1 ACCEPTED SOLUTION
Read only

Former Member

Hi All,

I have a question, I have this internal sorted table on nonunique key Acct.Number.

I 'read' this internal table on this key Acct.number (I am using binary search).

The internal table looks like this(just a sample) there are lot of records in the internal table.

Acct.Num Date_start Date_end Amount

12345 20060401 20060502 10.00

12345 20060503 20060610 50.00

12345 20060401 99991231 100.00

My creteria is to read a record 12345 20060401 99991231 100.00,

since all the three records have key 12345 and I cannot have Date_start <= current_date and Date_end >= current_Date.

I am not able to use read with key as it is struck in the first record and I don't want to use 'loop at'.

Please let me know how can I get it worked.

Thanks,

3 REPLIES 3
Read only

Former Member
0 Likes
643

Try sorting table with Account no ascending and both dates in descending format.

This will keep the latest record on top of all other entries and as you are looking for latest record, your READ will be successful.

Read only

Former Member
0 Likes
643

read table it into wa index 3.

this is the simplest way of reading the table or use following way...

loop at internal table.

check the condition.

if u get ur required record then ok.

else

delete it from wa index sy-tabix.

endif.

endloop

reward points if useful.....

Read only

Former Member