Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

address update function module based on adrnr

HI all,

I am facing issue with update adrc , adr6 table .

I have some data in z segment of vendor master in inbound idoc. i need to update this data into adrc , adr6 and tiban table .

i have seen threads for update vendor master data , ADDR_MAINTAIN_COMPLETE., ADDR_UPDATE, BAPI_BUPA_ADDRESS_CHANGE., but these are not satisfactory .

Any one can help with any FM which can do the work for me?

Regards,

Karan

Former Member
Former Member replied

Did you try  ADDR_COMM_MAINTAIN as it is being used in standard transaction like XK01/02 FK01/02.

Sample code which is working in my system.

DATA : itab TYPE STANDARD TABLE OF adsmtp.

DATA : error_table TYPE STANDARD TABLE OF addr_error.

DATA : wa_itab TYPE adsmtp.

DATA : g_address_handle TYPE ad_handle.

wa_itab-consnumber = '001'. "Sequencial number 3 char

wa_itab-smtp_addr = 'test@gmail.com'.

wa_itab-smtp_srch = wa_itab-smtp_addr(20).

TRANSLATE wa_itab-smtp_srch TO UPPER CASE.

wa_itab-flgdefault = 'X'. "abap_true.

wa_itab-updateflag = 'U'. "I'nsert, 'U'pdate, 'D'elete

wa_itab-home_flag = 'X'.

APPEND wa_itab TO itab.

CALL FUNCTION 'ADDR_COMM_MAINTAIN'

   EXPORTING

     address_handle     = g_address_handle

     address_number     = '0000047056'

     table_type         = 'ADSMTP'

     iv_time_dependence = 'X' "abap_true'

   TABLES

     comm_table         = itab

     error_table        = error_table

   EXCEPTIONS

     parameter_error    = 1

     address_not_exist  = 2

     internal_error     = 3

     OTHERS             = 4.

IF sy-subrc <> 0.

   LEAVE PROGRAM.

*         MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

*               WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

CALL FUNCTION 'ADDR_MEMORY_SAVE'

* EXPORTING

*   EXECUTE_IN_UPDATE_TASK       = ' ' "You may want set this flag as 'X' if you are calling                                                                       "from BADI/UserExit or Idoc even based on reqmnt

  EXCEPTIONS

    ADDRESS_NUMBER_MISSING       = 1

    PERSON_NUMBER_MISSING        = 2

    INTERNAL_ERROR               = 3

    DATABASE_ERROR               = 4

    REFERENCE_MISSING            = 5

    OTHERS                       = 6

           .

IF sy-subrc <> 0.

* Implement suitable error handling here

ENDIF.

1 View this answer in context
Not what you were looking for? View more on this topic or Ask a question