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: 

check email-adress

helmut_sieberer
Participant
0 Kudos

Hello !

i have one question:

does anybody know, if there is a function or something else, where i can check, if an entered email-adress is correct.

i couldn't find anything in the function builder.

thanks a lot

Greets Helmut

1 ACCEPTED SOLUTION

helmut_sieberer
Participant
0 Kudos

hello !

i just wanted to check, if an entered string is a valid email adress (in general).

for example:

abc@def@xy.de is not correct

abc.def@xy.de is correct

acd.def@ is not correct

and so on...

just a formal check of an entered value.

Thanks

Helmut

9 REPLIES 9

Former Member
0 Kudos

former_member181962
Active Contributor
0 Kudos

Hi Helmut,

I think there is no standard function module to check the correctness of an email.

If you know that all the valid emails (That are relavent to your company) are stored in a data base table, you can verify the correctness by comparing with those values

Another way is to cook your own logic to check for the occurances of '@' symbol etc using search statement in abap.

Regards,

ravi

Former Member
0 Kudos

Hai Helmut,

I will send you some function modules

REPORT Z_SENDITAB_EMAIL_SREE_13424 .

tables : mara.

DATA IT_MAIL(200) TYPE C OCCURS 0 WITH HEADER LINE.

  • message body:

IT_MAIL = '1st line.'. APPEND IT_MAIL.

IT_MAIL = '2nd line.'. APPEND IT_MAIL.

IT_MAIL = '3rd line.'. APPEND IT_MAIL.

IT_MAIL = '4th line.'. APPEND IT_MAIL.

  • to view the following function (cannot be viewed in se37):

  • go to sm59, select 'TCP/IP connections',

  • select and open 'SERVER_EXEC' or 'LOCAL_EXEC',

  • look on the pull down menu SYSTEM INFORMATION->FUNCTION LIST

data : begin of itab occurs 0,

matnr like mara-matnr,

mtart like mara-mtart,

mbrsh like mara-mbrsh,

meins like mara-meins,

end of itab.

select

matnr

mtart

mbrsh

meins

from mara

into table itab.

if sy-subrc = 0.

CALL FUNCTION 'RFC_MAIL' DESTINATION 'LOCAL_EXEC'

EXPORTING USER = 'sreenivasulup@intelligroup.com'

  • EXPORTING USER = 'venkatarama@intelligroup.com'

  • TABLES MAIL = IT_MAIL.

TABLES MAIL = ITAB.

endif.

CASE SY-SUBRC.

WHEN 0. WRITE 'E-mail sent successfully.'.

WHEN OTHERS. WRITE 'Error sending E-mail!'.

ENDCASE.

************************************************************************

Thanks & regards

Sreenivasulu P

Former Member
0 Kudos

Helmut,

What do you want to check it against?

1. E-mail address in the user profile?

2. E-mail address in Mail server?

From user profile, you can get the e-mail address by calling BAPI_USER_GETDETAIL, then you can validate against that.

Against the Mail server one, I am not sure if we can do that.

Regards,

Ravi

Note : Please mark the helpful answers

former_member188685
Active Contributor
0 Kudos

Hi,

if you are talking about users e-mail address then you can validate the same using the table ADR6.

get the addressnumber and goto table adr6 and check the e-mail .

Regards

vijay

helmut_sieberer
Participant
0 Kudos

hello !

i just wanted to check, if an entered string is a valid email adress (in general).

for example:

abc@def@xy.de is not correct

abc.def@xy.de is correct

acd.def@ is not correct

and so on...

just a formal check of an entered value.

Thanks

Helmut

0 Kudos

if v_email np '@.*'.

write:/ 'invalid'.

endif.

This code means that any pattern with a @ and . without following the same order is invalid.

But things are not so straight forward.

I think the effort you put to validate the email is not worth it because, even if it is a valid e mail address by your rules, it may not exist in the real world.

Regards,

Ravi Kanth

0 Kudos

Hello,

check the function module:

'SX_INTERNET_ADDRESS_TO_NORMAL'

This is used in SAP office to check the address.

Regards,

Dezso

helmut_sieberer
Participant
0 Kudos

Thanks!

sx_internet_address_to_normal

does it

Greets