SAP BAPI_SERVICE_CHANGE Function Module for BAPI to Change a Service Master Record
BAPI_SERVICE_CHANGE is a standard bapi service change SAP function module available within SAP R/3 or S/4 Hana systems, depending on your version and release level. It is used for BAPI to Change a Service Master Record 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 bapi service change FM, simply by entering the name BAPI_SERVICE_CHANGE into the relevant SAP transaction such as SE37 or SE38.
Function Group: BASB
Program Name: SAPLBASB
Main Program: SAPLBASB
Appliation area:
Release date: 31-Jan-2005
Mode(Normal, Remote etc): Remote-Enabled
Update:

Function BAPI_SERVICE_CHANGE 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 'BAPI_SERVICE_CHANGE'"BAPI to Change a Service Master Record.
EXPORTING
SERVICENUMBER = "Service Number
* IM_SERVICE_DATA = "General Data for Service, Import
* IM_SERVICE_DATAX = "Change Parameter for Service Data, Import
* TESTRUN = "Test Indicator
IMPORTING
EX_SERVICE_DATA = "General Data for Service, Export
EX_SERVICE_DATAX = "Change Parameter for Service Data, Export
TABLES
RETURN = "Return Parameter(s)
SERVICE_DESCRIPTION = "Short Texts for Service
* SERVICE_LONG_TEXTS = "Long Texts for Service
* EXTENSION_IN = "Customer's Own Fields (Import Parameters)
* EXTENSION_OUT = "Customer's Own Fields (Export Parameters)
IMPORTING Parameters details for BAPI_SERVICE_CHANGE
SERVICENUMBER - Service Number
Data type: BAPISRV_ASMD-SERVICEOptional: No
Call by Reference: No ( called with pass by value option)
IM_SERVICE_DATA - General Data for Service, Import
Data type: BAPISRV_ASMDOptional: Yes
Call by Reference: No ( called with pass by value option)
IM_SERVICE_DATAX - Change Parameter for Service Data, Import
Data type: BAPISRV_ASMDXOptional: Yes
Call by Reference: No ( called with pass by value option)
TESTRUN - Test Indicator
Data type: BAPIFLAG-BAPIFLAGOptional: Yes
Call by Reference: No ( called with pass by value option)
EXPORTING Parameters details for BAPI_SERVICE_CHANGE
EX_SERVICE_DATA - General Data for Service, Export
Data type: BAPISRV_ASMDOptional: No
Call by Reference: No ( called with pass by value option)
EX_SERVICE_DATAX - Change Parameter for Service Data, Export
Data type: BAPISRV_ASMDXOptional: No
Call by Reference: No ( called with pass by value option)
TABLES Parameters details for BAPI_SERVICE_CHANGE
RETURN - Return Parameter(s)
Data type: BAPIRET2Optional: No
Call by Reference: Yes
SERVICE_DESCRIPTION - Short Texts for Service
Data type: BAPISRV_ASMDTOptional: No
Call by Reference: Yes
SERVICE_LONG_TEXTS - Long Texts for Service
Data type: BAPISRV_TEXTOptional: Yes
Call by Reference: Yes
EXTENSION_IN - Customer's Own Fields (Import Parameters)
Data type: BAPIPAREXOptional: Yes
Call by Reference: Yes
EXTENSION_OUT - Customer's Own Fields (Export Parameters)
Data type: BAPIPAREXOptional: Yes
Call by Reference: Yes
Copy and paste ABAP code example for BAPI_SERVICE_CHANGE 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: | ||||
| lt_return | TYPE STANDARD TABLE OF BAPIRET2, " | |||
| lv_servicenumber | TYPE BAPISRV_ASMD-SERVICE, " | |||
| lv_ex_service_data | TYPE BAPISRV_ASMD, " | |||
| lv_im_service_data | TYPE BAPISRV_ASMD, " | |||
| lv_ex_service_datax | TYPE BAPISRV_ASMDX, " | |||
| lt_service_description | TYPE STANDARD TABLE OF BAPISRV_ASMDT, " | |||
| lv_im_service_datax | TYPE BAPISRV_ASMDX, " | |||
| lt_service_long_texts | TYPE STANDARD TABLE OF BAPISRV_TEXT, " | |||
| lv_testrun | TYPE BAPIFLAG-BAPIFLAG, " | |||
| lt_extension_in | TYPE STANDARD TABLE OF BAPIPAREX, " | |||
| lt_extension_out | TYPE STANDARD TABLE OF BAPIPAREX. " |
|   CALL FUNCTION 'BAPI_SERVICE_CHANGE' "BAPI to Change a Service Master Record |
| EXPORTING | ||
| SERVICENUMBER | = lv_servicenumber | |
| IM_SERVICE_DATA | = lv_im_service_data | |
| IM_SERVICE_DATAX | = lv_im_service_datax | |
| TESTRUN | = lv_testrun | |
| IMPORTING | ||
| EX_SERVICE_DATA | = lv_ex_service_data | |
| EX_SERVICE_DATAX | = lv_ex_service_datax | |
| TABLES | ||
| RETURN | = lt_return | |
| SERVICE_DESCRIPTION | = lt_service_description | |
| SERVICE_LONG_TEXTS | = lt_service_long_texts | |
| EXTENSION_IN | = lt_extension_in | |
| EXTENSION_OUT | = lt_extension_out | |
| . " BAPI_SERVICE_CHANGE | ||
ABAP code using 7.40 inline data declarations to call FM BAPI_SERVICE_CHANGE
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 SERVICE FROM BAPISRV_ASMD INTO @DATA(ld_servicenumber). | ||||
| "SELECT single BAPIFLAG FROM BAPIFLAG INTO @DATA(ld_testrun). | ||||
Search for further information about these or an SAP related objects