cancel
Showing results for 
Search instead for 
Did you mean: 

Multiple lines in text edit

Former Member
0 Kudos

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.

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Any specific reason you want to divide the string into multiple strings of 132 char ? Radhika.

Former Member
0 Kudos

Hi,

I can save the string value only by puuting that in a table where each row will contain 132 characters.So i need to divide the string into row of 132 lenght and need to append it to table to save it.

thnx

abhi.

former_member40425
Contributor
0 Kudos

Hi,

Use FM STRING_SPLIT_AT_POSITION

I hope it helps.

Regards,

Rohit

Former Member
0 Kudos

Hi Radhika,

Sorry its not wrking.Reason is the FM exports two vaiable of type Char...but i need them to be of string.Because one of them has to be string as we dont know the lenght of the initial string which is to be divided.Any other way???

thnx,

abhi.

former_member40425
Contributor
0 Kudos

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

Former Member
0 Kudos
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