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 Exits/ BAdi

Former Member
0 Kudos

Hi Experts.

I need to make the field SZA5_D0700-SMTP_ADDR mandatory when ever a user is created or changed Via SU01. I played quite bit with the Following BAdi but couldn't achive what i need. We are not using <b>CUA </b>at all.

Here is the Code which i implimented. Doesn't slove my purpose..<i><b>I just need to check that field is not initial</b></i>

<b>

METHOD if_ex_address_update~address3_saved.</b>

  • Local data

DATA: lw_xadr6 LIKE LINE OF im_t_xadr6,

lw_yadr6 LIKE LINE OF im_t_yadr6.

DATA: lv_ans TYPE string.

  • Initialize

CLEAR: lw_xadr6,

lw_yadr6.

  • Only for 'SAP User Company Address'

IF im_person_group <> 'BC01'.

EXIT.

ENDIF.

  • Get the OLD email address

READ TABLE im_t_xadr6 INTO lw_xadr6 INDEX 1.

  • Get the NEW email address

READ TABLE im_t_yadr6 INTO lw_yadr6 INDEX 1.

IF lw_xadr6-smtp_addr IS INITIAL AND lw_yadr6-smtp_addr IS INITIAL.

MESSAGE e157(rsrd) WITH sy-uname.

RETURN.

ELSE.

  • Are the email addresses different?

IF lw_xadr6-smtp_addr <> lw_yadr6-smtp_addr.

  • Do something interesting here

IF lw_xadr6-smtp_addr EQ space.

MESSAGE e157(rsrd) WITH sy-uname.

RETURN.

ENDIF.

ENDIF.

ENDIF.

<b>ENDMETHOD.</b>

Thanks

A.

1 REPLY 1

laxmanakumar_appana
Active Contributor
0 Kudos

Hi Amandeep,

You can do this validation using fieldexit, same mentioned in the below link.if you define field exit then system will create FM like :

FUNCTION FIELD_EXIT_SMTP_ADDR_A.

*"----


""Local interface:

*" IMPORTING

*" REFERENCE(INPUT)

*" EXPORTING

*" REFERENCE(OUTPUT)

*"----


ENDFUNCTION.

then do the validation like

if input is initial.
 message e000(XXX) ' Maintain E-mail ID'.
endif.

and attach this FM to program SAPLSZA5 ,

screen number : 0900

Regards

Appana