Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

help with find data in table

Former Member
0 Likes
841

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

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
821

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

6 REPLIES 6
Read only

Former Member
0 Likes
821

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

Read only

Former Member
0 Likes
821

Use Read statement.

EX:

READ table itab with KEY vbeln = gv_vbeln.

Regards,

Ajay

Read only

Former Member
0 Likes
821

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.

Read only

Former Member
0 Likes
822

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

Read only

0 Likes
821

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

Read only

0 Likes
821

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