2010 Jan 29 3:14 PM
Friends,
I have a string with 150 charcters.
I want to split it up in 50-50-50 charcaters but the requirement is the word should not be broken.
So the 150 characters field can be adjusted.
and if there is no space in 150 characters then it should split exactly 50-50-50.
Is there any function module available for that?
Regards,
RH
Friends,
I have a string with 150 charcters.
I want to split it up in 50-50-50 charcaters but the requirement is the word should not be broken.
So the 150 characters field can be adjusted.
and if there is no space in 150 characters then it should split exactly 50-50-50.
Is there any function module available for that?
Regards,
RH
2010 Jan 29 3:23 PM
2010 Jan 29 3:30 PM
2010 Jan 29 3:31 PM
2010 Jan 29 4:16 PM
Make the necessary changes,
Its only a logic.
DATA:len TYPE i,
lv_index TYPE i,
lv_offset TYPE i,
lv_rev_index TYPE i,
lv_rev_2 type i,
lv_string TYPE string.
lv_string = 'VADVvsndcvbjvbvbvmbzc zdnfdb hzdfhjkahf sdbfbsdjkf sd f f jzdhfjk'.
len = STRLEN( lv_string ).
lv_offset = 50.
lv_index = 1.
DO.
IF lv_string+lv_offset(lv_index) = ' '.
WRITE / lv_string+lv_index(lv_offset).
lv_index = lv_offset.
ELSE.
lv_rev_index = lv_offset - 2.
DO.
IF lv_string+lv_rev_index(1) = ' '.
WRITE / lv_string+lv_offset(lv_rev_index).
lv_offset = lv_rev_index.
EXIT.
ENDIF.
lv_rev_index = lv_rev_index - 1.
ENDDO.
ENDIF.
IF sy-index = len.
EXIT.
ENDIF.
ENDDO.
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |