Application Development and Automation 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: 
Read only

BAPI_ADDRESSORG_CHANGE

Former Member
0 Likes
2,900

Hi,

I am using this BAPI BAPI_ADDRESSORG_CHANGE to insert Email addresses in the existing vendors. But along with this I need to insert value ADRT-Remark field and also change the standard comm type field (Seen in XK02). I am not able to figure out what fields I should be using from the BAPI to update the same. Can you please help ?

5 REPLIES 5
Read only

Former Member
0 Likes
1,902

H Vaibhav,

Try using the table BAPIAD_REM for address comments/remarks in BAPI_ADDRESSORG_CHANGE. (Do not forget the populate BAPIAD_RE_X)

Let me know if it solves ur problem.

BR

Rakesh

Read only

0 Likes
1,902

Hi,

This doesnt seem to help. It does not update the notes field (remark) along with the email address . Below the the code to populate the bapi

Also which field do I change to update the default communication type ?

BAPIADCOMREM doesn't seem to work.

WA_SMTP-E_MAIL = '[email protected]'.

APPEND WA_SMTP TO LT_SMTP.

wa_smtp-e_mail = '[email protected]'.

APPEND WA_SMTP TO LT_SMTP.

WA_COMREM-COMM_TYPE = 'INT'.

WA_COMREM-LANGU = 'EN'.

WA_COMREM-COMM_NOTES = 'TEST'.

WA_COMREM-CONSNUMBER = '001'.

APPEND WA_COMREM TO LT_COMREM.

WA_COMREM-COMM_TYPE = 'INT'.

WA_COMREM-LANGU = 'EN'.

WA_COMREM-COMM_NOTES = 'TEST'.

WA_COMREM-CONSNUMBER = '001'.

APPEND WA_COMREM TO LT_COMREM.

WA_ADSMT-E_MAIL = 'X'.

WA_ADSMT-CONSNUMBER = 'X'.

WA_ADSMT-UPDATEFLAG = 'I'.

WA_ADSMT-E_MAIL = 'X'.

WA_ADSMT-CONSNUMBER = 'X'.

WA_ADSMT-UPDATEFLAG = 'I'.

APPEND WA_ADSMT TO LT_ADSMT.

WA_ADSMT-E_MAIL = 'X'.

WA_ADSMT-CONSNUMBER = 'X'.

WA_ADSMT-UPDATEFLAG = 'I'.

WA_ADSMT-E_MAIL = 'X'.

WA_ADSMT-CONSNUMBER = 'X'.

WA_ADSMT-UPDATEFLAG = 'I'.

APPEND WA_ADSMT TO LT_ADSMT.

WA_COMRE-COMM_TYPE = 'X'.

WA_COMRE-LANGU = 'X'.

WA_COMRE-COMM_NOTES = 'X'.

WA_COMRE-CONSNUMBER = 'X'.

WA_COMRE-UPDATEFLAG = 'I'.

APPEND WA_COMRE TO LT_COMRE.

WA_COMRE-COMM_TYPE = 'X'.

WA_COMRE-LANGU = 'X'.

WA_COMRE-COMM_NOTES = 'X'.

WA_COMRE-CONSNUMBER = 'X'.

WA_COMRE-UPDATEFLAG = 'I'.

APPEND WA_COMRE TO LT_COMRE.

**************************************************

WA_ADREM-ADR_NOTES = ''.

APPEND WA_ADREM TO LT_ADREM.

WA_ADREX-ADR_NOTES = 'X'.

WA_ADREX-UPDATEFLAG = 'I'.

APPEND WA_ADREX TO LT_ADREX.

WA_ADREM-ADR_NOTES = 'R'.

APPEND WA_ADREM TO LT_ADREM.

WA_ADREX-ADR_NOTES = 'X'.

WA_ADREX-UPDATEFLAG = 'I'.

APPEND WA_ADREX TO LT_ADREX.

*****************************************************

CALL FUNCTION 'BAPI_ADDRESSORG_CHANGE'

EXPORTING

OBJ_TYPE = GC_LFA1

OBJ_ID = lv_VENDOR

CONTEXT = GC_0001

SAVE_ADDRESS = 'X'

IV_CHECK_ADDRESS = 'X'

IMPORTING

ADDRESS_NUMBER = LV_ADRNR

TABLES

BAPIADSMTP = LT_SMTP

BAPIAD_REM = LT_ADREM

BAPIADSMT_X = LT_ADSMT

BAPICOMRE_X = LT_COMRE

BAPIAD_RE_X = LT_ADREX

RETURN = LT_RETURN

Read only

Former Member
0 Likes
1,902

hi plz help me

for updating remarks field if any one got the solution

the same thing i am doing but i am not able to update remak field , which must be refrected in XD03 for the customer

Read only

0 Likes
1,902

Hi,

I have the same requirement , to update this field REMARK for customer using ABAP code.

Can you please help me ?

Thank you !

Harish Bhatt

Read only

0 Likes
1,902

Hello,

I got success to update REMARK field in ADRT table.

We can do following steps :

Get Sequence number:

   CALL FUNCTION 'ADDR_SELECT_ADRCOMC_SINGLE'

     EXPORTING

       addrnumber = p_adrnr  "Address Number

     TABLES

       et_adrcomc = lt_adrcomc.

   IF sy-subrc EQ 0.

     SORT lt_adrcomc BY comm_type.

     READ TABLE lt_adrcomc

           INTO ls_adrcomc

       WITH KEY comm_type = 'INT'

       BINARY SEARCH.

     IF sy-subrc EQ 0.

       ls_commtab-consnumber = ls_adrcomc-high_value + 1. "Sequence Number

     ENDIF.

   ENDIF.

   ls_commtab-smtp_addr = p_email.   "Email Address

   ls_commtab-remark = p_remark.      "Remark to add

   ls_commtab-updateflag = 'I'.            "Flag for insert

   APPEND ls_commtab TO lt_commtab.

Update Remark in XD02 (ADRT table)

   CALL FUNCTION 'ADDR_COMM_MAINTAIN'

     EXPORTING

       address_number              = p_adrnr                "Address Number

       date_from                      = '00010101'       

       language                       = sy-langu

       table_type                     = 'ADSMTP'             "Constant

       check_address                  = 'X'

       iv_time_dependence             = 'X'

       iv_consider_adrcomc_for_insert = 'X'

     IMPORTING

       returncode                     = lv_return

     TABLES

       comm_table                     = lt_commtab.

   IF sy-subrc = 0.

     IF p_test IS INITIAL.

       CALL FUNCTION 'ADDR_MEMORY_SAVE'.

     ENDIF.

     IF sy-subrc = 0.

       WRITE : / 'Table ADRT is updated successfully for address :',

                  p_adrnr.

     ENDIF.

   ELSE.

     WRITE : / 'Error- Table ADRT is not updated for address : ',

      p_adrnr.

   ENDIF.

Once data is updated in remark field of ADRT table, it will be reflected in XD02 also.

Please let me know if I am not clear enough.

Thank you !
Harish Bhatt