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

Email validation

Former Member
0 Likes
1,322

hi Experts,

How to validate email id in screen painter field?

7 REPLIES 7
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
840

You would have to hande that with a MODULE statement in the screen flow logic. The validation would really depend on your coding. Is the validation only that there is a first part, then an @, then the second part?

Regards,

Rich Heilman

Read only

0 Likes
840

after @ i want to check email validation.

like it should be yahoo, gmail, rediffmail and hotmail, msn.com

how can i do that?

Read only

0 Likes
840

Check the below links :

https://www.sdn.sap.com/irj/sdn/wiki?path=/display/snippets/e-mail%2bvalidation

I am sure that the above links will help you

Thanks

Seshu

Read only

Former Member
Read only

ferry_lianto
Active Contributor
0 Likes
840

Hi,

You can use FM SX_INTERNET_ADDRESS_TO_NORMAL and pass address type as INT.

Regards,

Ferry Lianto

Read only

jaideeps
Product and Topic Expert
Product and Topic Expert
0 Likes
840

hi,

you can use this FM --SX_INTERNET_ADDRESS_TO_NORMAL

which will give you a SY-SUBRC <> 0 for invalid mail addresses.

As it checks one address only, you may define

data:

lt_mails type string,

lv_mail type string.

split p_mail at ';' into lt_mails.

loop at lt_mails into lv_mail.

CALL FUNCTION 'SX_INTERNET_ADDRESS_TO_NORMAL'

  • check the parameters - I'm not logged on

if sy-subrc <> 0.

    • error 'invalid mail address' lv_mail in p_mail

endif.

endloop.

thanks

jaideep

*reward points if useful..

Read only

Former Member
0 Likes
840

Hi,

Please try following code.

declare c_int adn wa_address as below.

data : c_int type soextreci1-adr_typ value 'INT',

wa_address type sx_address.

wa_address-address = p_p_email.(email id entered)

wa_address-type = c_int.

call function module and pass the above parameters.

*Using FM to check if the email address entered is a valid one

call function 'SX_INTERNET_ADDRESS_TO_NORMAL'

exporting

address_unstruct = wa_address

exceptions

error_address_type = 1

error_address = 2

error_group_address = 3

others = 4.

if sy-subrc <> 0.

*Text-001 : Invalid Email ID

message e000 with text-001.(text-001 - Invalid email-id)

endif.

Reward if useful,

Thanks,

Neeraja.C