2007 Jan 31 5:12 AM
hi abappers,
instead of select sibgle i want to read a single value from an internal tabel.
how can i use this....
provide the syntax.
regards,
mansi
2007 Jan 31 5:16 AM
2007 Jan 31 5:18 AM
if its only 1 record
read table i_tab into wa_tab index 1. ? not too sure on this.
or if you have condition
read table i_tab into wa_tab WITH key FIELD = SEARCH_TERM
binary serach
transporting <FIELD>
that <field> is the fields that you want to use.
2007 Jan 31 5:19 AM
Hi
Either use READ table
or
loop at itab where condition and move the value to a variable
Thanks
Shiva
2007 Jan 31 5:20 AM
HI,
There are two ways using READ TABLE..
READ TABLE itab into wa_area INDEX 1.
READ TABLE itab into wa_area INDEX n.
READ TABLE itab into wa_area WITH KEY filed1 = value1. (Use key).
Regards,
Sesh
2007 Jan 31 5:20 AM
Use READ statement
READ TABLE itab INTO wa_itab WITH key <FIELD> = <value>.
OR
READ TABLE itab INTO wa_itab INDEX <num>.
2007 Jan 31 5:24 AM
Hi,
To read a single entry from a table you ahve to use READ.
READ TABLE itab WITH INDEX 1.
READ TABLE itab WITH KEY matnr = '10000010'.
After read u have to use a sy-subrc check and proceed.
If you want to read based on some values from a table then
LOOP AT itab.
CLEAR itab2.
READ TABLE itab2 WITH KEY matnr = itab-matnr.
IF sy-subrc = 0.
...........
ENDIF.
ENDLOOP.
Hope this solves ur query, please close the thread by rewarding points.
2007 Jan 31 5:31 AM
2007 Jan 31 6:08 AM
Hi Mansi,
You can use READ TABLE for reading a single entry.
You have your data in the internal table so just read the table inside the loop using index or the key.
READ TABLE <itab> WITH KEY <k1> = <f1>... <kn> = <fn> <result>.
READ TABLE <itab> INDEX <idx> <result>.
The system reads the line with the index <idx> from the table <itab>.
The <result> part can specify a further processing option for the line that is retrieved.
If an entry with the specified index was found, the system field SY-SUBRC is set to 0 and SY-TABIX contains the index of that line. Otherwise, SY-SUBRC is set to a value other than 0.
Regards,
Papiya.
2007 Jan 31 6:23 AM
Hi,
Select Single is use d to read a single first matching line from the database table and not from the internal table.
To read a line from the internal table you have to use the READ TABLE itab with KEY fld1 = val1 BINARY SEARCH.
Addition of binary search improves performance, but the table should be sorted on that field.
Regards
Subramanian
2007 Jan 31 6:33 AM
Hi Mansi,
use <b>READ TABLE itab into wa_area INDEX n</b>
reward point if helpful.