Skip to Content
0

BAPI_BUPA_ADDRESS_CHANGE does NOT update email address.

Jul 10, 2017 at 07:23 PM

75

avatar image

Hello,

I need to change Business Partner's phone number and Email address. I am using BAPI_BUPA_ADDRESS_CHANGE function module.

The phone number is being updated correctly but NOT an email address. Here is the code.

lv_partner = wa_partner-partner.

CALL FUNCTION 'BAPI_BUPA_ADDRESS_GETDETAIL'
EXPORTING
businesspartner = lv_partner
valid_date = sy-datum
TABLES
bapiadtel = lt_phone_old
bapiadsmtp = lt_email_old
return = et_return.

IF sy-subrc = 0.
IF lt_phone_old[] IS NOT INITIAL. "If there is an existing telephone no.
LOOP AT lt_phone_old INTO wa_phone_old.
wa_phone_new = wa_phone_old.
wa_phone_new-telephone = wa_file-phone_no.

APPEND wa_phone_new TO lt_phone_new.
CLEAR: wa_phone_new, wa_phone_old.
ENDLOOP.
ELSE.
wa_phone_new-telephone = wa_file-phone_no.

APPEND wa_phone_new TO lt_phone_new.
CLEAR: wa_phone_new, wa_phone_old.
ENDIF.
ls_telx-telephone = 'X'.
APPEND ls_telx TO lt_telx.

IF lt_email_old[] IS NOT INITIAL.
LOOP AT lt_email_old INTO wa_email_old.
wa_email_new = wa_email_old.
wa_email_new-e_mail = wa_file-email_add.
wa_email_new-std_no = 'X'.

APPEND wa_email_new TO lt_email_new.
CLEAR: wa_email_new, wa_email_old.
ENDLOOP.
ELSE.

CONCATENATE sy-datum '000000' INTO lv_validfrm.

wa_email_new-e_mail = wa_file-email_add.
wa_email_new-std_no = 'X'.

wa_email_new-email_srch = wa_file-email_add.
wa_email_new-home_flag = 'X'.
wa_email_new-consnumber = '001'.
wa_email_new-valid_from = lv_validfrm.

APPEND wa_email_new TO lt_email_new.
CLEAR: wa_email_new, wa_email_old.
ENDIF.
ls_smtpx-std_no = 'X'.
ls_smtpx-e_mail = 'X'.
ls_smtpx-email_srch = 'X'.
ls_smtpx-home_flag = 'X'.
ls_smtpx-consnumber = 'X'.
ls_smtpx-valid_from = 'X'.
APPEND ls_smtpx TO lt_smtpx.

CALL FUNCTION 'BAPI_BUPA_ADDRESS_CHANGE'
EXPORTING
businesspartner = lv_partner
TABLES
bapiadtel = lt_phone_new
bapiadsmtp = lt_email_new
bapiadtel_x = lt_telx
bapiadsmt_x = lt_smtpx
return = et_return.

IF sy-subrc = 0.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = ''.
ENDIF.

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

0 Answers