2007 Aug 01 7:37 AM
Hi Experts,
How to check whether an internal table's (it1) field val contains value 'a'.
without looping how can i do this?
Points will be rewarded.
Regards,
Soumya.
2007 Aug 01 3:36 PM
Hi,
If you dont want to use Loop statement then you can use READ TABLE Statement.
Ashvender
Hi,
If you dont want to use Loop statement then you can use READ TABLE Statement.
Ashvender
2007 Aug 01 3:14 PM
2007 Aug 01 3:22 PM
Use FIND statement : check below code
DATA: BEGIN OF itab OCCURS 0,
f1(10) TYPE c,
f2(10) TYPE c,
END OF itab.
itab-f1 = '3'.
itab-f2 = 'S'.
APPEND itab.
itab-f1 = '2'.
itab-f2 = 'T'.
APPEND itab.
itab-f1 = '4'.
itab-f2 = 'S'.
APPEND itab.
itab-f1 = '4'.
itab-f2 = 'P'.
APPEND itab.
itab-f1 = '2'.
itab-f2 = 'S'.
APPEND itab.
FIND FIRST OCCURRENCE OF 'P' IN TABLE itab IN CHARACTER MODE.
IF sy-subrc EQ 0.
MESSAGE 'Yes' TYPE 'I'.
ENDIF.
Reward if useful
Regards
Pradeep
2007 Aug 01 3:28 PM
You can use READ TABLE.
DATA: BEGIN OF TEST OCCURS 3,
VALUE TYPE C,
END OF TEST.
APPEND 'a' TO TEST.
APPEND 'b' TO TEST.
APPEND 'c' TO TEST.
READ TABLE TEST WITH KEY VALUE = 'a'.
2007 Aug 01 3:34 PM
Hi
Use Read statement if u dont want to use loop.
Write like this
Data: Begin of itab occurs 0,
it1(10) type c,
End of itab,
sno type i value 1.
itab-it1 = 'abcd'.
append itab.
itab-it1 = 'bcd'.
append itab.
itab-it1 = 'bcd'.
append itab.
itab-it1 = 'bacd'.
append itab.
loop at itab.
endloop.
sort itab by it1.
do sy-tfill times.
read table itab index sno.
if itab-it1 ca 'a'.
write:/ 'Found'.
else.
write:/ 'Not Found'.
endif.
sno = sno + 1.
enddo.
Regards
Haritha.
2007 Aug 01 3:36 PM
Hi,
If you dont want to use Loop statement then you can use READ TABLE Statement.
Ashvender
| User | Count |
|---|---|
| 6 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |