‎2009 Jul 20 10:07 AM
<l_table1> is defined as an sorted table and new_table from method create_dynamic_table is coming as standard table.
when we write a statement "ASSIGN new_table1->* TO <l_table1>." Its giving runtime error type conflict.
Could you please let me know how to create sorted internal table by using method create_dynamic_table.
Create a new Table
CALL METHOD cl_alv_table_create=>create_dynamic_table
EXPORTING
it_fieldcatalog = it_fieldcat1
IMPORTING
ep_table = new_table1.
Create a new Line with the same structure of the table.
ASSIGN new_table1->* TO <l_table1>.
‎2009 Jul 20 10:14 AM
Hi,
<li><l_table1>and new_table1 should be declared like below.
<li>Fieldcatalog must be created before we call CALL METHOD cl_alv_table_create=>create_dynamic_table.
I hope that it helps u .
Thanks
Venkat.O DATA:it_dyn_tab TYPE REF TO data.
"Filed symbols
FIELD-SYMBOLS:<gt_table> TYPE STANDARD TABLE.
CALL METHOD cl_alv_table_create=>create_dynamic_table
EXPORTING
it_fieldcatalog = it_fcat
IMPORTING
ep_table = it_dyn_tab.
ASSIGN it_dyn_tab->* TO <gt_table>.
‎2009 Jul 20 10:35 AM
Hi,
The code which you have sent me is working fine. but i want to have <gt_table> as sorted table not as standard table. I just wanted to use binary seach on <gt_table> and for that it needs to be sorted table.
Could you please help me with that.
Regards
‎2009 Jul 20 11:24 AM
Hi, <li>Difficult to define SORTED dynamic table because, We do not know the structure and fields until run time. For SORTED tables, We need to specify key fields. We do not know fields so defining key fields highly impossible. <li>If you want to use addition BINARY SEARCH, We can even use that for STANDARD TABLES. <li>If the addition BINARY SEARCH is specified, the search is binary instead of linear. This considerably reduces the runtime of the search for larger tables (from approximately 100 entries upwards). <li>For the binary search, the table must be sorted by the specified search key in ascending order. Otherwise the search will not find the correct row. Thanks Venkat.O
‎2009 Jul 20 11:59 AM