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 at semicolon

Former Member
0 Kudos

Hello All,

I have a customized table, whose fields are sold to party, sales organization, distribution channel and email recipients. The email recipient field will be populated with not just one email address. The separator of each email address from another is semi-colon. My question now is how can i efficiently split the email address from one another? Like how will i know that there are 4 email address entered in email field for one combination of sold to/sales org/distribution channel?

Thanks for your help!

Jim

1 ACCEPTED SOLUTION

former_member223537
Active Contributor
0 Kudos

HI Jim,

Ranges : r_mail for tablename-field.

data : str1(30) type c,

str2(30) type c,

mail(30) type c.

<b>mail = 'a@abc.com;b@abc.com;c@abc.com;d@abc.com'.

str2 = mail.</b>

r_mail-sign = 'I'.

r_mail-option = 'EQ'.

<b>do.

split str2 at ';' into str1 str2.

append str1 to r_mail.

if str2 cs ';'.

else.

exit.

endif.

enddo.</b>

At the end, r_mail will have all the mail ids.

Best regards,

Prashant

5 REPLIES 5

anversha_s
Active Contributor
0 Kudos

hi,

take ur itab-field( email field.).

use

replace all occurences of ';' with ' '.

this will seperate the ; field

rgds

anver

pls mark all hlpful answers

anversha_s
Active Contributor
0 Kudos

hi jim,

one mre option is there.

let itab-email be the field

SPLIT itab-email AT ';' INTO: str1 str2 str3.

so str1, str2..will contain the seperated email id.

rgds

anver

if helped mark points

jayanthi_jayaraman
Active Contributor
0 Kudos

Hi,

As far I know,this is the easiest way.

data : c1(30) type c value 'x@yahoo.com;y@yahoo.com',

c2(11),

c3(11).

split c1 at ';' into c2 c3.

write c2.

write c3.

Kindly reward points by clicking the star on the left of reply,if it helps.

Former Member
0 Kudos

Hi Jim,

Try this logic.

DATA: BEGIN OF t_email OCCURS 0,

email(40) type c,

END OF t_email.

data: begin of i_email occurs 0,

email(255) type c,

end of i_email.

select email into table i_email from your_table.

Loop at i_email into w_email.

split w_email at ';' into table t_email.

loop at t_email.

lv_email = t_email-email.

endloop.

endloop.

Regards

Arun

former_member223537
Active Contributor
0 Kudos

HI Jim,

Ranges : r_mail for tablename-field.

data : str1(30) type c,

str2(30) type c,

mail(30) type c.

<b>mail = 'a@abc.com;b@abc.com;c@abc.com;d@abc.com'.

str2 = mail.</b>

r_mail-sign = 'I'.

r_mail-option = 'EQ'.

<b>do.

split str2 at ';' into str1 str2.

append str1 to r_mail.

if str2 cs ';'.

else.

exit.

endif.

enddo.</b>

At the end, r_mail will have all the mail ids.

Best regards,

Prashant