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

Filter data using where statement : need to filter a variable if it starts

Former Member
0 Likes
510

Hi,

in my loop statment , i am using a where condition.

a variable has numbers and characters , i want to filter the variable using where statement identifying if it is acharacter not to enter into the loop.

any suggestions . Thanks in advance.

regards,

Ry

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
485

> a variable has numbers and characters , i want to filter the variable using where statement identifying if it is acharacter not to enter into the loop.

loop at itab where name co '0123456789'.
"catch numbers here..
endloop.
if sy-subrc ne 0.
 "all are characters not a single one withnumber
endif.
loop at itab where name co sy-abcde.
"catch characters here..
endloop.

3 REPLIES 3
Read only

Former Member
0 Likes
485

Hi Ry,

Check this sample

LOOP AT gi_vbak WHERE VBELN NA sy-abcde.

WRITE gi_vbak-vbeln. --> your numeric variable logic

ENDLOOP.

Read only

Former Member
0 Likes
486

> a variable has numbers and characters , i want to filter the variable using where statement identifying if it is acharacter not to enter into the loop.

loop at itab where name co '0123456789'.
"catch numbers here..
endloop.
if sy-subrc ne 0.
 "all are characters not a single one withnumber
endif.
loop at itab where name co sy-abcde.
"catch characters here..
endloop.

Read only

Former Member
0 Likes
485

Hi ,

try like this

data:l_file_data(20) type c,

oref TYPE REF TO cx_root.

data: l_amount type p decimals 2.

l_file_data = '12A3'.

try.

l_amount = l_file_data.

catch cx_root into oref.

endtry.

if oref is not initial.

write: 'Miss Match'.

endif.

regards

Prabhu