SAP MC_PREPARE_MCID Function Module for Read a matchcode ID about the data interface
MC_PREPARE_MCID is a standard mc prepare mcid SAP function module available within SAP R/3 or S/4 Hana systems, depending on your version and release level. It is used for Read a matchcode ID about the data interface 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 mc prepare mcid FM, simply by entering the name MC_PREPARE_MCID into the relevant SAP transaction such as SE37 or SE38.
Function Group: SMC1
Program Name: SAPLSMC1
Main Program: SAPLSMC1
Appliation area: S
Release date: N/A
Mode(Normal, Remote etc): Normal Function Module
Update:

Function MC_PREPARE_MCID 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 'MC_PREPARE_MCID'"Read a matchcode ID about the data interface.
EXPORTING
* LANGUAGE = SY-LANGU "Language
MCID = "Matchcode ID
MCONAME = "Name of the matchcode object
* STATUS = 'A' "Status in which the matchcode object can be read
* PRID = 0 "Log ID
IMPORTING
DD23V_EXP = "Header of the matchcode object
RC = "Output of error structure (severity, number)
TABLES
DD21V_TAB = "Structure of the matchcode object
DD24V_TAB = "Fields of the matchcode object with data types
DD28V_TAB = "
EXCEPTIONS
ID_NOT_EXISTS = 1 ILLEGAL_STATE = 2
IMPORTING Parameters details for MC_PREPARE_MCID
LANGUAGE - Language
Data type: SY-LANGUDefault: SY-LANGU
Optional: Yes
Call by Reference: No ( called with pass by value option)
MCID - Matchcode ID
Data type: DD23L-MCIDOptional: No
Call by Reference: No ( called with pass by value option)
MCONAME - Name of the matchcode object
Data type: DD20L-MCONAMEOptional: No
Call by Reference: No ( called with pass by value option)
STATUS - Status in which the matchcode object can be read
Data type: MCMACO-STATUSDefault: 'A'
Optional: Yes
Call by Reference: No ( called with pass by value option)
PRID - Log ID
Data type: SY-TABIXOptional: Yes
Call by Reference: No ( called with pass by value option)
EXPORTING Parameters details for MC_PREPARE_MCID
DD23V_EXP - Header of the matchcode object
Data type: DD23VOptional: No
Call by Reference: No ( called with pass by value option)
RC - Output of error structure (severity, number)
Data type: SY-SUBRCOptional: No
Call by Reference: No ( called with pass by value option)
TABLES Parameters details for MC_PREPARE_MCID
DD21V_TAB - Structure of the matchcode object
Data type: DD21VOptional: No
Call by Reference: No ( called with pass by value option)
DD24V_TAB - Fields of the matchcode object with data types
Data type: DD24VOptional: No
Call by Reference: No ( called with pass by value option)
DD28V_TAB -
Data type: DD28VOptional: No
Call by Reference: No ( called with pass by value option)
EXCEPTIONS details
ID_NOT_EXISTS - Matchcode ID does not exist
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
ILLEGAL_STATE - Incorrect status
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
Copy and paste ABAP code example for MC_PREPARE_MCID 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_language | TYPE SY-LANGU, " SY-LANGU | |||
| lt_dd21v_tab | TYPE STANDARD TABLE OF DD21V, " | |||
| lv_dd23v_exp | TYPE DD23V, " | |||
| lv_id_not_exists | TYPE DD23V, " | |||
| lv_rc | TYPE SY-SUBRC, " | |||
| lv_mcid | TYPE DD23L-MCID, " | |||
| lt_dd24v_tab | TYPE STANDARD TABLE OF DD24V, " | |||
| lv_illegal_state | TYPE DD24V, " | |||
| lv_mconame | TYPE DD20L-MCONAME, " | |||
| lt_dd28v_tab | TYPE STANDARD TABLE OF DD28V, " | |||
| lv_status | TYPE MCMACO-STATUS, " 'A' | |||
| lv_prid | TYPE SY-TABIX. " 0 |
|   CALL FUNCTION 'MC_PREPARE_MCID' "Read a matchcode ID about the data interface |
| EXPORTING | ||
| LANGUAGE | = lv_language | |
| MCID | = lv_mcid | |
| MCONAME | = lv_mconame | |
| STATUS | = lv_status | |
| PRID | = lv_prid | |
| IMPORTING | ||
| DD23V_EXP | = lv_dd23v_exp | |
| RC | = lv_rc | |
| TABLES | ||
| DD21V_TAB | = lt_dd21v_tab | |
| DD24V_TAB | = lt_dd24v_tab | |
| DD28V_TAB | = lt_dd28v_tab | |
| EXCEPTIONS | ||
| ID_NOT_EXISTS = 1 | ||
| ILLEGAL_STATE = 2 | ||
| . " MC_PREPARE_MCID | ||
ABAP code using 7.40 inline data declarations to call FM MC_PREPARE_MCID
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 LANGU FROM SY INTO @DATA(ld_language). | ||||
| DATA(ld_language) | = SY-LANGU. | |||
| "SELECT single SUBRC FROM SY INTO @DATA(ld_rc). | ||||
| "SELECT single MCID FROM DD23L INTO @DATA(ld_mcid). | ||||
| "SELECT single MCONAME FROM DD20L INTO @DATA(ld_mconame). | ||||
| "SELECT single STATUS FROM MCMACO INTO @DATA(ld_status). | ||||
| DATA(ld_status) | = 'A'. | |||
| "SELECT single TABIX FROM SY INTO @DATA(ld_prid). | ||||
Search for further information about these or an SAP related objects