SAP SPBT_FIND_FREE_SERVER Function Module for Determining a server that can process the next task
SPBT_FIND_FREE_SERVER is a standard spbt find free server SAP function module available within SAP R/3 or S/4 Hana systems, depending on your version and release level. It is used for Determining a server that can process the next task 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 spbt find free server FM, simply by entering the name SPBT_FIND_FREE_SERVER into the relevant SAP transaction such as SE37 or SE38.
Function Group: SPBT
Program Name: SAPLSPBT
Main Program: SAPLSPBT
Appliation area: S
Release date: 27-Sep-1996
Mode(Normal, Remote etc): Normal Function Module
Update:

Function SPBT_FIND_FREE_SERVER 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 'SPBT_FIND_FREE_SERVER'"Determining a server that can process the next task.
EXPORTING
* RFC_FUNCTION_MODULE = ' ' "Name of the RFC module of the application
IMPORTING
SERVER_NAME = "Server with PBT resources
EXCEPTIONS
ALL_SERVERS_ARE_BUSY = 1 PBT_ENV_NOT_INITIALIZED_YET = 2 INTERNAL_ERROR = 3
IMPORTING Parameters details for SPBT_FIND_FREE_SERVER
RFC_FUNCTION_MODULE - Name of the RFC module of the application
Data type: TFDIR-FUNCNAMEDefault: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)
EXPORTING Parameters details for SPBT_FIND_FREE_SERVER
SERVER_NAME - Server with PBT resources
Data type: PBTRESOURC-SERVERNAMEOptional: No
Call by Reference: No ( called with pass by value option)
EXCEPTIONS details
ALL_SERVERS_ARE_BUSY - No servers with PBT resources available
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
PBT_ENV_NOT_INITIALIZED_YET - PBT environment has not yet been initialized
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
INTERNAL_ERROR - Internal error (see syslog)
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
Copy and paste ABAP code example for SPBT_FIND_FREE_SERVER 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_server_name | TYPE PBTRESOURC-SERVERNAME, " | |||
| lv_rfc_function_module | TYPE TFDIR-FUNCNAME, " SPACE | |||
| lv_all_servers_are_busy | TYPE TFDIR, " | |||
| lv_pbt_env_not_initialized_yet | TYPE TFDIR, " | |||
| lv_internal_error | TYPE TFDIR. " |
|   CALL FUNCTION 'SPBT_FIND_FREE_SERVER' "Determining a server that can process the next task |
| EXPORTING | ||
| RFC_FUNCTION_MODULE | = lv_rfc_function_module | |
| IMPORTING | ||
| SERVER_NAME | = lv_server_name | |
| EXCEPTIONS | ||
| ALL_SERVERS_ARE_BUSY = 1 | ||
| PBT_ENV_NOT_INITIALIZED_YET = 2 | ||
| INTERNAL_ERROR = 3 | ||
| . " SPBT_FIND_FREE_SERVER | ||
ABAP code using 7.40 inline data declarations to call FM SPBT_FIND_FREE_SERVER
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 SERVERNAME FROM PBTRESOURC INTO @DATA(ld_server_name). | ||||
| "SELECT single FUNCNAME FROM TFDIR INTO @DATA(ld_rfc_function_module). | ||||
| DATA(ld_rfc_function_module) | = ' '. | |||
Search for further information about these or an SAP related objects