Skip to Content
0
Jul 28, 2012 at 11:54 AM

BAPI_OUTB_DELIVERY_CHANGE to Change a Partner Address

1552 Views

Hi,

I'm trying to use BAPI_OUTB_DELIVERY_CHANGE to change the address details of a partner in an existing outbound delivery but I've not had success. I wonder if anyone has had success using this BAPI to change a partner address. I'd like to pass in the address details to the BAPI, e.g., NAME, CITY, STREET, etc., without providing an existing ADDRESSNUMBER. I'd like to pass in the address details and let the system create a new ADRC address and attach the new address to the outbound delivery.

In addition to the code below, I've also tried passing in the header_partner table with a record that indicated a manual_addr entry, but didn't have any luck with that approach either. If anyone has achieved a partner address change using this BAPI or by some other approach, I'd be interested to know your solution.

  
  DATA ls_header         TYPE bapiobdlvhdrchg.
  DATA ls_header_control TYPE bapiobdlvhdrctrlchg.
  DATA ls_partner_addr   TYPE bapidlvpartnaddrchg.
  DATA lt_partner_addr   TYPE STANDARD TABLE OF bapidlvpartnaddrchg.
  DATA lt_return         TYPE bapiret2_t.

  ls_header-deliv_numb         = vbeln.
  ls_header_control-deliv_numb = vbeln.

  ls_partner_addr-upd_mode_adr = 'U'. " create or update
*  ls_partner_addr-addr_no            " left blank
  ls_partner_addr-name         = ls_ship_to-name1.
  ls_partner_addr-name_2       = ls_ship_to-name2.
  ls_partner_addr-city         = ls_ship_to-city1.
  ls_partner_addr-postl_cod1   = ls_ship_to-post_code1.
  ls_partner_addr-street       = ls_ship_to-street.
  ls_partner_addr-str_suppl2   = ls_ship_to-str_suppl2.
  ls_partner_addr-location     = ls_ship_to-location.
  ls_partner_addr-country      = ls_ship_to-country.
  ls_partner_addr-region       = ls_ship_to-region.
  ls_partner_addr-tel1_numbr   = ls_ship_to-tel_number.   

  APPEND ls_partner_addr TO lt_partner_addr.   

  CALL FUNCTION 'BAPI_OUTB_DELIVERY_CHANGE'     
    EXPORTING       
      header_data              = ls_header       
      header_control           = ls_header_control       
      delivery                 = vbeln     
    TABLES 
*  header_partner              = lt_partner      
      header_partner_addr      = lt_partner_addr       
      return                   = lt_return.   

  COMMIT WORK.

Cheers,

Amy