2007 Sep 26 8:13 AM
Ques]]
THE STATEMENT
READ TABLE <itab> WITH TABLE KEY <k1> = <f1> <RESULT> .
Is therebut is it possible to refer to PARTIAL FIELDS as was possible with the statement
READ TABLE <itab> WITH KEY <k1> = <f1> <RESULT> .
Q]] The control level hierarchy must be known when you create an internal table --why?
2007 Sep 27 7:00 AM
Hi, abaper.
I found some thing in SAP Library:
Using a Different Search Key
To use a key other than the table key as a search key, enter <key> as follows:
READ TABLE <itab> WITH KEY = <f> <result>.
or as follows
READ TABLE <itab> WITH KEY <k1> = <f1> ... <k n> = <f n> <result>.
In the first case, the whole line of the internal table is used as the search key. The contents of the entire table line are compared with the contents of field <f>. If <f> is not compatible with the line type of the table, the value is converted into the line type. The search key allows you to find entries in internal tables that do not have a structured line type, that is, where the line is a single field or an internal table type.
In the second case, the search key can consist of any of the table fields <k 1 >...<k n >. If you do not know the name of one of the components until runtime, you can specify it as the content of a field <n i > using the form (<n i >) = <f i >. If <n i > is empty when the statement is executed, the search field is ignored. If the data types of <f i > are not compatible with the components in the internal table, the system converts them. <u><b>You can restrict the search to partial fields by specifying offset and length</b>.</u>
The search is linear for all table types. The runtime is in linear relation to the number of table lines.
I hope it's helpful.
And I'm a beginner, I don't know the meaning of 'The control level hierarchy'.
2007 Sep 27 7:00 AM
Hi, abaper.
I found some thing in SAP Library:
Using a Different Search Key
To use a key other than the table key as a search key, enter <key> as follows:
READ TABLE <itab> WITH KEY = <f> <result>.
or as follows
READ TABLE <itab> WITH KEY <k1> = <f1> ... <k n> = <f n> <result>.
In the first case, the whole line of the internal table is used as the search key. The contents of the entire table line are compared with the contents of field <f>. If <f> is not compatible with the line type of the table, the value is converted into the line type. The search key allows you to find entries in internal tables that do not have a structured line type, that is, where the line is a single field or an internal table type.
In the second case, the search key can consist of any of the table fields <k 1 >...<k n >. If you do not know the name of one of the components until runtime, you can specify it as the content of a field <n i > using the form (<n i >) = <f i >. If <n i > is empty when the statement is executed, the search field is ignored. If the data types of <f i > are not compatible with the components in the internal table, the system converts them. <u><b>You can restrict the search to partial fields by specifying offset and length</b>.</u>
The search is linear for all table types. The runtime is in linear relation to the number of table lines.
I hope it's helpful.
And I'm a beginner, I don't know the meaning of 'The control level hierarchy'.
2007 Sep 30 6:59 AM