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: 

User exit to validate email address on FD01 / FD02

carlos_laborda
Explorer
0 Kudos

Hi experts :

When creating / modifying customer data by using t-codes FD01 & FD02, I have to check if field SMTP_ADDR (email address)is empty depending on the value of other field from KNA1.

I can't make email mandatory (that was my first idea), and user exit EXIT_SAPMF02D_001 has the data from KNA1 but not the email addres.

I'm trying to use FM DYNP_VALUES_READ in the user exit mentioned above to read the value from SMTP_ADDR, but it is always returning exception INVALID_DYNPRONAME.

Does anybody knows another user exit to check this field (SMTP_ADDR)?.

Thanks in advance for your answers.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

In that customer exit EXIT_SAPMF02D_001 in SAPMF02D enhancement,

Try to insert this code and check

DATA : lf_adrnr type kna1-adrnr.

data : lf_email type adr6-SMTP_ADDR.

select single adrnr from kna1 into lf_adrnr

where kunnr eq i_kna1-kunnr.

if sy-subrc eq 0.

select single SMTP_ADDR from adr6 into lf_email

where ADDRNUMBER eq lf_adrnr.

if lf_email is initial.

message 'Please Enter Email Id' TYPE 'E'.

endif.

endif.

Thanks & Regards,

Pydi Reddy.

3 REPLIES 3

nirmal_dhulia
Member
0 Kudos

steps:

execute program RSMODPRF

give the data element AD_SMTPADR

create functionmodule FIELD_EXIT_AD_SMTPADR

write your code here.

if input is initial.

message E398(00) with 'Enter Email id'.

endif.

actvate this function module.

again execute program RSMODPRF without giving any data element.

from the list you will get the data element name AD_SMTPADR.

select this data element and assign the program and screen name like this.

program : SAPMF02D

Screen: 7000

save your entries.

again select this data element .

go to menu

Field Exit->activate

it will work.

Former Member
0 Kudos

Hi,

In that customer exit EXIT_SAPMF02D_001 in SAPMF02D enhancement,

Try to insert this code and check

DATA : lf_adrnr type kna1-adrnr.

data : lf_email type adr6-SMTP_ADDR.

select single adrnr from kna1 into lf_adrnr

where kunnr eq i_kna1-kunnr.

if sy-subrc eq 0.

select single SMTP_ADDR from adr6 into lf_email

where ADDRNUMBER eq lf_adrnr.

if lf_email is initial.

message 'Please Enter Email Id' TYPE 'E'.

endif.

endif.

Thanks & Regards,

Pydi Reddy.

carlos_laborda
Explorer
0 Kudos

Closed.