2007 Jun 20 1:07 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....
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:18 PM
Hi Dhwani ,
All you need to do is check using offset what is the 50'th character , if it is space then split the text else check for the next character and so on.
Regards
Arun
2007 Jun 20 1:19 PM
2007 Jun 20 2:13 PM
Hi Dhwani ,
Here is a sample code which will help
data : name(20).
name = 'testtesttest 1234'.
data : index(2) type n ,
index2(2) type n,
temp .
data : name1(20) ,
name2(20).
index = 10.
temp = 'X'.
while temp ne space.
temp = name+index(1).
if temp = space.
name1 = name(index).
index2 = 20 - index - 1.
name2 = name+index(index2).
endif.
index = index + 1.
endwhile.
condense : name1 , name2.
write /: name1 ,
name2.
Regards
Arun
2007 Jun 20 1:19 PM
g = space.
SPLIT field AT g INTO h1 ... hn.
h1 to hn are the fields or variables where the results are available
2007 Jun 20 2:00 PM
You could do something like:
data: string(100) type c,
char(1) type c,
split1 type string,
split2 type string,
len type i.
len = strlen(string).
if strlen > 50.
char = string+50.
if char <> space.
split1 = string+50.
split2 = string+50(strlen).
endif.
endif.
the string split1 would contain the first 50 chars of your string as long as the 50th char was not a space. Split2 would contain the rest of the string.
2007 Jun 20 2:03 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 20 2:08 PM
PARAMETERS:text(100) TYPE c.
DATA:ln1 TYPE i.
DATA:text1(50) TYPE c,
text2(50) TYPE c,
ch TYPE c,
cl TYPE i VALUE 13,
ln TYPE i VALUE 1,
cl1(3) TYPE n.
ln1 = STRLEN( text ).
DO 10 TIMES.
cl1 = cl.
ch = text+cl1(ln).
IF ch = ' '.
text1 = text+0(cl1).
cl = cl + 1.
text2 = text+cl1(ln1).
EXIT.
ELSE.
cl = cl + 1.
ENDIF.
ENDDO.
WRITE:/ 'text1 = ',text1,'text2 = ',text2.
| User | Count |
|---|---|
| 6 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |