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

Small issue in ABAP coding

Former Member
0 Likes
808

HI Folks,

i have a internal table having 2 fields and 10 reocrds, ineed to find out the records which are starting with digit 9 only, please let me know how can i go with that.

i traid with '9%' it is giving dump.

plz help.

Thanks,

Ritesh

1 ACCEPTED SOLUTION
Read only

Laxmana_Appana_
Active Contributor
0 Likes
783

Hi,

check this :

if your internal table is i_tab and fields are fld1 and fld2 ...

loop at i_tab into wa_tab.

if wa_tab-fld1+0(1) = '9'.

append wa_tab to i_tab2.

endif.

endloop.

i_tab2 will have required records

regards

Appana

7 REPLIES 7
Read only

Laxmana_Appana_
Active Contributor
0 Likes
784

Hi,

check this :

if your internal table is i_tab and fields are fld1 and fld2 ...

loop at i_tab into wa_tab.

if wa_tab-fld1+0(1) = '9'.

append wa_tab to i_tab2.

endif.

endloop.

i_tab2 will have required records

regards

Appana

Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
783

You can loop at the itab and check the first digit.

Loop at itab.

check itab+0(1) = '9'.
* do something.
endloop.

Regards,

Rich Heilman

Read only

abdul_hakim
Active Contributor
0 Likes
783

hi

you cant use '9%' as itz not permitted in itab context.

you need to perform the validation manually..

loop at itab.

if itab+0(1) eq '9'.

<perform your validations>.

endif.

endloop.

Cheers,

Abdul Hakim

Read only

Former Member
0 Likes
783

Hi Ritesh,

Try this:

loop at itab where field+0(1) = '9'.

write: / itab.

endloop.

I've test on 4.7 and works fine.

Emmanuele Prudenzano

Read only

Former Member
0 Likes
783

Hi,

put this code-

loop at <itab>

if <itab>-field(1) = '9'.

endif.

endloop.

regards,

Read only

Former Member
0 Likes
783

Hi,

put this code-

loop at <itab>

if <itab>-field(1) = '9'.

endif.

endloop.

regards,

Read only

Former Member
0 Likes
783

hi,

in ABAP/4 we have parameters,select-options for the selection,

try to get acquainted with these,those are very useful,

parameters field-name like tablename-fieldname.

parameters carrid like sflight-carrid.

best of luck,

regards,

kcc