2008 Feb 27 2:41 PM
hi,
i have intrnal table with lot of value and i wont to now if some value is
their what is the best way to do that?
e.g.
i have table itab
field-desc
qray
mmm
tyieel
iisjso
I0002
b0005
and i wont to now if i have in itab one of the value I0002 or I0052
or I0059
Regards
2008 Feb 27 2:52 PM
Hello Ricardo,
U can bulit a range table and check the values like this.
data: RA_STAT TYPE RANGE OF J_STATUS WITH HEADER LINE.
RA_STAT-SIGN = 'I'.
RA_STAT-OPTION = 'EQ'.
RA_STAT-LOW = 'I0002'
APPEND RA_STAT.
RA_STAT-LOW = 'I0050'
APPEND RA_STAT.
RA_STAT-LOW = 'I0052'
APPEND RA_STAT.
loop at itab where stat in ra_stat.
write:/ 'Value is available in itab
endloop.
Cheers,
Vasanth
hi,
i have intrnal table with lot of value and i wont to now if some value is
their what is the best way to do that?
e.g.
i have table itab
field-desc
qray
mmm
tyieel
iisjso
I0002
b0005
and i wont to now if i have in itab one of the value I0002 or I0052
or I0059
Regards
2008 Feb 27 2:47 PM
Hi
You can use Read table itab.
READ TABLE <itab> WITH KEY <k1> = <f1>... <kn> = <fn> <result>
BINARY SEARCH.
URL for read table
http://help.sap.com/saphelp_47x200/helpdata/en/fc/eb373d358411d1829f0000e829fbfe/frameset.htm
Reagrds,
Lakshmikanth
2008 Feb 27 2:48 PM
Use Read statement.
EX:
READ table itab with KEY vbeln = gv_vbeln.
Regards,
Ajay
2008 Feb 27 2:50 PM
Loop at itab where field-desc = 'I0002' or
field-desc = 'I0052' or
field-desc = 'I0059'.
exit.
endloop.
if sy-subrc = 0.
write 😕 itab-field-desc. <-- this will have either of the three values ..
endif.
2008 Feb 27 2:52 PM
Hello Ricardo,
U can bulit a range table and check the values like this.
data: RA_STAT TYPE RANGE OF J_STATUS WITH HEADER LINE.
RA_STAT-SIGN = 'I'.
RA_STAT-OPTION = 'EQ'.
RA_STAT-LOW = 'I0002'
APPEND RA_STAT.
RA_STAT-LOW = 'I0050'
APPEND RA_STAT.
RA_STAT-LOW = 'I0052'
APPEND RA_STAT.
loop at itab where stat in ra_stat.
write:/ 'Value is available in itab
endloop.
Cheers,
Vasanth
2008 Feb 27 2:59 PM
thanks Vasanth M
i try it with read like this and i have error.
i do it like that because the performance range is better?
READ TABLE status_tab WITH KEY stat = 'I0002' or = 'I0042' or = 'I0045'.
Regards
2008 Feb 27 3:01 PM
Hello Ricardo,
You can use the Range tables when the number of single values is not huge ( In Millions ).
If the number os records in the range table is less you very use the range tables. It won't affect the performance.
Cheers,
Vasanth
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |