Skip to Content
0
Nov 30, 2011 at 04:28 AM

BAPI_BUPA_ADDRESS_CHANGE changes all addresses, not just intended one

111 Views

Hi,

I am using BAPI_BUPA_ADDRESS_CHANGE to change address usages.In transaction BP, we maintain several address usages - mailing address, billing address, delivery address etc.. For each of these we have a address type. Using this address type and 'U' in update flag, I am using FM BAPI_BUPA_ADDRESS_CHANGE to change a particular address type. The code is below.


    g_addressusage-addresstype = c_mail_add.
    append g_addressusage to i_addressusage.
    clear g_addressusage.


    g_addr_usage_x-addresstype = 'X'.
    g_addr_usage_x-updateflag = c_upd_aduse.
    append g_addr_usage_x to i_addr_usage_x.
    clear g_addr_usage_x.

    call function 'BAPI_BUPA_ADDRESS_CHANGE'
      exporting
        businesspartner = g_dealer_flex_app-internal_account
        addressdata     = g_addressdata
        addressdata_x   = g_chng_add_x
      tables
        addressusage    = i_addressusage
        addressusage_x  = i_addr_usage_x
        return          = e_ret.

The FM works well with sy-subrc = 0 but the new address replaces all address usages including the standard address! I specifically mentioned c_mail_add as address type for which I need to assign a new address. However, the FM overwrites other address types too. Am I missing something here?

Thank you.