Skip to Content

This code snippets gets last X numbers of characters from variable.


form get_last_characters using iv_value iv_num_of_chars changing cv_value.
  data lv_offset type i.
  lv_offset = strlen( iv_value ) - iv_num_of_chars.
  if lv_offset < 0.
    cv_value = iv_value.
  else.
    cv_value = iv_value+lv_offset(iv_num_of_chars).
  endif.
endform.

how to use:


perform get_last_characters
  using  lv_var1
  20
  changing lv_var2
To report this post you need to login first.

Be the first to leave a comment

You must be Logged on to comment or reply to a post.

Leave a Reply