‎2009 Jun 03 7:09 PM
Hi,
Is anyone familiar with function module that helps validate E-mail address ?
‎2009 Jun 03 7:16 PM
‎2009 Jun 03 7:17 PM
You can use a RegEx for this. Here is an example program.
PARAMETERS email TYPE c LENGTH 30 LOWER CASE DEFAULT '<enter email address>'.
DATA matcher TYPE REF TO cl_abap_matcher.
matcher = cl_abap_matcher=>create(
pattern = `\w+(\.\w+)*@(\w+\.)+(\w{2,4})`
ignore_case = 'X'
text = email ).
IF matcher->match( ) is INITIAL.
MESSAGE 'Wrong Format' TYPE 'I'.
ELSE.
MESSAGE 'Format OK' TYPE 'I'.
ENDIF.Regards,
Rich Heilman
‎2015 Sep 25 1:16 PM
Hi Rich,
You code works exactly what I need in my program to do..
Thanks a lot...
‎2020 Sep 30 2:44 AM
this code doesn't validate this type of email address
abc.efg-xyz@domain.com
I used this code and I get error of 'Invalid email address'
instead try this regex
'^([0-9a-zA-Z]([-.w]*[0-9a-zA-Z])*@([0-9a-zA-Z][-w]*[0-9a-zA-Z].)+[azA-Z]{2,9})$'
‎2021 Sep 14 11:17 AM
‎2009 Jun 04 8:12 AM
‎2021 Sep 14 6:15 PM
This task is used as an example in the ABAP documentation:
BR
Horst