SAP MB_READ_MATERIAL_STOCKS Function Module for MB_READ_MATERIAL_STOCKS
MB_READ_MATERIAL_STOCKS is a standard mb read material stocks SAP function module available within SAP R/3 or S/4 Hana systems, depending on your version and release level. It is used for MB_READ_MATERIAL_STOCKS 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 mb read material stocks FM, simply by entering the name MB_READ_MATERIAL_STOCKS into the relevant SAP transaction such as SE37 or SE38.
Function Group: MBMV
Program Name: SAPLMBMV
Main Program: SAPLMBMV
Appliation area:
Release date: N/A
Mode(Normal, Remote etc): Normal Function Module
Update:

Function MB_READ_MATERIAL_STOCKS 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 'MB_READ_MATERIAL_STOCKS'"MB_READ_MATERIAL_STOCKS.
EXPORTING
MTCOM = "
XMBWL = "
* MBVAL = "
* XWERT = "
* INVENTUR = "
* REFRESH = ' ' "
* I_XMIGO = ' ' "
TRTYP = "
XNEUP = "
XAENP = "
MBEQU = "
SHKZG = "
XENQU = "
KZDZV = "
MKPF = "
IMPORTING
MBEFU = "
MTCOR = "
MTPER = "
CHANGING
DM07M = "
VM07M = "
MSEG = "
TABLES
X156M = "
* XMSKA = "
* XMSPR = "
* XMSTB = "
* XMSTE = "
* XMSTQ = "
X156W = "
XSTRU = "
XMCHB = "
* XMARD = "
* XMARC = "
* XMKOL = "
* XMSKU = "
* XMSLB = "
EXCEPTIONS
LOCK_ON_BATCH = 1
IMPORTING Parameters details for MB_READ_MATERIAL_STOCKS
MTCOM -
Data type: MTCOMOptional: No
Call by Reference: No ( called with pass by value option)
XMBWL -
Data type: COptional: No
Call by Reference: No ( called with pass by value option)
MBVAL -
Data type: TCURM-MBVALOptional: Yes
Call by Reference: No ( called with pass by value option)
XWERT -
Data type: COptional: Yes
Call by Reference: No ( called with pass by value option)
INVENTUR -
Data type: COptional: Yes
Call by Reference: No ( called with pass by value option)
REFRESH -
Data type: CDefault: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)
I_XMIGO -
Data type: CDefault: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)
TRTYP -
Data type: T158-TRTYPOptional: No
Call by Reference: No ( called with pass by value option)
XNEUP -
Data type: T063F-XNEUPOptional: No
Call by Reference: No ( called with pass by value option)
XAENP -
Data type: T063F-XAENPOptional: No
Call by Reference: No ( called with pass by value option)
MBEQU -
Data type: TCURM-MBEQUOptional: No
Call by Reference: No ( called with pass by value option)
SHKZG -
Data type: MSEG-SHKZGOptional: No
Call by Reference: No ( called with pass by value option)
XENQU -
Data type: COptional: No
Call by Reference: No ( called with pass by value option)
KZDZV -
Data type: TCUCH-KZDZVOptional: No
Call by Reference: No ( called with pass by value option)
MKPF -
Data type: MKPFOptional: No
Call by Reference: No ( called with pass by value option)
EXPORTING Parameters details for MB_READ_MATERIAL_STOCKS
MBEFU -
Data type: MBEFUOptional: No
Call by Reference: No ( called with pass by value option)
MTCOR -
Data type: MTCOROptional: No
Call by Reference: No ( called with pass by value option)
MTPER -
Data type: MTPEROptional: No
Call by Reference: No ( called with pass by value option)
CHANGING Parameters details for MB_READ_MATERIAL_STOCKS
DM07M -
Data type: DM07MOptional: No
Call by Reference: No ( called with pass by value option)
VM07M -
Data type: VM07MOptional: No
Call by Reference: No ( called with pass by value option)
MSEG -
Data type: MSEGOptional: No
Call by Reference: No ( called with pass by value option)
TABLES Parameters details for MB_READ_MATERIAL_STOCKS
X156M -
Data type: T156MOptional: No
Call by Reference: No ( called with pass by value option)
XMSKA -
Data type: SMSKAOptional: Yes
Call by Reference: No ( called with pass by value option)
XMSPR -
Data type: SMSPROptional: Yes
Call by Reference: No ( called with pass by value option)
XMSTB -
Data type: SMSTBOptional: Yes
Call by Reference: Yes
XMSTE -
Data type: SMSTEOptional: Yes
Call by Reference: Yes
XMSTQ -
Data type: SMSTQOptional: Yes
Call by Reference: Yes
X156W -
Data type: T156WOptional: No
Call by Reference: No ( called with pass by value option)
XSTRU -
Data type: WSOS_STULIOptional: No
Call by Reference: No ( called with pass by value option)
XMCHB -
Data type: SMCHBOptional: No
Call by Reference: No ( called with pass by value option)
XMARD -
Data type: SMARDOptional: Yes
Call by Reference: No ( called with pass by value option)
XMARC -
Data type: SMARCOptional: Yes
Call by Reference: No ( called with pass by value option)
XMKOL -
Data type: SMKOLOptional: Yes
Call by Reference: No ( called with pass by value option)
XMSKU -
Data type: SMSKUOptional: Yes
Call by Reference: No ( called with pass by value option)
XMSLB -
Data type: SMSLBOptional: Yes
Call by Reference: No ( called with pass by value option)
EXCEPTIONS details
LOCK_ON_BATCH - Lock of batch, note 613242
Data type:Optional: No
Call by Reference: Yes
Copy and paste ABAP code example for MB_READ_MATERIAL_STOCKS 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_dm07m | TYPE DM07M, " | |||
| lv_mbefu | TYPE MBEFU, " | |||
| lv_mtcom | TYPE MTCOM, " | |||
| lt_x156m | TYPE STANDARD TABLE OF T156M, " | |||
| lv_lock_on_batch | TYPE T156M, " | |||
| lv_xmbwl | TYPE C, " | |||
| lt_xmska | TYPE STANDARD TABLE OF SMSKA, " | |||
| lv_mbval | TYPE TCURM-MBVAL, " | |||
| lt_xmspr | TYPE STANDARD TABLE OF SMSPR, " | |||
| lt_xmstb | TYPE STANDARD TABLE OF SMSTB, " | |||
| lv_xwert | TYPE C, " | |||
| lt_xmste | TYPE STANDARD TABLE OF SMSTE, " | |||
| lv_inventur | TYPE C, " | |||
| lt_xmstq | TYPE STANDARD TABLE OF SMSTQ, " | |||
| lv_refresh | TYPE C, " SPACE | |||
| lv_i_xmigo | TYPE C, " SPACE | |||
| lv_mtcor | TYPE MTCOR, " | |||
| lv_trtyp | TYPE T158-TRTYP, " | |||
| lv_vm07m | TYPE VM07M, " | |||
| lt_x156w | TYPE STANDARD TABLE OF T156W, " | |||
| lv_mseg | TYPE MSEG, " | |||
| lv_mtper | TYPE MTPER, " | |||
| lv_xneup | TYPE T063F-XNEUP, " | |||
| lt_xstru | TYPE STANDARD TABLE OF WSOS_STULI, " | |||
| lv_xaenp | TYPE T063F-XAENP, " | |||
| lt_xmchb | TYPE STANDARD TABLE OF SMCHB, " | |||
| lv_mbequ | TYPE TCURM-MBEQU, " | |||
| lt_xmard | TYPE STANDARD TABLE OF SMARD, " | |||
| lv_shkzg | TYPE MSEG-SHKZG, " | |||
| lt_xmarc | TYPE STANDARD TABLE OF SMARC, " | |||
| lv_xenqu | TYPE C, " | |||
| lt_xmkol | TYPE STANDARD TABLE OF SMKOL, " | |||
| lv_kzdzv | TYPE TCUCH-KZDZV, " | |||
| lt_xmsku | TYPE STANDARD TABLE OF SMSKU, " | |||
| lv_mkpf | TYPE MKPF, " | |||
| lt_xmslb | TYPE STANDARD TABLE OF SMSLB. " |
|   CALL FUNCTION 'MB_READ_MATERIAL_STOCKS' "MB_READ_MATERIAL_STOCKS |
| EXPORTING | ||
| MTCOM | = lv_mtcom | |
| XMBWL | = lv_xmbwl | |
| MBVAL | = lv_mbval | |
| XWERT | = lv_xwert | |
| INVENTUR | = lv_inventur | |
| REFRESH | = lv_refresh | |
| I_XMIGO | = lv_i_xmigo | |
| TRTYP | = lv_trtyp | |
| XNEUP | = lv_xneup | |
| XAENP | = lv_xaenp | |
| MBEQU | = lv_mbequ | |
| SHKZG | = lv_shkzg | |
| XENQU | = lv_xenqu | |
| KZDZV | = lv_kzdzv | |
| MKPF | = lv_mkpf | |
| IMPORTING | ||
| MBEFU | = lv_mbefu | |
| MTCOR | = lv_mtcor | |
| MTPER | = lv_mtper | |
| CHANGING | ||
| DM07M | = lv_dm07m | |
| VM07M | = lv_vm07m | |
| MSEG | = lv_mseg | |
| TABLES | ||
| X156M | = lt_x156m | |
| XMSKA | = lt_xmska | |
| XMSPR | = lt_xmspr | |
| XMSTB | = lt_xmstb | |
| XMSTE | = lt_xmste | |
| XMSTQ | = lt_xmstq | |
| X156W | = lt_x156w | |
| XSTRU | = lt_xstru | |
| XMCHB | = lt_xmchb | |
| XMARD | = lt_xmard | |
| XMARC | = lt_xmarc | |
| XMKOL | = lt_xmkol | |
| XMSKU | = lt_xmsku | |
| XMSLB | = lt_xmslb | |
| EXCEPTIONS | ||
| LOCK_ON_BATCH = 1 | ||
| . " MB_READ_MATERIAL_STOCKS | ||
ABAP code using 7.40 inline data declarations to call FM MB_READ_MATERIAL_STOCKS
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 MBVAL FROM TCURM INTO @DATA(ld_mbval). | ||||
| DATA(ld_refresh) | = ' '. | |||
| DATA(ld_i_xmigo) | = ' '. | |||
| "SELECT single TRTYP FROM T158 INTO @DATA(ld_trtyp). | ||||
| "SELECT single XNEUP FROM T063F INTO @DATA(ld_xneup). | ||||
| "SELECT single XAENP FROM T063F INTO @DATA(ld_xaenp). | ||||
| "SELECT single MBEQU FROM TCURM INTO @DATA(ld_mbequ). | ||||
| "SELECT single SHKZG FROM MSEG INTO @DATA(ld_shkzg). | ||||
| "SELECT single KZDZV FROM TCUCH INTO @DATA(ld_kzdzv). | ||||
Search for further information about these or an SAP related objects