SAP Function Modules

ADDR_GET SAP Function module - Read an address without dialog







ADDR_GET is a standard SAP function module available within R/3 SAP systems depending on your version and release level. Below is the pattern details for this FM showing its interface including any import and export parameters, exceptions etc as well as any documentation contributions (Comments) specific to the object.

See here to view full function module documentation and code listing, simply by entering the name ADDR_GET into the relevant SAP transaction such as SE37 or SE80.

Associated Function Group: SZA0
Released Date: Not Released
Processing type: Normal fucntion module
Normal function module settings


Pattern for FM ADDR_GET - ADDR GET





CALL FUNCTION 'ADDR_GET' "Read an address without dialog
  EXPORTING
    address_selection =         " addr1_sel     Specification of an address (see long text)
*   address_group =             " adrg-addr_group  Address group (see long text for special handling)
*   read_sadr_only = SPACE      " szad_field-flag  Read in table SADR only
*   read_texts = SPACE          " szad_field-flag  Flag: Read texts (ADDRESS_TEXT)
*   iv_current_comm_data = SPACE  " ad_comcurr  Indicator: Current Status of Communication Data
  IMPORTING
    address_value =             " addr1_val     Return data for an address
    address_additional_info =   " ad1_flags     Additional communication data information
    returncode =                " szad_field-returncode  Return code: ' '(ok), 'I'nfo, 'W'arning, 'E'rror
    address_text =              " addr1_text    Text for key fields (language = SY-LANGU)
    sadr =                      " sadr          Return the old address structure
* TABLES
*   address_groups =            " adagroups     Address groups to which the address is assigned
*   error_table =               " addr_error    Table with errors, warnings, information
*   versions =                  " addr_vers     Table with international versions
  EXCEPTIONS
    PARAMETER_ERROR = 1         "               Incorrect parameter values
    ADDRESS_NOT_EXIST = 2       "               Address does not exist
    VERSION_NOT_EXIST = 3       "               International version of the address does not exist
    INTERNAL_ERROR = 4          "               Serious internal error (MESSAGE A...)
    .  "  ADDR_GET

ABAP code example for Function Module ADDR_GET





The ABAP code below is a full code listing to execute function module ADDR_GET including all data declarations. The code uses the latest in-line data DECLARATION SYNTAX but I have included an ABAP code snippet at the end to show how declarations would look using the original method of declaring data variables up front. This will allow you to compare and fully understand the new inline method. Please note some of the newer syntax such as the @DATA is not available until a later 4.70 service pack (SP8).

DATA:
ld_address_value  TYPE ADDR1_VAL ,
ld_address_additional_info  TYPE AD1_FLAGS ,
ld_returncode  TYPE SZAD_FIELD-RETURNCODE ,
ld_address_text  TYPE ADDR1_TEXT ,
ld_sadr  TYPE SADR ,
it_address_groups  TYPE STANDARD TABLE OF ADAGROUPS,"TABLES PARAM
wa_address_groups  LIKE LINE OF it_address_groups ,
it_error_table  TYPE STANDARD TABLE OF ADDR_ERROR,"TABLES PARAM
wa_error_table  LIKE LINE OF it_error_table ,
it_versions  TYPE STANDARD TABLE OF ADDR_VERS,"TABLES PARAM
wa_versions  LIKE LINE OF it_versions .

DATA(ld_address_selection) = 'Check type of data required'.

SELECT single ADDR_GROUP
FROM ADRG
INTO @DATA(ld_address_group).


DATA(ld_read_sadr_only) = some text here

DATA(ld_read_texts) = some text here
DATA(ld_iv_current_comm_data) = 'Check type of data required'.

"populate fields of struture and append to itab
append wa_address_groups to it_address_groups.

"populate fields of struture and append to itab
append wa_error_table to it_error_table.

"populate fields of struture and append to itab
append wa_versions to it_versions. . CALL FUNCTION 'ADDR_GET' EXPORTING address_selection = ld_address_selection * address_group = ld_address_group * read_sadr_only = ld_read_sadr_only * read_texts = ld_read_texts * iv_current_comm_data = ld_iv_current_comm_data IMPORTING address_value = ld_address_value address_additional_info = ld_address_additional_info returncode = ld_returncode address_text = ld_address_text sadr = ld_sadr * TABLES * address_groups = it_address_groups * error_table = it_error_table * versions = it_versions EXCEPTIONS PARAMETER_ERROR = 1 ADDRESS_NOT_EXIST = 2 VERSION_NOT_EXIST = 3 INTERNAL_ERROR = 4 . " ADDR_GET
IF SY-SUBRC EQ 0. "All OK ELSEIF SY-SUBRC EQ 1. "Exception "Add code for exception here ELSEIF SY-SUBRC EQ 2. "Exception "Add code for exception here ELSEIF SY-SUBRC EQ 3. "Exception "Add code for exception here ELSEIF SY-SUBRC EQ 4. "Exception "Add code for exception here ENDIF.







ABAP code to compare 7.40 inline data declaration with original syntax

The below ABAP code uses the older none in-line data declarations. This allows you to see the coding differences/benefits of the later inline syntax. It may also be useful if you are using an older version of SAP as some of the newer syntax above, such as the @DATA is not available until 4.70 EHP 8.

DATA:
ld_address_value  TYPE ADDR1_VAL ,
ld_address_selection  TYPE ADDR1_SEL ,
it_address_groups  TYPE STANDARD TABLE OF ADAGROUPS ,
wa_address_groups  LIKE LINE OF it_address_groups,
ld_address_additional_info  TYPE AD1_FLAGS ,
ld_address_group  TYPE ADRG-ADDR_GROUP ,
it_error_table  TYPE STANDARD TABLE OF ADDR_ERROR ,
wa_error_table  LIKE LINE OF it_error_table,
ld_returncode  TYPE SZAD_FIELD-RETURNCODE ,
ld_read_sadr_only  TYPE SZAD_FIELD-FLAG ,
it_versions  TYPE STANDARD TABLE OF ADDR_VERS ,
wa_versions  LIKE LINE OF it_versions,
ld_address_text  TYPE ADDR1_TEXT ,
ld_read_texts  TYPE SZAD_FIELD-FLAG ,
ld_sadr  TYPE SADR ,
ld_iv_current_comm_data  TYPE AD_COMCURR .

ld_address_selection = 'Check type of data required'.

"populate fields of struture and append to itab
append wa_address_groups to it_address_groups.

SELECT single ADDR_GROUP
FROM ADRG
INTO ld_address_group.


"populate fields of struture and append to itab
append wa_error_table to it_error_table.

ld_read_sadr_only = some text here

"populate fields of struture and append to itab
append wa_versions to it_versions.

ld_read_texts = some text here
ld_iv_current_comm_data = 'Check type of data required'.

SAP Documentation for FM ADDR_GET


The function module reads all records for the addresses specified in the structure ADD RESS_SELECTION ...See here for full SAP fm documentation

Contribute (Add Comments)

Please help keep this info upto date and use the comments section below to add useful hints, tips and information specific to this SAP function. This will then be available for you and other users to easily find by simply searching on the object name ADDR_GET or its description.