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

Checking internal table

Former Member
0 Likes
565

Hi Experts,

i have a scenario like this:

move a to b.

But before doing this i have to check whether 'a' is contained in the it1 internal table's field val.( ie 'a' is contained in it1-val).

without looping is there any method.

Points will be rewarded.

Regards,

Soumya.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
544

hi

try this

<b>Read itab into wa.with key itab-val = 'a'.

if sy-subrc = 0.

valuer is in itab

else

move a to b.

endif.</b>

<b>hope it clears ur doubt</b>

regards

ravish

<b>plz dont forget to reward points if useful</b>

3 REPLIES 3
Read only

Former Member
0 Likes
544

search 'a' for that field.

use search comand and chk with sy-subrc.

Read only

Former Member
0 Likes
544

if it1 is an internal table with 1 record... then

read it1 index 1.

now, search a in it1-val

if exists move to b.

if it1 is an internal table with more entries, then u have to do a loop....

Read only

Former Member
0 Likes
545

hi

try this

<b>Read itab into wa.with key itab-val = 'a'.

if sy-subrc = 0.

valuer is in itab

else

move a to b.

endif.</b>

<b>hope it clears ur doubt</b>

regards

ravish

<b>plz dont forget to reward points if useful</b>