SAP MSS_XML_PLAN Function Module for MS SQL server function to get statistics, showplan for SQL stmt execution.
MSS_XML_PLAN is a standard mss xml plan SAP function module available within SAP R/3 or S/4 Hana systems, depending on your version and release level. It is used for MS SQL server function to get statistics, showplan for SQL stmt execution. 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 mss xml plan FM, simply by entering the name MSS_XML_PLAN into the relevant SAP transaction such as SE37 or SE38.
Function Group: SMSSDATA
Program Name: SAPLSMSSDATA
Main Program: SAPLSMSSDATA
Appliation area: S
Release date: N/A
Mode(Normal, Remote etc): Remote-Enabled
Update:

Function MSS_XML_PLAN 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 'MSS_XML_PLAN'"MS SQL server function to get statistics, showplan for SQL stmt execution..
EXPORTING
* CON_NAME = 'DEFAULT' "Logical name of a Database Connection
* SCHEMA = ' ' "Schema name
* PLAN_HANDLE = "handle pointing to plan used in execution of sql stmt/proc
* HISTORY_ID = 0 "The historical plan ID
IMPORTING
XML_SHOWPLAN = "Output of set showplan_xml on
TABLES
* OBJ_REFS = "Object references in an XML showplan
* PAR_VALUES = "Values extracted from XML plan
EXCEPTIONS
DB_ERROR = 1 INTERNAL_ERROR = 2 NOT_RUNNING_ON_MSSQL = 3 CONNECT_ERROR = 4
IMPORTING Parameters details for MSS_XML_PLAN
CON_NAME - Logical name of a Database Connection
Data type: DBCON-CON_NAMEDefault: 'DEFAULT'
Optional: Yes
Call by Reference: No ( called with pass by value option)
SCHEMA - Schema name
Data type: MSSSCHEMADefault: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)
PLAN_HANDLE - handle pointing to plan used in execution of sql stmt/proc
Data type: MSSPLANHANDLEOptional: Yes
Call by Reference: No ( called with pass by value option)
HISTORY_ID - The historical plan ID
Data type: MSSSTMTHCOLLIDOptional: Yes
Call by Reference: No ( called with pass by value option)
EXPORTING Parameters details for MSS_XML_PLAN
XML_SHOWPLAN - Output of set showplan_xml on
Data type: STRINGOptional: No
Call by Reference: No ( called with pass by value option)
TABLES Parameters details for MSS_XML_PLAN
OBJ_REFS - Object references in an XML showplan
Data type: MSSXMLOBJREFSOptional: Yes
Call by Reference: Yes
PAR_VALUES - Values extracted from XML plan
Data type: MSQSPPARAMOptional: Yes
Call by Reference: Yes
EXCEPTIONS details
DB_ERROR - Some database error occurred.
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
INTERNAL_ERROR - Internal ADBC error.
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
NOT_RUNNING_ON_MSSQL - Not MSSQL
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
CONNECT_ERROR - Can't connect
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
Copy and paste ABAP code example for MSS_XML_PLAN 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_con_name | TYPE DBCON-CON_NAME, " 'DEFAULT' | |||
| lv_db_error | TYPE DBCON, " | |||
| lt_obj_refs | TYPE STANDARD TABLE OF MSSXMLOBJREFS, " | |||
| lv_xml_showplan | TYPE STRING, " | |||
| lv_schema | TYPE MSSSCHEMA, " SPACE | |||
| lt_par_values | TYPE STANDARD TABLE OF MSQSPPARAM, " | |||
| lv_internal_error | TYPE MSQSPPARAM, " | |||
| lv_plan_handle | TYPE MSSPLANHANDLE, " | |||
| lv_not_running_on_mssql | TYPE MSSPLANHANDLE, " | |||
| lv_history_id | TYPE MSSSTMTHCOLLID, " 0 | |||
| lv_connect_error | TYPE MSSSTMTHCOLLID. " |
|   CALL FUNCTION 'MSS_XML_PLAN' "MS SQL server function to get statistics, showplan for SQL stmt execution. |
| EXPORTING | ||
| CON_NAME | = lv_con_name | |
| SCHEMA | = lv_schema | |
| PLAN_HANDLE | = lv_plan_handle | |
| HISTORY_ID | = lv_history_id | |
| IMPORTING | ||
| XML_SHOWPLAN | = lv_xml_showplan | |
| TABLES | ||
| OBJ_REFS | = lt_obj_refs | |
| PAR_VALUES | = lt_par_values | |
| EXCEPTIONS | ||
| DB_ERROR = 1 | ||
| INTERNAL_ERROR = 2 | ||
| NOT_RUNNING_ON_MSSQL = 3 | ||
| CONNECT_ERROR = 4 | ||
| . " MSS_XML_PLAN | ||
ABAP code using 7.40 inline data declarations to call FM MSS_XML_PLAN
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 CON_NAME FROM DBCON INTO @DATA(ld_con_name). | ||||
| DATA(ld_con_name) | = 'DEFAULT'. | |||
| DATA(ld_schema) | = ' '. | |||
Search for further information about these or an SAP related objects