2007 Aug 24 6:03 AM
hai how to extract perticular record from a internal table i mean read statermetn
give syntax
2007 Aug 24 6:05 AM
2007 Aug 24 6:05 AM
hi,
syntax:
1. read table itab index n. "n can be any no.
2. read table itab with key field1 = value
field 2 = value.
regards,
Navneeth K.
2007 Aug 24 6:05 AM
Hi,
Consider the internal table 'itab'.
The Syntax is
READ TABLE ITAB WITH KEY...
For more details on syntax you can visite help portal.
Thanks...
Preetham S
2007 Aug 24 6:06 AM
Hi
READ table ITAB with key feild = so and so condition
in ur condition what ever vales u want put it in that
reward if usefull
2007 Aug 24 6:06 AM
Hi,
Check this
http://help.sap.com/saphelp_nw04/helpdata/en/0b/5da4e72cf511d5b692006094192fe3/frameset.htm
Regards,
Satyendra
2007 Aug 24 6:07 AM
Hi Karnam,
Check this link for READ statement
http://www.sts.tu-harburg.de/teaching/sap_r3/ABAP4/read_t01.htm
Check this code
READ TABLE IT_MARA WITH KEY MATNR = <VALUE>
BINARY SEARCH
TRANSPORTING NO FIELDS.
IF SY-SUBRC = 0.
ENDIF.
Thanks,
Vinay
2007 Aug 24 6:08 AM
hi pandu,
u can find syntax help in ABAPDOCU.
1. READ TABLE itab FROM wa [ additions].
2. READ TABLE itab WITH TABLE KEY k1 = v1 ... kn = vn [additions].
3. READ TABLE itab WITH KEY k1 = v1 ... kn = vn [BINARY SEARCH] [additions].
4. READ TABLE itab INDEX i [additions].
Obsolete Variants
The syntax check performed in an ABAP Objects context is stricter than in other ABAP areas. See Short Forms of Line Operations not Allowed.
In some cases, the syntax rules that apply to Unicode programs are different than those for non-Unicode programs.See Key Specifications and Unicode.
Effect
Reads an entry from an internal table, using either its key or its index. The return code SY-SUBRC specifies whether an entry could be read. If you specify a non-unique key (the table must have a NON-UNIQUE key for this to be valid), the system returns the entry with the lowest index from the set of entries that meet the condition.
SY-SUBRC = 0:
An entry was read.
SY-TABIX is set to the index of the entry.
SY-SUBRC = 2:
An entry was read.
SY-TABIX is set to the index of the entry. This return code can only occur when you use the COMPARING addition. For further detauls, refer to the COMPARING section of the additions
SY-SUBRC = 4:
No entry was read.
The value of SY-TABIX depends on the table type and whether the BINARY SEARCH addition was specified.
If the table is a SORTED TABLE or a table sorted in ascending order of the type STANDARD TABLE with the BINARY SEARCH addition, SY-TABIX refers to the next-highest index.
Otherwise, SY-TABIX is undefined.
SY-SUBRC = 8:
No entry was read.
This return code only occurs with a SORTED TABLE or a STANDARD TABLE with the BINARY SEARCH addition. SY-TABIX is set to the number of all entries plus 1.
The READ TABLE statement also fills the system fields SY-TFILL and SY-TLENG.
Variant 1
READ TABLE itab FROM wa [additions].
Variant 2
READ TABLE itab WITH TABLE KEY k1 = v1 ... kn =
vn [additions].
Effect
The system uses the specified table key values to locate the correct line. If there is more than one entry with the same key, the system returns the first. The way in which the system looks for table entries depends on the table type:
STANDARD TABLE:
The system searches from the start of the table. The response time is in linear relation to the number of table entries.
SORTED TABLE:
The response time is in logarithmic relation to the number of table entries.
HASHED TABLE:
The response time is constant.
Notes
When you specify the table key using k1 = v1 ... kn = vn you must specify values for all of the key fields. If the type of a value is not compatible with the type of the corresponding key field,the system uses MOVE logic to convert it to the type of the key field before reading from the table.
If you do not know the name of a component until runtime, you can use the expression WITH TABLE KEY ... (ni) = vi ... to specify it dynamically as the contents of the field ni. If ni is empty at runtime, the key specification is ignored.
If a table has a non-structured line type, you can use the pseudocomponent TABLE_LINE to address the entire line as the table key (see also Pseudocomponent TABLE_LINE in Internal Tables).
If you specify the key implicitly using FROM wa, the values for the table key are taken from the corresponding components of the (structured) field wa. wa must be compatible with the line type of itab. In this way, you can access a table using READ without having to know the table key statically. If the table key is empty, the system reads the first line.
Variant 3
READ TABLE itab WITH KEY k1 = v1 ... kn = vn
[BINARY SEARCH] [additions].
Effect
The system evaluates the specified key to identify the correct line. If the type of a value is not compatible with the type of the corresponding key field, the system uses MOVE logic to convert the value into the type of the component before reading the table. This is an asymmetric comparison logic, in which the component type takes precedence over the value type.
The way in which the system looks for an entry in the table depends on its table type. The system optimizeds the key access whenever possible (see Optimized Key Operations With Internal Tables).
STANDARD TABLE:
If you use the ... BINARY SEARCH addition, the system uses a binary search. Otherwise, the search is sequential. This assumes that the internal table is sorted in ascending order in the sequence of the specified key fields.
SORTED TABLE:
If the specified key fields form a left-justified extract of the table key or are identical with the entire table key, the search is binary, otherwise sequential.
HASHED TABLE:
If the key fields specified are identical with the entire table key, the hash algorithm is used, otherwise read access is sequential.
Regards...
Arun.
Reward points if it helps.
2007 Aug 24 6:15 AM