10-03-2006 5:20 AM
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
10-03-2006 6:03 AM
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
10-03-2006 5:26 AM
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
10-03-2006 5:38 AM
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
10-03-2006 5:50 AM
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.
10-03-2006 5:58 AM
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
10-03-2006 6:03 AM
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