SAP LDAP_SEARCH Function Module for









LDAP_SEARCH is a standard ldap search SAP function module available within SAP R/3 or S/4 Hana systems, depending on your version and release level. It is used to perform a specific ABAP function and below is the pattern details, 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 ldap search FM, simply by entering the name LDAP_SEARCH into the relevant SAP transaction such as SE37 or SE38.

Function Group: SLDAP
Program Name: SAPLSLDAP
Main Program:
Appliation area: S
Release date: N/A
Mode(Normal, Remote etc): Normal Function Module
Update:



Function LDAP_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 'LDAP_SEARCH'"
EXPORTING
* BASE = '' "
* NO_MANIPULATION = "
* BASE_STRING = "Distinguished Name (String)
* SCOPE = 2 "
* MODE = 'C' "
* CROP = 'X' "
* CROP_DN_ATTR = 'X' "
* FILTER = '(objectclass=*)' "
* FILTER_STRING = "Search Filter (String)
* TIMEOUT = "

IMPORTING
LDAPRC = "

TABLES
DNS_OUT = "
ATTRS_IO = "
* VALUES_OUT = "

EXCEPTIONS
NO_AUTHORIZ = 1 CONN_OUTDATE = 2 LDAP_FAILURE = 3 NOT_ALIVE = 4 OTHER_ERROR = 5
.



IMPORTING Parameters details for LDAP_SEARCH

BASE -

Data type: LDAPDEFS-BASE
Default: ''
Optional: Yes
Call by Reference: No ( called with pass by value option)

NO_MANIPULATION -

Data type: XFELD
Optional: Yes
Call by Reference: No ( called with pass by value option)

BASE_STRING - Distinguished Name (String)

Data type: LDAP_DNS
Optional: Yes
Call by Reference: No ( called with pass by value option)

SCOPE -

Data type: LDAPDEFS-SCOP
Default: 2
Optional: Yes
Call by Reference: No ( called with pass by value option)

MODE -

Data type: LDAPDEFS-MODX
Default: 'C'
Optional: Yes
Call by Reference: No ( called with pass by value option)

CROP -

Data type: LDAPDEFS-FLAG
Default: 'X'
Optional: Yes
Call by Reference: No ( called with pass by value option)

CROP_DN_ATTR -

Data type: XFELD
Default: 'X'
Optional: Yes
Call by Reference: No ( called with pass by value option)

FILTER -

Data type: LDAPDEFS-FILT
Default: '(objectclass=*)'
Optional: Yes
Call by Reference: No ( called with pass by value option)

FILTER_STRING - Search Filter (String)

Data type: LDAP_FILTS
Optional: Yes
Call by Reference: No ( called with pass by value option)

TIMEOUT -

Data type: LDAP_TIME
Optional: Yes
Call by Reference: No ( called with pass by value option)

EXPORTING Parameters details for LDAP_SEARCH

LDAPRC -

Data type: LDAPDEFS-LDRC
Optional: No
Call by Reference: No ( called with pass by value option)

TABLES Parameters details for LDAP_SEARCH

DNS_OUT -

Data type: LDAP_DNII
Optional: No
Call by Reference: No ( called with pass by value option)

ATTRS_IO -

Data type: LDAP_ATII
Optional: No
Call by Reference: No ( called with pass by value option)

VALUES_OUT -

Data type: LDAP_VALI
Optional: Yes
Call by Reference: No ( called with pass by value option)

EXCEPTIONS details

NO_AUTHORIZ - No Authorization

Data type:
Optional: No
Call by Reference: No ( called with pass by value option)

CONN_OUTDATE - Old connection

Data type:
Optional: No
Call by Reference: No ( called with pass by value option)

LDAP_FAILURE -

Data type:
Optional: No
Call by Reference: No ( called with pass by value option)

NOT_ALIVE -

Data type:
Optional: No
Call by Reference: No ( called with pass by value option)

OTHER_ERROR -

Data type:
Optional: No
Call by Reference: No ( called with pass by value option)

Copy and paste ABAP code example for LDAP_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_base  TYPE LDAPDEFS-BASE, "   ''
lv_ldaprc  TYPE LDAPDEFS-LDRC, "   
lt_dns_out  TYPE STANDARD TABLE OF LDAP_DNII, "   
lv_no_authoriz  TYPE LDAP_DNII, "   
lv_no_manipulation  TYPE XFELD, "   
lt_attrs_io  TYPE STANDARD TABLE OF LDAP_ATII, "   
lv_base_string  TYPE LDAP_DNS, "   
lv_conn_outdate  TYPE LDAP_DNS, "   
lv_scope  TYPE LDAPDEFS-SCOP, "   2
lt_values_out  TYPE STANDARD TABLE OF LDAP_VALI, "   
lv_ldap_failure  TYPE LDAP_VALI, "   
lv_mode  TYPE LDAPDEFS-MODX, "   'C'
lv_not_alive  TYPE LDAPDEFS, "   
lv_crop  TYPE LDAPDEFS-FLAG, "   'X'
lv_other_error  TYPE LDAPDEFS, "   
lv_crop_dn_attr  TYPE XFELD, "   'X'
lv_filter  TYPE LDAPDEFS-FILT, "   '(objectclass=*)'
lv_filter_string  TYPE LDAP_FILTS, "   
lv_timeout  TYPE LDAP_TIME. "   

  CALL FUNCTION 'LDAP_SEARCH'  "
    EXPORTING
         BASE = lv_base
         NO_MANIPULATION = lv_no_manipulation
         BASE_STRING = lv_base_string
         SCOPE = lv_scope
         MODE = lv_mode
         CROP = lv_crop
         CROP_DN_ATTR = lv_crop_dn_attr
         FILTER = lv_filter
         FILTER_STRING = lv_filter_string
         TIMEOUT = lv_timeout
    IMPORTING
         LDAPRC = lv_ldaprc
    TABLES
         DNS_OUT = lt_dns_out
         ATTRS_IO = lt_attrs_io
         VALUES_OUT = lt_values_out
    EXCEPTIONS
        NO_AUTHORIZ = 1
        CONN_OUTDATE = 2
        LDAP_FAILURE = 3
        NOT_ALIVE = 4
        OTHER_ERROR = 5
. " LDAP_SEARCH




ABAP code using 7.40 inline data declarations to call FM LDAP_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 BASE FROM LDAPDEFS INTO @DATA(ld_base).
DATA(ld_base) = ''.
 
"SELECT single LDRC FROM LDAPDEFS INTO @DATA(ld_ldaprc).
 
 
 
 
 
 
 
"SELECT single SCOP FROM LDAPDEFS INTO @DATA(ld_scope).
DATA(ld_scope) = 2.
 
 
 
"SELECT single MODX FROM LDAPDEFS INTO @DATA(ld_mode).
DATA(ld_mode) = 'C'.
 
 
"SELECT single FLAG FROM LDAPDEFS INTO @DATA(ld_crop).
DATA(ld_crop) = 'X'.
 
 
DATA(ld_crop_dn_attr) = 'X'.
 
"SELECT single FILT FROM LDAPDEFS INTO @DATA(ld_filter).
DATA(ld_filter) = '.
 
 
 


Search for further information about these or an SAP related objects



Comments on this SAP object

What made you want to lookup this SAP object? Please tell us what you were looking for and anything you would like to be included on this page!