‎2014 May 20 6:49 AM
Hi everybody,
I defined an ITAB with
where int_ui is a data-element not a structure!
So, the following is not possible:
Does anbody know how to performe the binary search?
Thanks
Regards
Mario
‎2014 May 20 7:19 AM
Use pseudo component TABLE_LINE in the READ TABLE statement (press F1 or google help.sap.com)
Regards,
Raymond
‎2014 May 20 7:11 AM
Hi Mario,
Try this:
TYPES: BEGIN OF ty_int_ui,
int_ui TYPE int_ui,
END OF ty_int_ui.
DATA: lt_rlm_pods TYPE TABLE OF ty_int_ui.
READ TABLE lt_rlm_pods WITH KEY int_ui = ls_anlage-int_ui
BINARY SEARCH
TRANSPORTING NO FIELDS.
Regards,
Viswa.
‎2014 May 20 7:13 AM
Hi Viswa,
yes, I tried this already. But I wanted to know, how it works with:
🙂
Regards
Mario
‎2014 May 20 7:19 AM
Try to check the structure of the Table created in Debug mode. You might understand.
‎2014 May 20 7:21 AM
Hi Mario,
for key access WITH KEY you need one or several fields, and for BINARY SEARCH the table must be sorted by this field(s). Without fields you can't use this READ TABLE itab WITH KEY option.
Regards,
Klaus
‎2014 May 20 7:19 AM
Use pseudo component TABLE_LINE in the READ TABLE statement (press F1 or google help.sap.com)
Regards,
Raymond
‎2014 May 20 7:24 AM
Hi,
thank you all!
As it is not possible I mark the question as answered.
Regards Mario
‎2014 May 20 7:28 AM
Wrong, did you try my solution ?
REPORT ztableline.
DATA: itab TYPE TABLE OF i.
APPEND 1 TO itab.
APPEND 10 TO itab.
APPEND 2 TO itab.
SORT itab.
READ TABLE itab TRANSPORTING NO FIELDS WITH KEY table_line = 2 BINARY SEARCH.
WRITE: / '2', sy-subrc.
READ TABLE itab TRANSPORTING NO FIELDS WITH KEY table_line = 3 BINARY SEARCH.
WRITE: / '3', sy-subrc.Regards,
Raymond
‎2014 May 20 7:30 AM
The READ statement is possible on your Table. But if you check it in debug mode you will see that the structure of your table is as follows
LINE | TABLE_LINE |
Hence the WITH KEY condition in your READ statement must be on the column TABLE_LINE.
Regards,
Mayur Priyan. S
‎2014 May 20 7:32 AM
Hi Mario,
Raimond wants you to have a look at this:
http://help.sap.com/saphelp_nw70/helpdata/en/fc/eb35f8358411d1829f0000e829fbfe/content.htm
There the option
READ TABLE itab WITH TABLE KEY table_line = f result.
might be of interest.
Regards,
Klaus
‎2014 May 20 7:42 AM
‎2014 May 20 7:46 AM
‎2014 May 20 7:49 AM
Hi Raymond,
sorry. In deed you are right. Unfortunately I cannot give a perfect 10, because I marked it already as soled.
Sorry, Regards
Mario