Skip to Content
Author's profile photo Krzysztof Zak

Get last characters of the string – Code Snippets

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

Assigned Tags

      Be the first to leave a comment
      You must be Logged on to comment or reply to a post.