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: 

split string into internal table

Former Member
0 Kudos

Hi

i have a internal table that contains one field like

abc@def@ghi

then i want to move abc to itab1-field1and itab1-field2 ....

can any one tell me performance wise how to do it

1 ACCEPTED SOLUTION

sreeramkumar_madisetty
Active Contributor
0 Kudos

Hi

You can use

READ DATASET v_file_listings INTO single_line. "Reading the content of file into line

IF sy-subrc = 0.

IF sy-index > 1. "skip header-line

SPLIT "Split the content of line into work area

single_line

above code helps u.

Regards,

kumar

9 REPLIES 9

sreeramkumar_madisetty
Active Contributor
0 Kudos

Hi

You can use

READ DATASET v_file_listings INTO single_line. "Reading the content of file into line

IF sy-subrc = 0.

IF sy-index > 1. "skip header-line

SPLIT "Split the content of line into work area

single_line

above code helps u.

Regards,

kumar

Former Member
0 Kudos
data : v_char(50) value 'abc@def@ghi'.

data : begin of itab occurs 0,
            str(250)
         end of itab.

split v_char at '@' into table itab.

Former Member
0 Kudos

Hello

You can do like:


SPLIT ITAB-FIELD1 AT '@' INTO ITAB1-F1 ITAB-F2 ITAB-F3 ITAB-F2.

Vasanth

Former Member
0 Kudos

Hi,

Use spilt var at '@' into v_var.

then move this field to itab

insert itab

regards

Shiva

Former Member
0 Kudos

Hi,

DATA: ALPHA(15) TYPE C VALUE 'ABC@DEF@GHIJ', 
          ALPHA1     TYPE STRING,
          ALPHA2     TYPE STRING,
          ALPHA3     TYPE STRING

SPLIT alpha AT DELIMITER INTO aplha1 aplha2 alpha3.

If u specify deleimiter it will take care of what ever special characters occurs in between teh string.

Reward if this helsp.

Former Member
0 Kudos

hi kiran,

do this way

loop at itab.
split itab-fld at '@' into var1 var2.
endloop.

Former Member
0 Kudos

SPLIT f AT g INTO TABLE itab.

F is the string , and G is the separator and ITAB is the target internal table.

u can have help on this for better understading.

Regards,

Sujatha.

0 Kudos

use the split operator. I don't think it will create any performance problem

see the pseudo code

loop itab1

split itab1-fld at '@' into itab2-fld1 itab2-fld2

append itab2.

endloop

If found useful reward with points

Former Member
0 Kudos

Hi,

data: begin of itab occurs 0,

field1(3) type c,

field2(3) type c,

end of itab.

data: v_string(11) type c value 'abc@def@ghi' .

split v_string at '@' into itab-field1 itab-field2.

append itab.

Regards,

Sruthi