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

Binary Search in Dynamic Read

former_member194669
Active Contributor
0 Likes
825

Here is the code


      read table <fs_it_crv> assigning <fs_wa_crv> with key
                                  ('objty') = wa_plfh-objty
                                  ('objid') = wa_plfh-objid
                                  binary search.

If i use binary search system giving error while activating as

You cannot use explicit or implicit index operations on tables with

types "HASHED TABLE" or "ANY TABLE". "" has the type "ANY

TABLE". It is possible that .

How could i use Binary search in dynamic read

a®

1 ACCEPTED SOLUTION
Read only

chaouki_akir
Contributor
0 Likes
736

Hello,

how do you create your internal table "<FS_IT_CRV>" ?

i found this thread [here|;.

You can try the code lines of David Klotz.

If you insert a sort statement before read and change read adding binary search it might work.

SORT <gt_itab> BY (ge_key_field1) (ge_key_field2) (ge_key_field3) .
* Finally, perform the search
  READ TABLE <gt_itab> ASSIGNING <gs_result>
          WITH KEY (ge_key_field1) = pa_cond1
                   (ge_key_field2) = pa_cond2
                   (ge_key_field3) = pa_cond3 BINARY SEARCH.

I tried the following code in my own program and it works:

SORT <wlf_t_data> BY (c_trkorr).
  read table <wlf_t_data> assigning <wlf_header> with key
         (c_trkorr) = 'DRR' binary search.

Where <wlf_t_data> is a dynamic table created by method create_dynamic_table of class cl_alv_table_create.

Cordialement,

Chaouki

4 REPLIES 4
Read only

chaouki_akir
Contributor
0 Likes
737

Hello,

how do you create your internal table "<FS_IT_CRV>" ?

i found this thread [here|;.

You can try the code lines of David Klotz.

If you insert a sort statement before read and change read adding binary search it might work.

SORT <gt_itab> BY (ge_key_field1) (ge_key_field2) (ge_key_field3) .
* Finally, perform the search
  READ TABLE <gt_itab> ASSIGNING <gs_result>
          WITH KEY (ge_key_field1) = pa_cond1
                   (ge_key_field2) = pa_cond2
                   (ge_key_field3) = pa_cond3 BINARY SEARCH.

I tried the following code in my own program and it works:

SORT <wlf_t_data> BY (c_trkorr).
  read table <wlf_t_data> assigning <wlf_header> with key
         (c_trkorr) = 'DRR' binary search.

Where <wlf_t_data> is a dynamic table created by method create_dynamic_table of class cl_alv_table_create.

Cordialement,

Chaouki

Read only

0 Likes
736

Thanks Chaouki.

That Worked. Issue solved

a®

Read only

0 Likes
736

don't you close the thread?

Read only

0 Likes
736

Sandra,

I tried to close this thread. but could not able to , the following is error i am getting for the past 2 days

An error has occured while assigning points. Please refresh the thread view and try again

a®