‎2009 Jun 17 3:00 AM
Hi ,
My itab internal table is having 10 reocrds of kotabnr = '001' the below code i have written
will go for all 10 record or only one record.
if read will get only one record, means how best i can write the code to get 10 records from intrnal table without LOOP
-
READ TABLE Itab WITH KEY kotabnr = '001' TRANSPORTING NO FIELDS.
IF sy-subrc EQ 0.
Select
KBSTAT
KNUMH
from A912 into table i_a912 where knumh = ls_headr_item-knumh.
Endif.
Regards,
Sri
‎2009 Jun 17 3:08 AM
Read table command reads only one record ,that means it will go only one time,if you need multiple times then use loop and endloop.
Thank you
Seshu
‎2009 Jun 17 4:01 AM
Hi,
So whats the purpose of that READ statement, why you don't want to go for LOOP. If possible try to use For All Entries Statement in Select query, that will increase performance.
Regards
Karthik D
‎2009 Jun 17 4:14 AM
Karthik,
The loop is not allowed since the data volume is huge.The Read stmt is used to identfiy the data base table dynamically (which table we need to select more than on DB table i neeed to do select based on the interies-field in itab).
So only iam searching for new options which will give better performance...
Regards,
Sri
‎2009 Jun 17 4:47 AM
Hi,
Please use 'FOR ALL ENTRIES' in your select statement..... Read will always return only one instance...
‎2009 Jun 17 4:10 AM
Hi Sriram,
With read you can perform only these operations....
READ
Read an internal table
- READ TABLE itab FROM wa [additions].
- READ TABLE itab WITH TABLE KEY k1 = v1 ...kn = vn [additions].
- READ TABLE itab WITH KEY k1 = v1 ...kn = vn [BINARY SEARCH] [additions].
- READ TABLE itab INDEX i [additions].
- Obsolete Variants
Read a program
- READ REPORT prog INTO itab.
Read text elements
- READ TEXTPOOL prog ...INTO itab ...LANGUAGE lg.
Read from a file
- READ DATASET dsn INTO f.
Read a database table
- READ TABLE dbtab.
Thanks & Regards,
Dileep .C
‎2009 Jun 17 11:10 AM
Hi,
The other posters are right. You can't use READ to get more than one entry.
The best thing you can use if you don't want to use loop is to use FOR ALL ENTRIES inside your SELECT statement:
Select
KBSTAT
KNUMH
from A912 into table i_a912 FOR ALL ENTRIES IN internal_table where knumh = internal_table-knumh