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 last digit

Former Member
0 Likes
719

one of my table field is character which is of 30 characters in length. But it generally has value 7 or 8 characters. I have to check whether the last character of the value is * or not....how can i do that..

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
601

Try this:

data: lv_length type i.

lv_length = strlen( itab-field ).

if itab-field+(lv_length) eq '*'.

*----


endif.

Thanks,

SKJ

3 REPLIES 3
Read only

Former Member
0 Likes
602

Try this:

data: lv_length type i.

lv_length = strlen( itab-field ).

if itab-field+(lv_length) eq '*'.

*----


endif.

Thanks,

SKJ

Read only

0 Likes
601

Once correction to the suggest code, I believe you would have to substract one form the length in order to get the right positioning, yes? And the lv_length shouldn't be in parenthesis.



data: lv_length type i.

lv_length = strlen( itab-field ).

lv_length = lv_length  - 1.

if itab-field+lv_length(1) eq '*'.

endif.

Regards,

RIch Heilman

Read only

Former Member
0 Likes
601

HI,

data : lv_data(20) type c.

lv_data = 'Hello'.

call function 'STRING_REVERSE'

exporting

STRING = lv_data.

lang = 'E'

importing

RSTRING = lv_data.

if lv_data+0(1) eq '*'.

Endif.

Thanks

Mahesh