2010 Aug 25 8:28 AM
Hi Experts,
Please advice how to pass text in a multiple lines so to a string so that every next line data only comes after 72 characters from the first irrespective of the characters of data existing in previous line..
for ex. My Name is Ankur ==> Line 1
What is your Name? ==> Line 2
is passed in a string in such a way that the Line 2 text only comes after 72 characters of first line whether or not it has that many characters in its text.
I am looping the internal table whch holds multiple line text.
Thanks,
Ankur
2010 Aug 25 12:24 PM
you can try a logic something similar to this. here it considers 16 chaarcters
DATA:BEGIN OF wa,
line(72),
END OF wa.
DATA:it TYPE TABLE OF char72.
DATA:lv_string TYPE string.
DATA:len TYPE i,
l_off TYPE i,
r_off TYPE i,
lam type i.
lv_string = '123123jbjskdhvkkxzncjkn1234123jhjkhzkdvczjcklzxjcklxjzclkzxjcklj13j12kl3j1kljlk12j3kjlk2j3'.
l_off = 0.
r_off = 16.
len = STRLEN( lv_string ) - 1.
DO.
lam = l_off + 16.
if lam >= len.
lam = len - l_off.
wa-line = lv_string+l_off(lam).
APPEND wa TO it.
CLEAR wa.
EXIT.
ENDIF.
wa-line = lv_string+l_off(16).
l_off = l_off + 16.
APPEND wa TO it.
CLEAR wa.
ENDDO.
Hi Experts,
Please advice how to pass text in a multiple lines so to a string so that every next line data only comes after 72 characters from the first irrespective of the characters of data existing in previous line..
for ex. My Name is Ankur ==> Line 1
What is your Name? ==> Line 2
is passed in a string in such a way that the Line 2 text only comes after 72 characters of first line whether or not it has that many characters in its text.
I am looping the internal table whch holds multiple line text.
Thanks,
Ankur
2010 Aug 25 8:37 AM
Please ignore this!
Regards,
raghu
Edited by: Raghavendra nilekani on Aug 25, 2010 1:13 PM
2010 Aug 25 8:49 AM
you can find the strlen and if string length is greater than 72 , write text to new line .
2010 Aug 25 11:07 AM
you can use function module "TEXT_SPLIT"
Regards,
Lalit Mohan Gupta
2010 Aug 25 12:24 PM
you can try a logic something similar to this. here it considers 16 chaarcters
DATA:BEGIN OF wa,
line(72),
END OF wa.
DATA:it TYPE TABLE OF char72.
DATA:lv_string TYPE string.
DATA:len TYPE i,
l_off TYPE i,
r_off TYPE i,
lam type i.
lv_string = '123123jbjskdhvkkxzncjkn1234123jhjkhzkdvczjcklzxjcklxjzclkzxjcklj13j12kl3j1kljlk12j3kjlk2j3'.
l_off = 0.
r_off = 16.
len = STRLEN( lv_string ) - 1.
DO.
lam = l_off + 16.
if lam >= len.
lam = len - l_off.
wa-line = lv_string+l_off(lam).
APPEND wa TO it.
CLEAR wa.
EXIT.
ENDIF.
wa-line = lv_string+l_off(16).
l_off = l_off + 16.
APPEND wa TO it.
CLEAR wa.
ENDDO.
2010 Aug 25 12:35 PM
or you can use the function RKD_WORD_WRAP , pass string to TEXTLINE and 132 to OUTPUTLEN.
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |