Skip to Content
0
Former Member
Feb 11, 2011 at 04:52 PM

BAPI_BUPA_ADDRESS_CHANGE does not create an entry in ADR2

815 Views

Hi,

Scenario:

Address record (ADRC) already exists for Business Partner

but no corresponding record in ADR2 - since the telephone number has not been entered yet

During change scenario, wherein there is a change only to telephone number - via code - Im using BAPI_BUPA_ADDRESS_CHANGE and it does not work - it does not update/create an entry in ADR2 table

The same is the case for email, fax.

The return table is blank and adtel and adtelx populated and both the itab contain entries:

  select *
    from adr2
    into table lt_adr2
    where addrnumber = ls_adrc-addrnumber and
          date_from <= sy-datum.
  loop at lt_adr2 assigning <ls_adr2>.
    ls_adtel-country    = <ls_adr2>-country.
    ls_adtel-STD_NO     = <ls_adr2>-FLGDEFAULT.
    ls_adtel-telephone  = <ls_adr2>-TEL_NUMBER.
    ls_adtel-extension  = <ls_adr2>-TEL_EXTENS.
    ls_adtel-tel_no     = <ls_adr2>-TELNR_LONG.
    ls_adtel-caller_no  = <ls_adr2>-TELNR_CALL.
    ls_adtel-std_recip  = <ls_adr2>-DFT_RECEIV.
    ls_adtel-R_3_USER   = <ls_adr2>-R3_USER.
    ls_adtel-HOME_FLAG  = <ls_adr2>-HOME_FLAG.
    ls_adtel-CONSNUMBER = <ls_adr2>-CONSNUMBER.
    ls_adtel-FLG_NOUSE  = <ls_adr2>-FLG_NOUSE.
    ls_adtel-VALID_FROM = <ls_adr2>-VALID_FROM.
    ls_adtel-VALID_TO   = <ls_adr2>-VALID_TO.
    append ls_adtel to lt_adtel.
    clear ls_adtel.
  endloop.

      ls_adtelx-country    = lc_x.
      ls_adtelx-STD_NO     = lc_x.
      ls_adtelx-telephone  = lc_x.
      ls_adtelx-extension  = lc_x.
      ls_adtelx-tel_no     = lc_x.
      ls_adtelx-caller_no  = lc_x.
      ls_adtelx-std_recip  = lc_x.
      ls_adtelx-R_3_USER   = lc_x.
      ls_adtelx-HOME_FLAG  = lc_x.
      ls_adtelx-CONSNUMBER = lc_x.
      ls_adtelx-FLG_NOUSE  = lc_x.
      ls_adtelx-VALID_FROM = lc_x.
      ls_adtelx-VALID_TO   = lc_x.
      append ls_adtelx to lt_adtelx.
      clear ls_adtelx.

  CALL FUNCTION 'BAPI_BUPA_ADDRESS_CHANGE'
    EXPORTING
      BUSINESSPARTNER              = LV_BUSINESSPARTNER
      ADDRESSDATA                  = ls_addressdata
      ADDRESSDATA_X                = ls_addressdata_x
    TABLES
      BAPIADTEL                    = lt_adtel
      BAPIADTEL_X                  = lt_adtelx
      RETURN                       = lt_return.

I assume change will work if there is a record already in ADR2 table - not sure

But when creating, if there is no telephone number, email address, fax, then how do we create a correct "blank record" - tried creating a record in ADR2 during Business Partner creation - populated only country field in ADTEL but did not work - ADR2 did not have any record created!

Im using FM BAPI_BUPA_CREATE_FROM_DATA for creating Business Partner and its corresponding Address

Please help - let me know if you require anything else.

Thanks

Rajeev