01-25-2007 6:58 PM
Hi all ,
I have written select statement extracted values in itab.iam uding read table like this.
read table itab with key a = b.
but filed a contains multiple records how to get those multiple records.with read statement iam getting single value ( I dont want to use loop statement and select statement ). Please let me know.
01-25-2007 6:59 PM
HI Priya..
READ statement gives a single record which satisfies the condition first.
U have to use LOOP....ENDLOOP for multiple records for internal table
u cna write as..
Loop at itab where a = b.
......
..... ur code as per requirement.
Endloop.
Regards
CNU
01-25-2007 6:59 PM
HI Priya..
READ statement gives a single record which satisfies the condition first.
U have to use LOOP....ENDLOOP for multiple records for internal table
u cna write as..
Loop at itab where a = b.
......
..... ur code as per requirement.
Endloop.
Regards
CNU
01-25-2007 7:00 PM
HI,
You will get only one row..If you use READ TABLE..You have to use LOOP AT to get multiple records..
Thanks,
Naren
01-25-2007 7:00 PM
Check this:
/people/rob.burbank/blog/2006/02/07/performance-of-nested-loops
No need to LOOP. You can read an entire table using READ.
Rob
Message was edited by:
Rob Burbank
01-25-2007 7:21 PM
Try running this (not terribly efficient, but no loops):
REPORT ztest NO STANDARD PAGE HEADING LINE-SIZE 80
MESSAGE-ID 00.
PARAMETERS p_bukrs LIKE bkpf-bukrs.
DATA: BEGIN OF bkpf_int OCCURS 0.
INCLUDE STRUCTURE bkpf.
DATA: END OF bkpf_int.
DATA: no_lines TYPE i,
tab_index TYPE i.
SELECT * FROM bkpf
INTO TABLE bkpf_int
WHERE bukrs = p_bukrs.
DESCRIBE TABLE bkpf_int LINES no_lines.
tab_index = 1.
DO no_lines TIMES.
READ TABLE bkpf_int INDEX tab_index.
tab_index = tab_index + 1.
WRITE: /001 bkpf_int-belnr.
ENDDO.
Rob
01-25-2007 7:04 PM
Hi priya.
to REAd all the records in itab u have to use LOOP ...ENdloop.
may i know why u dont want loop??
01-25-2007 7:12 PM
Through read statement you can get only single record.
you have to loop ... endloop. for more than 1 record.
regds,
kiran
01-25-2007 7:30 PM
Hi Priya,
If you dont need the records in the future which doesn't match those condition.
Then write the statement :
Delete table itab where a <> b.
Then all the records whose key is a <> b are deleted, Remaining are the records which are matching the key a = b.
Points Reward , If helpful.
Regards
Kannu