Application Development 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: 

select last characters

Former Member
0 Kudos

Hi.

In a fied i need the last 10 characters but i don´t know the leght of the field.

Any idea.

Thanks.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

Please try this FM ACEPS13_AWKEY_DECODE.

<b>Reward points</b>

Regards

11 REPLIES 11

Former Member
0 Kudos

use describe statment to know the length of the field

DESCRIBE FIELD f

Former Member
0 Kudos

Hello,

Do like this.


data: char(20) value 'select last characters',
         len type i.
len  = strlen ( Char).
len = len - 10.
write: char+len(10).

Vasanth

Former Member
0 Kudos

Hi

get the length of the same using STRLEN.

subtarct the toatl length - 10.

then use the offset method and pass the value

then pass the val;ue of this as offset and value as 10

Regards

Shiva

Former Member
0 Kudos

data : len type i,

text(40) value 'abcdefghijklmon',

ntext(10).

compute len = strlen( text ).

len = len - 10.

ntext = text+len(10).

write : / ntext.

regards

shiba dutta

Former Member
0 Kudos

Hi,

Please try this FM ACEPS13_AWKEY_DECODE.

<b>Reward points</b>

Regards

Former Member
0 Kudos

Use the to STRLEN( <c> ).get the lenght of the field

lv_len = STRLEN( <c> ).

Former Member
0 Kudos

The field is a type string and the content can to be variable.

jayanthi_jayaraman
Active Contributor
0 Kudos

Hi,

Check this can help you.

DATA: FLD(8),

LEN TYPE I.

DESCRIBE FIELD FLD LENGTH LEN IN CHARACTER MODE.

Result: LEN contains the value 8.

0 Kudos

REPEAT: The variable is a type string and the before code not is accept.

0 Kudos

HI,

This will work.. irrespective of the length..

data: char(20) value 'select last characters',

len type i.

len = strlen ( Char).

if len > 10.

len = len - 10.

write: char+len(10).

else

write char.

endif.

Thanks

Mahesh

0 Kudos

I modified Mahesh's code a bit:

DATA: char  TYPE string VALUE 'select last characters',
len TYPE i.
len = STRLEN( char ).
IF len > 10.
  len = len - 10.
  WRITE: char+len(10).
ELSE.
  WRITE char.
ENDIF.

Rob