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

read statment using two fields.

Former Member
0 Likes
672

Hi ,

i need to read internal table using two fields,

for example - *READ TABLE lt_cepc_bukrs INTO lw_cepc_bukrs WITH KEY bukrs = l_bukrs prctr =lt_cepc-bukrs BINARY SEARCH*...

Based on Bukrs and prctr i need to read my internal table .Can any one give me correct syntex.

Regards,

Veera

4 REPLIES 4
Read only

Former Member
0 Likes
613

Hi,

READ TABLE itab { table_key

| free_key

| index } result.

Effect

This statement reads a row from internal table itab. You have to specify the row by either naming values table_key for the table key, a free condition free_key or an index index. The latter choice is possible only for index tables. The output result result determines when and where the row contents are read.

If the row to be read is not uniquely specified, the first suitable row is read. In the case of index tables, this row has the lowest table index of all matching rows.

System Fields

The statement READ TABLE sets system fields sy-subrc and sy-tabix.

sy-subrc Relevance

0 Row found. sy-tabix is set to the table index of the entry for index tables, and to the value 0 for hashed-tables.

2 Like sy-subrc equals 0. Differentiates cases that use the addition COMPARING in result.

4 Row not found. If the entry was determined with a binary search, then sy-tabix is set to the table index of the entry before which it would have to be inserted with INSERT ... INDEX ..., if you want to keep the sorting order. This is the case if the addition table_key or free_key was specified for a beginning part of the table key of sorted tables, or if the addition BINARY SEARCH was specified explicitly. Otherwise, sy-tabix is undefined.

8 Like sy-subrc equals 4. If the entry was determined with a binary search, and the end of the table was reached, then sy-tabix is set to the number of rows + 1.

The system fields sy-tfill and sy-tleng are also supplied with data.

Read only

Sm1tje
Active Contributor
0 Likes
613

prctr =lt_cepc-bukrs

this is not possible. You need to define a variable for you BUKRS or a selection screen parameter for comparison with PRCTR from internal table.

Read only

GauthamV
Active Contributor
0 Likes
613

hi,

use it like this.

ex:

READ TABLE IT_EKBE WITH KEY

EBELN = IT_EKPO-EBELN

EBELP = IT_EKPO-EBELP

BEWTP = 'E' .

dont use binary search it is obselete.

reward if hlpful.

Read only

Former Member
0 Likes
613

Look..

Read table itab with key matnr = itab1-matnr mtart = itab1-mtart.