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

Split field values into range

Former Member
0 Likes
3,613

Hi,

I have a 'Company Code' field in an input file that can contain 1 or multiple company codes, separated by comma (,). e.g it could be anything from '1105' to '1105,3000,2000,2200' etc up to about a max of 20 company codes.

I don't think it's efficient or good programming to do the following;

SPLIT l_bukrs_string AT ';' INTO

l_bukrs1

l_bukrs2

l_bukrs3

l_bukrs4

l_bukrs5

l_bukrs6.

etc etc up to the maximum (I would be declaring up to 20 more fields).

The ideal would be if I can get the list of company codes (from the field), into a range. So as per my example above, I would left with a range R_BUKRS that contains the single values 1105,3000,2000,2200. I can then loop at this range later on and do the rest of my company code specific processing.

And ideas - possible use of field symbols? Thanks alot

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,752

Hi,

You can split the entire line into a table ...

data : itab TYPE TABLE OF string,

SPLIT l_bukrs_string AT ';' INTO TABLE itab.

Itab contains the values , one line for each word .

Regards,

Srini.

3 REPLIES 3
Read only

Former Member
0 Likes
1,753

Hi,

You can split the entire line into a table ...

data : itab TYPE TABLE OF string,

SPLIT l_bukrs_string AT ';' INTO TABLE itab.

Itab contains the values , one line for each word .

Regards,

Srini.

Read only

Former Member
0 Likes
1,752

Hi,

why don´t you put in in an internal table.

do it 20 times.

SPLIT l_bukrs_string AT ';' INTO l_bukrs1 text1.

move l_bukrs to itab-bukrs.

append itab.

enddo.

Regards Nicole

Read only

Former Member
0 Likes
1,752

Hi

You can use same slit statement to store data in internal table.

My idea is to slit the file into internal table and use this internal table like for all entries in or like select-options.


SPLIT text_flie AT ',' into table IT_BUKRS.
select * from dbtable for all entries in it_BUKRS
  condn

Hi Shrini you I posted on the same time, I did not copied, sorry

Thanks,

Anmol.

Edited by: anmol112 on Feb 15, 2011 9:25 AM