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

Address Change BAPI

Former Member
0 Likes
2,033

I want to change the SORT2 in ADRC. What is the BAPI to do this?

1 ACCEPTED SOLUTION
Read only

ferry_lianto
Active Contributor
0 Likes
1,670

Hi,

Please check this sample code.


ws_addr1-country = 'GB'.
ws_addr1-street = 'Allapkco road'.
ws_addr1-city1 = 'Bilton ioadedc'.
ws_addr1-post_code1 = '8KEY ME9'.
ws_addr1-title = '0002'.
ws_addr1-name1 = 'Prakash'.
ws_addr1-city1 = 'LONDON'.
ws_addr1-str_suppl1 = 'Sample'.
ws_addr1-location = 'GH'.
ws_addr1-extension1 = '15859'.
ws_addr1-taxjurcode = 'ZXZ'.
ws_addr1-deflt_comm = 'BTG'.


CALL FUNCTION 'ADDR_UPDATE'
  EXPORTING
    address_data = ws_addr1
    address_number = wsl_addrnum
    language = sy-langu
    check_address = space
  IMPORTING
    returncode = wsl_rcode
  TABLES
    error_table = il_rtab
  EXCEPTIONS
    address_not_exist = 1
    parameter_error = 2
    version_not_exist = 3
    internal_error = 4
    OTHERS = 5.

IF sy-subrc <> 0.
  MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
  WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ELSE.
  CALL FUNCTION 'ADDR_MEMORY_SAVE'
    EXPORTING
      execute_in_update_task = space
    EXCEPTIONS
      address_number_missing = 1
      person_number_missing = 2
      internal_error = 3
      database_error = 4
      reference_missing = 5
      OTHERS = 6.

  IF sy-subrc <> 0. 
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  ENDIF.
ENDIF.

Regards,

Ferry Lianto

10 REPLIES 10
Read only

Former Member
0 Likes
1,670

chk this

BAPI_BUPA_ADDRESS_CHANGE

Read only

former_member194669
Active Contributor
0 Likes
1,670

Hi,

BAPI_CUSTOMER_CHANGEFROMDATA

BAPI_CUSTOMER_CHANGEFROMDATA1

aRs

Read only

Former Member
0 Likes
1,670

None of these have SORT2 - search term as a field. Thats the one I am looking to update

Read only

0 Likes
1,670

Try addr_update .This is not a bapi, but it just looks like what you want.

Regards,

Ravi

Read only

ferry_lianto
Active Contributor
0 Likes
1,670

Hi,

Please check this FM ADDR_SAVE_INTERN and populate ADRC_U parameter.

Regards,

Ferry Lianto

Read only

Former Member
0 Likes
1,670

Hi,

Check the following link:

http://www.sap-img.com/abap/sample-abap-code-on-bapi-po-change.htm

hope its help to you.

Regards,

Bhaskar

Read only

Former Member
0 Likes
1,670

How to implement this function. What is address_data here? I need to change the addr1-sort2 field with another value

CALL FUNCTION 'ADDR_UPDATE'
  EXPORTING
    address_data              =
*   ADDRESS_HANDLE            = ' '
*   ADDRESS_NUMBER            = ' '
*   DATE_FROM                 = '00010101'
*   LANGUAGE                  = SY-LANGU
*   NATION                    = ' '
*   CHECK_EMPTY_ADDRESS       = 'X'
*   CHECK_ADDRESS             = 'X'
* IMPORTING
*   ADDRESS_DATA              =
*   RETURNCODE                =
*   DATA_HAS_CHANGED          =
* TABLES
*   ERROR_TABLE               =
* EXCEPTIONS
*   ADDRESS_NOT_EXIST         = 1
*   PARAMETER_ERROR           = 2
*   VERSION_NOT_EXIST         = 3
*   INTERNAL_ERROR            = 4
*   OTHERS                    = 5
          .
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.

Read only

ferry_lianto
Active Contributor
0 Likes
1,671

Hi,

Please check this sample code.


ws_addr1-country = 'GB'.
ws_addr1-street = 'Allapkco road'.
ws_addr1-city1 = 'Bilton ioadedc'.
ws_addr1-post_code1 = '8KEY ME9'.
ws_addr1-title = '0002'.
ws_addr1-name1 = 'Prakash'.
ws_addr1-city1 = 'LONDON'.
ws_addr1-str_suppl1 = 'Sample'.
ws_addr1-location = 'GH'.
ws_addr1-extension1 = '15859'.
ws_addr1-taxjurcode = 'ZXZ'.
ws_addr1-deflt_comm = 'BTG'.


CALL FUNCTION 'ADDR_UPDATE'
  EXPORTING
    address_data = ws_addr1
    address_number = wsl_addrnum
    language = sy-langu
    check_address = space
  IMPORTING
    returncode = wsl_rcode
  TABLES
    error_table = il_rtab
  EXCEPTIONS
    address_not_exist = 1
    parameter_error = 2
    version_not_exist = 3
    internal_error = 4
    OTHERS = 5.

IF sy-subrc <> 0.
  MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
  WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ELSE.
  CALL FUNCTION 'ADDR_MEMORY_SAVE'
    EXPORTING
      execute_in_update_task = space
    EXCEPTIONS
      address_number_missing = 1
      person_number_missing = 2
      internal_error = 3
      database_error = 4
      reference_missing = 5
      OTHERS = 6.

  IF sy-subrc <> 0. 
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  ENDIF.
ENDIF.

Regards,

Ferry Lianto

Read only

Former Member
0 Likes
1,670

I only want to change the SORT2 field and leave everything else the same.

This code changes the SORT2 field but also blanks out all other fields.

wa_addr1_data-sort2 = 'TEST'

CALL FUNCTION 'ADDR_UPDATE'
        EXPORTING
          address_data      = wa_addr1_data
          address_number    = wa_addrnum
          language          = sy-langu
          check_address     = space
        EXCEPTIONS
          address_not_exist = 1
          parameter_error   = 2
          version_not_exist = 3
          internal_error    = 4
          OTHERS            = 5.

      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

      ELSE.
        CALL FUNCTION 'ADDR_MEMORY_SAVE'
          EXPORTING
            execute_in_update_task = space
          EXCEPTIONS
            address_number_missing = 1
            person_number_missing  = 2
            internal_error         = 3
            database_error         = 4
            reference_missing      = 5
            OTHERS                 = 6.

        IF sy-subrc <> 0.
          MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                  WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
        ENDIF.
      ENDIF.

Read only

ferry_lianto
Active Contributor
0 Likes
1,670

Hi,

You still need to populate other fields even no changes.

Use this FM ADDR_GET to get detail address.

Regards,

Ferry Lianto