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

query regarding loop or read internal table

Former Member
0 Likes
607

hi all,

i have a internal table which i have to read. or even loop at the table would be fine.

I have a field name whose value 'abc'

but in my internal table the same field name with value as 'abc def '

but both these values correspond to the same object.

read table tab1 where fieldname = value doesn't work here. because the value isnt exactly the same.

how do i perform this operation?

Please help me.

5 REPLIES 5
Read only

Former Member
0 Likes
581

Hi,

Do like this

Loop at itab into wa.

if wa-field1+0(3) = 'abc'.

......

endif.

.....

endloop.

Regards,

Satish

Read only

0 Likes
581

Hi

Offset doesn't help here.

My internal table has a value of 'abc def'

but what i need to compare that has a value 'abc'

my code goes like this :

" loop at itab into wa

where fieldname = l_fieldname . "

in this context fieldname = abcdef

and l_fieldname = abc.

can you now tell me how to proceed ?

Read only

0 Likes
581

Hi,

As i told you do like this, it will work

Loop at itab into wa.

if wa-field1+0(3) = l_fieldname.

... proceed.

else.

continue.

endif.

endloop.

or in if statement do like this

if wa-field1 CS l_fieldname.

proceed...

endif.

Regards,

Satish

Edited by: Satish Panakala on Feb 4, 2008 8:18 AM

Read only

0 Likes
581

Hi Sathish

loop at table wher wa-fieldname CS fieldname worked !

thanks a lot for your help.

Read only

Former Member
0 Likes
581

Hi,

Please check the below code...

loop at itab into wa.

v_var = wa-field1(3).

loop at itab into wa1.

v_var1 = wa1-field1(3).

if v_var = v_var1.

do your logic what you want.

endif.

endloop.

endloop.

Rgds,

Bujji