on 09-02-2009 8:05 AM
Hi All,
How can i divide a variable of type string into a variables of type char of length 132.
Its like in the front end the textedit is binded to a contect attribute of type string.But while we save that , it has to be divided into rows of lenght 132 char and then append it into a table and then it can be saved.
thnx,
abhi.
Any specific reason you want to divide the string into multiple strings of 132 char ? Radhika.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Abhishek,
Try following code.
data:lv_string type string.
data: string1 type string.
data: string2 type string.
string1 = lv_string+0(131). " It will contain first 132
string2 =lv_string+132(131). " It will give u rest.
Or
You can use FM RKD_WORD_WRAP with OUTPUTLEN = 30
I hope it helps.
Regards
Rohit
DATA: l_length TYPE i.
DATA: l_string type string.
DATA: l_text1(132) type c.
DATA: l_pos TYPE i VALUE 132.
l_length = STRLEN( l_string ).
IF l_length GT l_pos.
l_text1 = l_string+0(l_pos). " It will contain first 132 chars
SHIFT l_string LEFT BY l_pos PLACES.
l_length = STRLEN( l_string ).
WHILE ( l_length GT l_pos ).
CLEAR l_text1.
l_text1 = l_string+0(l_pos). " It will contain next 132 chars
SHIFT l_string LEFT BY l_pos PLACES.
l_length = STRLEN( l_string ).
ENDWHILE.
ENDIF.
" l_string will have the remaining characters
User | Count |
---|---|
86 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.