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

internal table help

Former Member
0 Likes
514

Hi,

I have a line like the following..

A000001234GriffithsTimothy ^840USNA0999CC#0034567841^BO0987110400

I want to get this into an internal table separated by ^ sign, what do i do.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
483

use SPLIT ...AT..

Regards,

Mohaiyuddin

4 REPLIES 4
Read only

Former Member
0 Likes
484

use SPLIT ...AT..

Regards,

Mohaiyuddin

Read only

Former Member
0 Likes
483

Hi,

first declare required number of fields, and one internal table whith those fields.

now by using SPLIT statement, you can read them into some variables.

now assign these variables to internal table and append.

SPLIT string_name at '^' into field1 field2......

it_tab1-field1 = field1.

it_tab1-field2 = field2.

......

......

......

append it_tab1.

Regards

Sandeep Reddy

Read only

Former Member
0 Likes
483

Hello

SPLIT f AT g INTO TABLE itab.

Splits f wherever the separator g occurs and places the resulting sections into the fields of internal table itab. The sytsem creates a table row for each section of f.

Note: If f ends with the separator string g, the system does not create an empty table row at the end. This is in contrast to what happens when g occurs at the beginning of f.

Read only

Former Member
0 Likes
483

Hi,

Try this-

Data: w_string(100),

w_del type c value '^'.

Data:

begin of wa,

f1(20) ,

end of wa.

Data: itab like table of wa.

w_string = 'A000001234GriffithsTimothy ^840USNA0999CC#0034567841^BO0987110400'

SPLIT w_string at w_del into table itab.

Loop at itab into wa.

Write:/ wa-f1.

Endloop.

Thanks.

Sujit