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 field

Former Member
0 Likes
902

Hi group,

I have one field with long text,I need to split this field after 20th position till ',' occurs.

can any body suggest how to procedd.

9 REPLIES 9
Read only

andreas_mann3
Active Contributor
0 Likes
861

hi,

try fm TR_SPLIT_TEXT

and look here:

regards

Andreas

Read only

Former Member
0 Likes
861

HAi

Check the following Code

Data : a(20),

b(20),

c(20),

d(80).

d = 'aaaaaaaaaaaaaaaaaaaa,baaaaaaaaaaaaaaaaaaa,

caaaaaaaaaaaaaaaaaaa'.

split d at ',' into a b c.

write 😕 a,

/ b,

/ c.

Thanks & regards

Sreenivasulu P

Thanks & regards

Sreeni

Read only

Former Member
0 Likes
861

DATA:

longtext TYPE STRING,

reqfield type string,

p TYPE C,

off TYPE I,

len type I.

longtext = 'Everyone knows this Everyone knows this Everyone, knows this'.

p = ','.

FIND p IN c MATCH OFFSET off.

if off > 20.

len = off - 20.

reqfield = longext+20(len).

endif.

Read only

Former Member
0 Likes
861

hi

DATA: ws_char type char1000.

DATA: ws_split type char1000

suppose ws_char is your long text

ws_split = ws_char+20(100).

split ws_split at ',' into text1 text2.

text1 should contain your required text

award points for useful answers

Read only

Former Member
0 Likes
861

Hi,

First find the string length . if it is more than 20 then use offset and move the text from 20 to strlength. and now split that string.

data: text(100),
      text1(80).

text = 'ABCDEDFFGGGGGGGGGGGGdddd,test'.
text1 = text+20(80).
now use this..
TYPES: BEGIN OF ITAB_type, 
        WORD(20), 
      END   OF ITAB_type. 

DATA: ITAB TYPE STANDARD TABLE OF ITAB_TYPE. 

SPLIT text1 AT ',' INTO TABLE ITAB.

regards

vijay

Read only

0 Likes
861

Hi group,

I am having text like this

'ands,werew,asdsd,adsdddffff,asdsdsdd,asdsds,'

not its single comma.

Read only

Former Member
0 Likes
861

hi,

As you want to split your long text after 20th position, first move the text from 20th position till end to another variable and then split the text at ','.

data: v_char type char1000. "this is your long text

DATA: v_split type char1000 "store your text from 20th position till end in this.

v_split = ws_char+20(100).

*Now Spliet it at ','.

split v_split at ',' into v_split1 v_split2 v_split3.

Regards,

Richa

Read only

ibrahim_u
Active Participant
0 Likes
861

data : a(100) value
'aaaaaaaaaa,bbbbbbbbbb,cccccccccc,dddddddddd'.

data : begin of b occurs 0,
       word(100),
       end of b.

split a+20 at ',' into table b. 

regards

ibrahim

Read only

Former Member
0 Likes
861

Hi use this ,

*

W_FTEXT = <Your Long Text>.

W_TEXTLINE = W_FTEXT.

W_DELIMITER = ','. "Your Seperator

W_OUTPUTLEN = 20.

*

*

CALL FUNCTION 'RKD_WORD_WRAP'

EXPORTING

TEXTLINE = W_TEXTLINE

DELIMITER = W_DELIMITER

OUTPUTLEN = W_OUTPUTLEN

IMPORTING

OUT_LINE1 = W_LINE1

OUT_LINE2 = W_LINE2

OUT_LINE3 = W_LINE3.

if helpful this, mark me