Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Splitting a string at a particular position

madhusudana_reddy2
Contributor
0 Likes
2,932

Hi ,

how do i split a string at a particular position ....say 108

Regards,

Madhu

1 ACCEPTED SOLUTION
Read only

former_member194669
Active Contributor
0 Likes
1,472
7 REPLIES 7
Read only

former_member194669
Active Contributor
0 Likes
1,473
Read only

Former Member
0 Likes
1,472

DATA: str1 TYPE string,

str2 TYPE string,

str3 TYPE string,

itab TYPE TABLE OF string,

text TYPE string.

text = `What a drag it is getting old............`.

SPLIT text AT space INTO: str1 str2 str3,

TABLE itab.

-


<b>DATA: str1 TYPE string,

text(108) TYPE char.

str1= `What a drag it is getting old...........`.

MOVE str1 TO text.

</b>

Regards,

Pavan

Read only

manubhutani
Active Contributor
0 Likes
1,472

split w_itab-rec at '108' into itab2-name

itab2-age.

Read only

Former Member
0 Likes
1,472

Hi,

use this fm.

CALL FUNCTION 'CONVERT_STRING_TO_TABLE'

EXPORTING

I_STRING = STR1

I_TABLINE_LENGTH = 108

TABLES

ET_TABLE = STR_TEXT.

Read only

Former Member
0 Likes
1,472

Data : lv_start type i,

lv_end type i.

data : lv_string type string.

data : begin of itab occurs 0,

value(180) type c,

end of itab.

DATA : LV_LEN TYPE I.

lv_start = 0.

lv_end = 108.

LV_LEN = STRLEN(LV_STRING).

do.

itab-value = lv_string+lv_start(lv_end).

appned itab.

lv_start = LV_END.

lv_end = lv_end+ 108.

IF LV_END > LV_LEN.

EXIT.

ENDIF.

endloop.

Read only

Former Member
0 Likes
1,472

Hi Use this FM.

CALL FUNCTION 'CONVERT_STRING_TO_TABLE'

EXPORTING

I_STRING = PR_STR

I_TABLINE_LENGTH = 108

TABLES

ET_TABLE = LI_TEMP_TEXT.

Thankx.

Read only

Former Member
0 Likes
1,472

<a href="http://www.sap-img.com/ab039.htm">refer this link</a>

regards,

srinivas