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: 

Mail domain check

former_member194669
Active Contributor
0 Kudos
1,051

Hi All,

I have check table with following email address domain values.

@abc.com

@def.com

@ghi.com

@jkl.com

....

....

....

like said above i have all in an internal table.

and i am getting a user smtp address thru selection screen input, I need to validate the user email address getting

thru selection screen with above said values from internal table that user smtp address ending match with the internal table valies.

I have done this by using the following command

SEARCH itab FOR g. (Here g contains the domain name from user smtp address)

I like to know is there any better method for doing this?

Thanks

aRs

1 ACCEPTED SOLUTION

former_member194669
Active Contributor
0 Kudos
293

Hi,

I need to one more point to my query.

The domain internal table mentioned have a thousand of domains.

Thanks

aRs

4 REPLIES 4

Former Member
0 Kudos
293

Hi,

Use CS ..

DATA: v_char(30) VALUE 'NAREN@ABC.COM'.

IF v_char CS '@ABC.COM'.

WRITE: / 'True'.

ELSE.

WRITE: / 'False'.

ENDIF.

Thanks,

Naren

former_member194669
Active Contributor
0 Kudos
294

Hi,

I need to one more point to my query.

The domain internal table mentioned have a thousand of domains.

Thanks

aRs

293
data: domain type string.
data: name type string.

parameters: email(255) type c.

at selection-screen.


split email at '@' into name domain .

concatenate '@' domain into domain.
condense domain no-gaps.
translate domain to upper case.

read table itab with key domain = domain.
if sy-subrc <> 0.
  message E001(00) with 'Email domain not valid'.
endif.

How about this?

Regards,

RIch Heilman

former_member194669
Active Contributor
0 Kudos
293

Thanks Rich,

Your reply solved the problem.

Points given.

Thanks

aRs