‎2007 Jun 20 1:18 PM
Hi all,
I am entering one text like condition of type c of length 100.
Now i want to split it into two parts in the program like 50 in each...
but i also want to check that spliting should not occurs in betweeen word means my word should not split,spliting should occur after that word
Is that possible
thanks in advance....
‎2007 Jun 20 1:51 PM
Sure you can, but not without some coding: Check if position 50 is equal to space. If yes, then just split, if no then search the first position after position 50 equal to space and perform the split accordingly.
Regards,
John.
‎2007 Jun 20 1:56 PM
Hi,
Just use
CALL FUNCTION 'RKD_WORD_WRAP'
EXPORTING
textline = w_footer "Total string , in your case 100 ch
delimiter = ' '
outputlen = 50
IMPORTING
out_line1 = w_footer1 "Defined as 50 ch each
out_line2 = w_footer2 "Defined as 50 char each
out_line3 = w_footer3
TABLES
OUT_LINES =
EXCEPTIONS
outputlen_too_large = 1
OTHERS = 2
I hope this helps,
Regards
Raju Chitale
‎2007 Jun 21 5:35 AM
Hi Dhwani,
See the code given below.
Try something like this.
It will help u...
&----
*& Report ZTEJAS
*&
&----
*&
*&
&----
REPORT ZTEJAS.
PARAMETERS : P TYPE CHAR200.
DATA : V TYPE STRING,
V1 TYPE STRING,
V2 TYPE STRING.
DATA I TYPE I.
DATA I1 TYPE I.
DATA I2 TYPE I.
DATA I3 TYPE I.
data p1(200).
p1 = p.
DO .
IF P IS INITIAL.
EXIT.
ENDIF.
SPLIT P AT SPACE INTO V P.
IF sy-index <> 1.
CONCATENATE V1 V INTO V1 SEPARATED BY SPACE.
ENDIF.
I = STRLEN( V1 ).
IF I > 100.
V2 = P.
EXIT.
ELSE.
ENDIF.
ENDDO.
SHIFT v1 LEFT DELETING LEADING space.
i1 = strlen( v1 ).
i2 = strlen( v2 ).
i3 = strlen( p1 ).
WRITE : i1, '-', v1, /, /, i2, '-', v2, /, /, i3, '-', p1.
-Tejas
‎2007 Jun 21 6:01 AM
try this
data : text(100) value 'This is a test to split at the length of 50 in between two parts',
text1(60),
text2(60),
v_char,
pos type i value 49.
do 20 times.
v_char = text+pos(1).
if v_char = space.
text1 = text+0(pos).
pos = pos + 1.
text2 = text+pos.
exit.
endif.
pos = pos + 1.
enddo.
write : / text1.write : / text2.
regards
shiba dutta