11-12-2007 9:55 AM
read table it_qmel where ... some codn.
it will check with what data is present in header only in it_qmel.ie header value won't change.is it? I am not clear. Plz explain me with examples.
11-12-2007 9:59 AM
read table itab with key field1 = var.
this statement reads the internal table and first record satisfying this condition will come into header.....!!!!!
so of course header will be changed..... previous value will be lost and the read line will come into header....
for example....
consider itab declared with headerline....
data : begin of itab occurs 0,
var1 type i,
var2(3) type c,
end of itab.
if itab has 2 fields with following values...
var1 var2
1 abc
2 def
3 ghi
read table itab with key var1 = 1.
*--now itab header will contain
var1 var2
1 abc
now if u write...
read table itab with key var1 = 2.
*--now itab header will contain
var1 var2
2 def
that is header is replaced with newly read value...!!!
Regards
Vasu
11-12-2007 10:00 AM
Hi Suganuya,
There are two types of read stmt,
1. Using header of the table
2. Using work area of the table.
In ur case its the first u have opted, so the read stmt will replace the value in the header of the table by the record that is read from the table.
Rgds,
Sarath.C
11-12-2007 10:00 AM
Hi,
When you use read statement on a particular internal table, it will check for that entry in the internal table body based on the conditions provides in with key...
Reward if it helps,
Satish
11-12-2007 10:01 AM
Hi assume that u have an internal table with 5 records like the below..
F1 F2 F3
1 abc 78
2 bcd 89
3 jhf 90
4 jkj 53
5 uio 11
This internal table can be with header line or with out... not an issue for us.
Now we are using READ TABLE ITAB with key F1 = 4.
it will give the 4th record. into the header of the internal tbale.
if without header line then... READ TABLE ITAB into wa_tab with key F1 = 4
it will give 4th record into wa_tab..
hope u got it...
11-12-2007 10:03 AM
Loop at gt_marc into gs_marc.
Read table gt_mara into gs_mara with key matnr = gs_marc-matnr.
If sy-subrc =0.
-
Endif.
Endloop.
this statement will read value from internal table gt_mara into workarea gs_mara
where matnr is eual to gt_marc table matnr.
Hope this will help you
11-12-2007 10:08 AM
hi veera,
read statement works to retrieve data from an internal table.
different types of read statements are :
READ TABLE <EMPTAB> options:
1 READ TABLE <EMPTAB>.
2 READ TABLE <EMPTAB> WITH KEY <k1> = <v1>
<kn> = <vn>.
3 READ TABLE <EMPTAB> WITH TABLE KEY <k1> = <v1> ...
<kn> = <vn>.
4 READ TABLE <EMPTAB> WITH KEY = <value>.
5 READ TABLE <EMPTAB> WITH KEY . . . BINARY SEARCH.
6 READ TABLE <EMPTAB> INDEX <i>.
7 READ TABLE <EMPTAB> COMPARING <f1> <f2> . . . .
8 READ TABLE <EMPTAB> COMPARING ALL FIELDS.
plz reward if useful..
11-12-2007 10:11 AM
Hi,
If you want to Read it for multiple records use loop.
Loop at it_qmel.
Read table it_qmel with key ....
If sy-subrc = 0.
....
Endif.
Endloop.
Bye,
KC
11-12-2007 10:21 AM