SAP STU3_ADMIN_SWITCH_DB_CON Function Module for Switch DB connection to another DB2 member









STU3_ADMIN_SWITCH_DB_CON is a standard stu3 admin switch db con SAP function module available within SAP R/3 or S/4 Hana systems, depending on your version and release level. It is used for Switch DB connection to another DB2 member 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 stu3 admin switch db con FM, simply by entering the name STU3_ADMIN_SWITCH_DB_CON into the relevant SAP transaction such as SE37 or SE38.

Function Group: STU3_ADMIN
Program Name: SAPLSTU3_ADMIN
Main Program: SAPLSTU3_ADMIN
Appliation area:
Release date: N/A
Mode(Normal, Remote etc): Remote-Enabled
Update:



Function STU3_ADMIN_SWITCH_DB_CON 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 'STU3_ADMIN_SWITCH_DB_CON'"Switch DB connection to another DB2 member
EXPORTING
NEW_DB_CON = "Defined DB2 connections (in connect.ini)
* SWITCH_ALL_APP_SERVERS = ' ' "Character Field Length 1
* NEW_HOST = "New host name (only relevant for SAP app servers on z/OS)
* WAIT_FOR_COMPLETION = ' ' "Wait until all connections have switched
* MAX_WAIT_TIME = "Max. wait time for switch to complete in seconds

EXCEPTIONS
ZOS_AS_SWITCH_TO_ANOTHER_LPAR = 1 COULD_NOT_DETERMINE_INSTANCES = 2 ERROR_DURING_SWITCH = 3 USER_NOT_AUTHORIZED = 4 NEW_DB_CON_UNKNOWN = 5 MAX_WAIT_TIME_EXCEEDED = 6
.



IMPORTING Parameters details for STU3_ADMIN_SWITCH_DB_CON

NEW_DB_CON - Defined DB2 connections (in connect.ini)

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

SWITCH_ALL_APP_SERVERS - Character Field Length 1

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

NEW_HOST - New host name (only relevant for SAP app servers on z/OS)

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

WAIT_FOR_COMPLETION - Wait until all connections have switched

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

MAX_WAIT_TIME - Max. wait time for switch to complete in seconds

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

EXCEPTIONS details

ZOS_AS_SWITCH_TO_ANOTHER_LPAR -

Data type:
Optional: No
Call by Reference: Yes

COULD_NOT_DETERMINE_INSTANCES -

Data type:
Optional: No
Call by Reference: Yes

ERROR_DURING_SWITCH -

Data type:
Optional: No
Call by Reference: Yes

USER_NOT_AUTHORIZED -

Data type:
Optional: No
Call by Reference: Yes

NEW_DB_CON_UNKNOWN - DB connection unknown for all app servers to be switched

Data type:
Optional: No
Call by Reference: Yes

MAX_WAIT_TIME_EXCEEDED - Max wait time for switch completion exceeded

Data type:
Optional: No
Call by Reference: Yes

Copy and paste ABAP code example for STU3_ADMIN_SWITCH_DB_CON 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_new_db_con  TYPE DB2DEFCON-LOGNAME, "   
lv_zos_as_switch_to_another_lpar  TYPE DB2DEFCON, "   
lv_switch_all_app_servers  TYPE CHAR01, "   ' '
lv_could_not_determine_instances  TYPE CHAR01, "   
lv_new_host  TYPE DB2DEFCON-HOST, "   
lv_error_during_switch  TYPE DB2DEFCON, "   
lv_user_not_authorized  TYPE DB2DEFCON, "   
lv_wait_for_completion  TYPE CHAR01, "   ' '
lv_max_wait_time  TYPE CHAR10, "   
lv_new_db_con_unknown  TYPE CHAR10, "   
lv_max_wait_time_exceeded  TYPE CHAR10. "   

  CALL FUNCTION 'STU3_ADMIN_SWITCH_DB_CON'  "Switch DB connection to another DB2 member
    EXPORTING
         NEW_DB_CON = lv_new_db_con
         SWITCH_ALL_APP_SERVERS = lv_switch_all_app_servers
         NEW_HOST = lv_new_host
         WAIT_FOR_COMPLETION = lv_wait_for_completion
         MAX_WAIT_TIME = lv_max_wait_time
    EXCEPTIONS
        ZOS_AS_SWITCH_TO_ANOTHER_LPAR = 1
        COULD_NOT_DETERMINE_INSTANCES = 2
        ERROR_DURING_SWITCH = 3
        USER_NOT_AUTHORIZED = 4
        NEW_DB_CON_UNKNOWN = 5
        MAX_WAIT_TIME_EXCEEDED = 6
. " STU3_ADMIN_SWITCH_DB_CON




ABAP code using 7.40 inline data declarations to call FM STU3_ADMIN_SWITCH_DB_CON

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 LOGNAME FROM DB2DEFCON INTO @DATA(ld_new_db_con).
 
 
DATA(ld_switch_all_app_servers) = ' '.
 
 
"SELECT single HOST FROM DB2DEFCON INTO @DATA(ld_new_host).
 
 
 
DATA(ld_wait_for_completion) = ' '.
 
 
 
 


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!