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

control level+read

Former Member
0 Likes
362

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?

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
343

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'.

2 REPLIES 2
Read only

Former Member
0 Likes
344

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'.

Read only

0 Likes
343

thanks

you will study that in loops