2008 Apr 23 2:44 PM
Hi guys,
I used READ TABLE statement...
I have the code below... does it need to for the key to have the same data type? i_reqitem2 has not header line... does it need to have header line? Thanks!
READ TABLE i_reqitem2 into x_reqitem2
WITH KEY material = x_eban-matnr
plant = x_eban-werks
unit = x_eban-meins
deliv_date = x_eban-lfdat
item_cat = x_eban-pstyp
quantity = x_eban-menge
fixed_vend = x_eban-flief.
2008 Apr 23 2:49 PM
The fields you are testing with the KEY list should all be of the same data type and what you are comparing to.
The fields you are testing with the KEY list should all be of the same data type and what you are comparing to.
2008 Apr 23 2:47 PM
that is not compulsary for table i_reqitem2 to have header line
while it is necessary for the key to have the same data type
<REMOVED BY MODERATOR>
Edited by: Alvaro Tejada Galindo on Apr 23, 2008 9:48 AM
2008 Apr 23 2:53 PM
Hi,
What would be the alternative for READ TABLE if the key has not same data type? Thanks
2008 Apr 23 2:57 PM
There is no alternative but doing a type conversion of the fields having a different type
2008 Apr 23 2:58 PM
Hi
declare another internal table(itab2) with the same structure of the itab u r reading(itab1) except for the field which is not matching..... declare that field as the one which matches with taht of itab u loop at(itab3),......
now move all entries of this internal table itab1 to itab2 ( by looping at itab1 and moving field by field to itab2) and use itab2 for reading....!!!!
Regards
Vasu
2008 Apr 23 2:59 PM
2008 Apr 23 3:04 PM
In most cases, moving from one data type to another will do the conversion for you in ABAP
2008 Apr 23 3:49 PM
2008 Apr 23 3:56 PM
The compiler will take care of it in resolving the move.
DATA:
fld1 TYPE p VALUE '1000',
fld2(10) TYPE c.
fld2 = fld1. " fld 2 will now contain 1000 right justified.
WRITE:/1 fld2.
2008 Apr 23 2:49 PM
The fields you are testing with the KEY list should all be of the same data type and what you are comparing to.
| User | Count |
|---|---|
| 6 | |
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |