ABAP字符串截取-发送邮件时line支持255&打印时最长文本255
DATA lv_len TYPE i.
DATA lv_time TYPE f.
DATA lv_num TYPE i.
DATA lv_pos TYPE i.
DATA:lv_str TYPE string.
lv_len = 0.
lv_time = 0.
lv_time = 0.
lv_pos = 0.
lv_len = strlen( lv_str ).
lv_time = ceil( lv_len / 255 ).
lv_num = lv_len MOD 255.
lv_pos = 0.
DO lv_time - 1 TIMES.
CLEAR ls_body.
"添加到内表中
ls_body-line = lv_str+lv_pos(255).
APPEND ls_body TO lt_body.
"偏移量加255,pos += 255;
lv_pos += 255.
ENDDO.
CLEAR ls_body.
ls_body-line = lv_str+lv_pos(lv_num).
APPEND ls_body TO lt_body.
ls_body lt_body 邮件内容部分,此段代码只是拆分字符串为255长度的样例,方便看到即用