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

Strings

Former Member
0 Likes
1,025

Hi ,

Anyone please tell me the syntax.How can I take a string and remove its last 6 characters and put it into another variable?

Thanks

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,002

Hi

Data: v_string type string,

v_new_string type string,

v_len type i,

v_len1 type i.

v_string = '0123456789'.

  • Get full length

v_len = STRLEN( V_STRING ).

  • get the offset

V_len1 = v_len - 6.

  • Move the last 6 characters to another string

V_NEW_STRING = v_string+v_len1(6).

Hope this solves your problem.

Regards

Kathirvel

6 REPLIES 6
Read only

Former Member
0 Likes
1,003

Hi

Data: v_string type string,

v_new_string type string,

v_len type i,

v_len1 type i.

v_string = '0123456789'.

  • Get full length

v_len = STRLEN( V_STRING ).

  • get the offset

V_len1 = v_len - 6.

  • Move the last 6 characters to another string

V_NEW_STRING = v_string+v_len1(6).

Hope this solves your problem.

Regards

Kathirvel

Read only

0 Likes
1,002

V_NEW_STRING = v_string+v_len1(6).

It show some error at this line

Read only

Former Member
0 Likes
1,002

Please try this in that part

data: v_char(100) type c.

v_char = v_string.

v_new_string = v_char+v_len1(6).

Regards

Kathirvel

Read only

Former Member
0 Likes
1,002

Hi,

The above works fine for me..

Thanks,

Naren

Read only

Former Member
0 Likes
1,002

Try to check the declaration again, it should work fine.

Regards

Kathirvel

Read only

Former Member
0 Likes
1,002

Hi Sri,

Please check this FM C147_STRING_SHIFT.

Regards,

Ferry Lianto