Last month i writed a smartform program for printing something.In the ABAP program ,i must spell total value.And print the capital amount in the smartform. But when encount the capital amount is long enough to cram one line's space,the smartform program will print the others in the second line automaticly.But one word will be split into two words.How can solve this problem?I found an very useful function moudle to do this job.It is 'RKD_WORD_WRAP'. Example code as show below.
CALL FUNCTION 'RKD_WORD_WRAP'
EXPORTING
TEXTLINE = l_v_textline " input text which you want to print in smartform
OUTPUTLEN = 70
IMPORTING
OUT_LINE1 = l_v_ssfheader-total_capital_1 " result of split
OUT_LINE2 = l_v_ssfheader-total_capital_2
OUT_LINE3 = l_v_ssfheader-total_capital_3
TABLES
OUT_LINES = l_t_out_lines " result internal table of split
EXCEPTIONS
OUTPUTLEN_TOO_LARGE = 1
OTHERS = 2.
I want to implement this function use ABAP OO .Of course reference the code of this function.Then i can avoid load function group KYER.
本文介绍了一个实用的ABAP函数模块'RKD_WORD_WRAP',用于解决智能表单中长文本自动换行及单词拆分的问题。通过示例代码展示了如何将长文本合理分割成多行,避免单词被不恰当地拆分。

95

被折叠的 条评论
为什么被折叠?



