SAP SREL_GET_NEXT_NEIGHBORS Function Module for Determine Related Objects









SREL_GET_NEXT_NEIGHBORS is a standard srel get next neighbors SAP function module available within SAP R/3 or S/4 Hana systems, depending on your version and release level. It is used for Determine Related Objects 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 srel get next neighbors FM, simply by entering the name SREL_GET_NEXT_NEIGHBORS into the relevant SAP transaction such as SE37 or SE38.

Function Group: SREL
Program Name: SAPLSREL
Main Program:
Appliation area: S
Release date: 09-Aug-2002
Mode(Normal, Remote etc): Remote-Enabled
Update:



Function SREL_GET_NEXT_NEIGHBORS 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 'SREL_GET_NEXT_NEIGHBORS'"Determine Related Objects
EXPORTING
OBJECT = "BOR Object ID
* ROLETYPE = "Role Type
* RELATIONTYPE = "Relationship Type
* MAX_HOPS = 1 "Maximum Number of Jumps
* BYPASS_BUFFER = ' ' "'X' Read Again from the Database

TABLES
* NEIGHBORS = "Related Roles

EXCEPTIONS
INTERNAL_ERROR = 1 NO_LOGSYS = 2
.



IMPORTING Parameters details for SREL_GET_NEXT_NEIGHBORS

OBJECT - BOR Object ID

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

ROLETYPE - Role Type

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

RELATIONTYPE - Relationship Type

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

MAX_HOPS - Maximum Number of Jumps

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

BYPASS_BUFFER - 'X' Read Again from the Database

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

TABLES Parameters details for SREL_GET_NEXT_NEIGHBORS

NEIGHBORS - Related Roles

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

EXCEPTIONS details

INTERNAL_ERROR - Internal Error

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

NO_LOGSYS - Separate Logical System Not Defined

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

Copy and paste ABAP code example for SREL_GET_NEXT_NEIGHBORS 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_object  TYPE BORIDENT, "   
lt_neighbors  TYPE STANDARD TABLE OF NEIGHBOR, "   
lv_internal_error  TYPE NEIGHBOR, "   
lv_roletype  TYPE RELROLES-ROLETYPE, "   
lv_no_logsys  TYPE RELROLES, "   
lv_relationtype  TYPE BRELTYP-RELTYPE, "   
lv_max_hops  TYPE RELHOPS, "   1
lv_bypass_buffer  TYPE FLAG. "   SPACE

  CALL FUNCTION 'SREL_GET_NEXT_NEIGHBORS'  "Determine Related Objects
    EXPORTING
         OBJECT = lv_object
         ROLETYPE = lv_roletype
         RELATIONTYPE = lv_relationtype
         MAX_HOPS = lv_max_hops
         BYPASS_BUFFER = lv_bypass_buffer
    TABLES
         NEIGHBORS = lt_neighbors
    EXCEPTIONS
        INTERNAL_ERROR = 1
        NO_LOGSYS = 2
. " SREL_GET_NEXT_NEIGHBORS




ABAP code using 7.40 inline data declarations to call FM SREL_GET_NEXT_NEIGHBORS

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 ROLETYPE FROM RELROLES INTO @DATA(ld_roletype).
 
 
"SELECT single RELTYPE FROM BRELTYP INTO @DATA(ld_relationtype).
 
DATA(ld_max_hops) = 1.
 
DATA(ld_bypass_buffer) = ' '.
 


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!