Application Development 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: 

Splitting a string at a particular position

madhusudana_reddy2
Contributor
0 Kudos

Hi ,

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

Regards,

Madhu

1 ACCEPTED SOLUTION

former_member194669
Active Contributor
0 Kudos
7 REPLIES 7

former_member194669
Active Contributor
0 Kudos

Former Member
0 Kudos

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

manubhutani
Active Contributor
0 Kudos

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

itab2-age.

Former Member
0 Kudos

Hi,

use this fm.

CALL FUNCTION 'CONVERT_STRING_TO_TABLE'

EXPORTING

I_STRING = STR1

I_TABLINE_LENGTH = 108

TABLES

ET_TABLE = STR_TEXT.

Former Member
0 Kudos

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.

Former Member
0 Kudos

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.

Former Member
0 Kudos

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

regards,

srinivas