Additional Blogs by SAP
cancel
Showing results for 
Search instead for 
Did you mean: 
kzak
Explorer
0 Kudos

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