The below code shows how SAP function module SX_INTERNET_ADDRESS_TO_NORMAL is used check the format of an email address entered by a user.
*&---------------------------------------------------------------------* *& Report CHECK_EMAIL *& *&---------------------------------------------------------------------* *& Created On: Oct 2009 *& Created By: SAPDev.co.uk *&---------------------------------------------------------------------* REPORT ZCHECK_EMAIL. TYPES: BEGIN OF sx_address, "SAPconnect general addr type TYPE sxaddrtype-addr_type, address TYPE soextreci1-receiver, END OF sx_address. DATA: unstruct TYPE sx_address. PARAMETERS: p_email type string. ************************************************************************ *START-OF-SELECTION START-OF-SELECTION. unstruct-type = 'INT'. unstruct-address = p_email. CALL FUNCTION 'SX_INTERNET_ADDRESS_TO_NORMAL' EXPORTING ADDRESS_UNSTRUCT = unstruct * COMPLETE_ADDRESS = 'X' * IMPORTING * ADDRESS_NORMAL = * LOCAL = * DOMAIN = * COMMENT = * ADDR_NORMAL_NO_UPPER = * ADDR_NORMAL_NO_UP_WITH_COMMENT = EXCEPTIONS ERROR_ADDRESS_TYPE = 1 ERROR_ADDRESS = 2 ERROR_GROUP_ADDRESS = 3 OTHERS = 4. if sy-subrc ne 0. message i000(zz) with 'Please enter valid email address'. else. message i000(zz) with 'Email address is valid'. endif.