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: 

BAPI_ADDRESSORG_SAVEREPLICA

Former Member

Dear Experts,

I have an requirement where I have to create a new address in the ADRC table for a customer. I have found out about the FM BAPI_ADDRESSORG_SAVEREPLICA to create new addresses, but the problem is I dun really know how to use this FM, the attributes to put into it.

Can anyone be kind enough to show me some sample coding for this FM, i.e. like what field I should put in for the OBJ_TYPE if I am to create a new address for customer.

Thanks in advance and points will be rewarded for helpful answers.

2 REPLIES 2

Former Member
0 Kudos

A bit of additional information, the type of address I am creating is the Ship-to Address for the Customer, so should I put in 0006 (Delivery address per order item) for the Context Input field, thanks.

former_member404244
Active Contributor
0 Kudos

Hi,

The organization address is determined from the specified object type and key, and overwritten by the specified current address and communication data. This module is usually called by the ALE function module IDOC_INPUT_ADRMAS.

An ALE IDOC is created and distributed in AB1 by the module ALE_ADDRESSORG_SAVEREPLICA after the function module MASTERIDOC_CREATE_REQ_ADRMAS has been called.

When the IDOC arrives in AB2, it is read by the module IDOC_INPUT_ADRMAS, and its data are passed to the module BAPI_ADDRESSORG_SAVEREPLICA. The object type OBJ_TYPE, the object key OBJ_ID, the object key extension OBJ_ID_EXT, and the context CONTEXT are the same as in the source system.

For example, values are assigned as follows in the (main) customer address:

Object type: 'KNA1'

Object key: <customer number>

(extension empty): ' '

context: '0001'

The module call is as follows:

DATA: bapiad1vl like bapiad1vl occurs 0,

bapiadtel like bapiadtel occurs0,

...

bapicomrem like bapicomrem occurs 0,

return like bapiret2,

addrnumber like adrc-addrnumber.

CALL FUNCTION 'BAPI_ADDRESSORG_SAVEREPLICA'

EXPORTING

OBJ_TYPE_C = 'KNA1'

OBJ_ID = '4712'

OBJ_ID_EXT = ' '

CONTEXT = '0001'

IMPORTING

RETURN = return

ADDRESS_NUMBER = addrnumber

tables

bapiad1vl = bapiad1vl

BAPIADTEL = bapiadtel

BAPIADFAX = bapiadfax

BAPIADTTX = bapiadttx

BAPIADTLX = bapiadtlx

BAPIADSMTP = bapiadsmtp

BAPIADRML = bapiadrml

BAPIADX400 = bapiadx400

BAPIADRFC = bapiadrfc

BAPIADPRT = bapiadprt

BAPIADSSF = bapiadssf

BAPIADURI = bapiaduri

BAPIADPAG = bapiadpag

BAPICOMREM = bapicomrem.

IF NOT RETURN IS INITIAL.

...

ENDIF.

The data for address number ADDRNUMBER has now been updated in AB2.

Reward if helpful.

Regards,

nagaraj