SAP COS6_CHECK_MTSTAT_FOR_PURCH Function Module for NOTRANSL: Überprüfung des Materialstatutes für den Einkauf
COS6_CHECK_MTSTAT_FOR_PURCH is a standard cos6 check mtstat for purch SAP function module available within SAP R/3 or S/4 Hana systems, depending on your version and release level. It is used for NOTRANSL: Überprüfung des Materialstatutes für den Einkauf 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 cos6 check mtstat for purch FM, simply by entering the name COS6_CHECK_MTSTAT_FOR_PURCH into the relevant SAP transaction such as SE37 or SE38.
Function Group: COS6
Program Name: SAPLCOS6
Main Program: SAPLCOS6
Appliation area:
Release date: N/A
Mode(Normal, Remote etc): Normal Function Module
Update:

Function COS6_CHECK_MTSTAT_FOR_PURCH 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 'COS6_CHECK_MTSTAT_FOR_PURCH'"NOTRANSL: Überprüfung des Materialstatutes für den Einkauf.
EXPORTING
I_MATNR = "Material Number
I_WERKS = "Plant
I_MMSTA = "Plant-Specific Material Status
I_MMSTD = "Date from which the plant-specific material status is valid
I_MSTAE = "Cross-Plant Material Status
I_FLG_NO_DIALOG = "Selection Indicator
IMPORTING
E_SUBRC = "Return Value, Return Value after ABAP Statements
EXCEPTIONS
MMSTA_NOT_FOUND = 1 MSTAE_NOT_FOUND = 2
Customer Function user exits
Below is a list of CUSTOMER FUNCTION exit user exits that are available within this program and maybe relevant for this FM.EXIT_SAPLCOS6_001 DE-EN-LANG-SWITCH-NO-TRANSLATION
EXIT_SAPLCOS6_002 Check a Newly Assigned Component
IMPORTING Parameters details for COS6_CHECK_MTSTAT_FOR_PURCH
I_MATNR - Material Number
Data type: MTCOM-MATNROptional: No
Call by Reference: Yes
I_WERKS - Plant
Data type: MTCOM-WERKSOptional: No
Call by Reference: Yes
I_MMSTA - Plant-Specific Material Status
Data type: MSFCV-MMSTAOptional: No
Call by Reference: Yes
I_MMSTD - Date from which the plant-specific material status is valid
Data type: MSFCV-MMSTDOptional: No
Call by Reference: Yes
I_MSTAE - Cross-Plant Material Status
Data type: MSFCV-MSTAEOptional: No
Call by Reference: Yes
I_FLG_NO_DIALOG - Selection Indicator
Data type: RC27X-FLG_SELOptional: No
Call by Reference: Yes
EXPORTING Parameters details for COS6_CHECK_MTSTAT_FOR_PURCH
E_SUBRC - Return Value, Return Value after ABAP Statements
Data type: SY-SUBRCOptional: No
Call by Reference: Yes
EXCEPTIONS details
MMSTA_NOT_FOUND -
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
MSTAE_NOT_FOUND -
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
Copy and paste ABAP code example for COS6_CHECK_MTSTAT_FOR_PURCH 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_e_subrc | TYPE SY-SUBRC, " | |||
| lv_i_matnr | TYPE MTCOM-MATNR, " | |||
| lv_mmsta_not_found | TYPE MTCOM, " | |||
| lv_i_werks | TYPE MTCOM-WERKS, " | |||
| lv_mstae_not_found | TYPE MTCOM, " | |||
| lv_i_mmsta | TYPE MSFCV-MMSTA, " | |||
| lv_i_mmstd | TYPE MSFCV-MMSTD, " | |||
| lv_i_mstae | TYPE MSFCV-MSTAE, " | |||
| lv_i_flg_no_dialog | TYPE RC27X-FLG_SEL. " |
|   CALL FUNCTION 'COS6_CHECK_MTSTAT_FOR_PURCH' "NOTRANSL: Überprüfung des Materialstatutes für den Einkauf |
| EXPORTING | ||
| I_MATNR | = lv_i_matnr | |
| I_WERKS | = lv_i_werks | |
| I_MMSTA | = lv_i_mmsta | |
| I_MMSTD | = lv_i_mmstd | |
| I_MSTAE | = lv_i_mstae | |
| I_FLG_NO_DIALOG | = lv_i_flg_no_dialog | |
| IMPORTING | ||
| E_SUBRC | = lv_e_subrc | |
| EXCEPTIONS | ||
| MMSTA_NOT_FOUND = 1 | ||
| MSTAE_NOT_FOUND = 2 | ||
| . " COS6_CHECK_MTSTAT_FOR_PURCH | ||
ABAP code using 7.40 inline data declarations to call FM COS6_CHECK_MTSTAT_FOR_PURCH
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 SUBRC FROM SY INTO @DATA(ld_e_subrc). | ||||
| "SELECT single MATNR FROM MTCOM INTO @DATA(ld_i_matnr). | ||||
| "SELECT single WERKS FROM MTCOM INTO @DATA(ld_i_werks). | ||||
| "SELECT single MMSTA FROM MSFCV INTO @DATA(ld_i_mmsta). | ||||
| "SELECT single MMSTD FROM MSFCV INTO @DATA(ld_i_mmstd). | ||||
| "SELECT single MSTAE FROM MSFCV INTO @DATA(ld_i_mstae). | ||||
| "SELECT single FLG_SEL FROM RC27X INTO @DATA(ld_i_flg_no_dialog). | ||||
Search for further information about these or an SAP related objects