SAP ADDR_PERS_COMP_NAME_SEARCH Function Module for Search Contact Person Addresses with Name String (Business Addr. Services)
ADDR_PERS_COMP_NAME_SEARCH is a standard addr pers comp name search SAP function module available within SAP R/3 or S/4 Hana systems, depending on your version and release level. It is used for Search Contact Person Addresses with Name String (Business Addr. Services) processing and below is the pattern details for this FM, showing its interface including any import and export parameters, exceptions etc. there is also a full "cut and paste" ABAP pattern code example, along with implementation ABAP coding, documentation and contribution comments specific to this or related objects.
See here to view full function module documentation and code listing for addr pers comp name search FM, simply by entering the name ADDR_PERS_COMP_NAME_SEARCH into the relevant SAP transaction such as SE37 or SE38.
Function Group: SZAF
Program Name: SAPLSZAF
Main Program: SAPLSZAF
Appliation area: S
Release date: 23-Aug-1999
Mode(Normal, Remote etc): Normal Function Module
Update:

Function ADDR_PERS_COMP_NAME_SEARCH pattern details
In-order to call this FM within your sap programs, simply using the below ABAP pattern details to trigger the function call...or see the full ABAP code listing at the end of this article. You can simply cut and paste this code into your ABAP progrom as it is, including variable declarations.CALL FUNCTION 'ADDR_PERS_COMP_NAME_SEARCH'"Search Contact Person Addresses with Name String (Business Addr. Services).
EXPORTING
SEARCH_STRING = "Search string for 'Last name, First name, Company'
* PERSON_GROUPS = "Person groups for search (include/exclude)
* WITH_DIALOG = 'X' "Flag: Hit list output as list
* SINGLE_SELECTION = ' ' "Flag: Only one entry can be selected (hit list)
* SEARCH_IN_ALL_PERSON_GROUPS = ' ' "Search all not-excluded groups
IMPORTING
NAME_STRING = "Complete name of selected contact person
KEY = "Selected contact person key
CANCELLED_BY_USER = "Flag: User cancelled search in dialog
NUMBER_OF_HITS = "Hit count
TABLES
SEARCH_RESULT = "Hit list
EXCEPTIONS
PARAMETER_ERROR = 1 INTERNAL_ERROR = 2 SEARCH_STRING_NOT_ALLOWED = 3 NO_MATCHES_FOUND = 4
IMPORTING Parameters details for ADDR_PERS_COMP_NAME_SEARCH
SEARCH_STRING - Search string for 'Last name, First name, Company'
Data type: SZADR_NAME_SEARCH_STRINGOptional: No
Call by Reference: No ( called with pass by value option)
PERSON_GROUPS - Person groups for search (include/exclude)
Data type: SZADR_PERSON_GROUP_TABOptional: Yes
Call by Reference: No ( called with pass by value option)
WITH_DIALOG - Flag: Hit list output as list
Data type: T_BOOLEDefault: 'X'
Optional: Yes
Call by Reference: No ( called with pass by value option)
SINGLE_SELECTION - Flag: Only one entry can be selected (hit list)
Data type: T_BOOLEDefault: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)
SEARCH_IN_ALL_PERSON_GROUPS - Search all not-excluded groups
Data type: T_BOOLEDefault: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)
EXPORTING Parameters details for ADDR_PERS_COMP_NAME_SEARCH
NAME_STRING - Complete name of selected contact person
Data type: ADRP-NAME_TEXTOptional: No
Call by Reference: No ( called with pass by value option)
KEY - Selected contact person key
Data type: SZADR_SO_KEY_LINE2Optional: No
Call by Reference: No ( called with pass by value option)
CANCELLED_BY_USER - Flag: User cancelled search in dialog
Data type: T_BOOLEOptional: No
Call by Reference: No ( called with pass by value option)
NUMBER_OF_HITS - Hit count
Data type: IOptional: No
Call by Reference: No ( called with pass by value option)
TABLES Parameters details for ADDR_PERS_COMP_NAME_SEARCH
SEARCH_RESULT - Hit list
Data type: ADDR3_VALOptional: No
Call by Reference: No ( called with pass by value option)
EXCEPTIONS details
PARAMETER_ERROR - Incorrect parameter values
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
INTERNAL_ERROR - Serious internal error (MESSAGE A...)
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
SEARCH_STRING_NOT_ALLOWED - Not-allowed string in search string
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
NO_MATCHES_FOUND - No contact person found
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
Copy and paste ABAP code example for ADDR_PERS_COMP_NAME_SEARCH Function Module
The ABAP code below is a full code listing to execute function module POPUP_TO_CONFIRM including all data declarations. The code uses the original data declarations rather than 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 newer method of declaring data variables on the fly. 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), which i why i have stuck to the origianl for this example.| DATA: | ||||
| lv_name_string | TYPE ADRP-NAME_TEXT, " | |||
| lt_search_result | TYPE STANDARD TABLE OF ADDR3_VAL, " | |||
| lv_search_string | TYPE SZADR_NAME_SEARCH_STRING, " | |||
| lv_parameter_error | TYPE SZADR_NAME_SEARCH_STRING, " | |||
| lv_key | TYPE SZADR_SO_KEY_LINE2, " | |||
| lv_person_groups | TYPE SZADR_PERSON_GROUP_TAB, " | |||
| lv_internal_error | TYPE SZADR_PERSON_GROUP_TAB, " | |||
| lv_with_dialog | TYPE T_BOOLE, " 'X' | |||
| lv_cancelled_by_user | TYPE T_BOOLE, " | |||
| lv_search_string_not_allowed | TYPE T_BOOLE, " | |||
| lv_number_of_hits | TYPE I, " | |||
| lv_no_matches_found | TYPE I, " | |||
| lv_single_selection | TYPE T_BOOLE, " SPACE | |||
| lv_search_in_all_person_groups | TYPE T_BOOLE. " SPACE |
|   CALL FUNCTION 'ADDR_PERS_COMP_NAME_SEARCH' "Search Contact Person Addresses with Name String (Business Addr. Services) |
| EXPORTING | ||
| SEARCH_STRING | = lv_search_string | |
| PERSON_GROUPS | = lv_person_groups | |
| WITH_DIALOG | = lv_with_dialog | |
| SINGLE_SELECTION | = lv_single_selection | |
| SEARCH_IN_ALL_PERSON_GROUPS | = lv_search_in_all_person_groups | |
| IMPORTING | ||
| NAME_STRING | = lv_name_string | |
| KEY | = lv_key | |
| CANCELLED_BY_USER | = lv_cancelled_by_user | |
| NUMBER_OF_HITS | = lv_number_of_hits | |
| TABLES | ||
| SEARCH_RESULT | = lt_search_result | |
| EXCEPTIONS | ||
| PARAMETER_ERROR = 1 | ||
| INTERNAL_ERROR = 2 | ||
| SEARCH_STRING_NOT_ALLOWED = 3 | ||
| NO_MATCHES_FOUND = 4 | ||
| . " ADDR_PERS_COMP_NAME_SEARCH | ||
ABAP code using 7.40 inline data declarations to call FM ADDR_PERS_COMP_NAME_SEARCH
The below ABAP code uses the newer in-line data declarations. This allows you to see the coding differences/benefits of the later inline syntax. Please note some of the newer syntax below, such as the @DATA is not available until 4.70 EHP 8.| "SELECT single NAME_TEXT FROM ADRP INTO @DATA(ld_name_string). | ||||
| DATA(ld_with_dialog) | = 'X'. | |||
| DATA(ld_single_selection) | = ' '. | |||
| DATA(ld_search_in_all_person_groups) | = ' '. | |||
Search for further information about these or an SAP related objects