SAP mm Module Inventory Balance report __sap

Source: Internet
Author: User
Tags field table
Inventory management is the focus of MM module application, SAP in the receiving, sales, inventory, allocation and other operations have a direct impact on the current inventory. SAP provides standard functionality MB52 for inventory counts, but MB52 queries and data presentation features are limited, and many companies develop additional inventory reports to achieve inventory inquiries.

Concept of commodity inventory report
Available inventory: Also known as unrestricted-use inventory, which indicates the quantity of goods that can be allocated in the current warehouse, excluding the stocks that are reserved for certain documents.
Current inventory: Also known as the actual inventory of carrying stock, refers to the inventory data in the SAP system, the carrying stock is theoretically in line with the actual stock, but there may be a discrepancy between the current inventory and the actual inventory data due to the fact that the invoice has been generated but has not been shipped or received but has not been posted.
In-Transit inventory: Also known as interim inventory, refers to the destination, is in transit or waiting for transport status and reserves in the transport of inventory. SAP generally refers to the number of items that have been generated for an issue order but have not received a receipt action.
Consignment Inventory: In many enterprises, especially some sales-oriented enterprises, in order to reduce the current inventory backlog, usually entrust a third party to custody and sale of products, the number of commissioned products into consignment inventory. Consignment inventory can also be goods that the supplier has shipped to the local warehouse, but has not yet been posted financially.
Opening inventory: The amount of inventory available for use or sale at the beginning of an inventory accounting period.
Closing stock: The carrying value of goods, materials, or raw material available for use or sale at the end of an inventory accounting period.
Reserve Inventory: The number of products that are estimated to be stored in warehouses during a certain period, such as the quantity of goods expected to be filled but not yet in actual storage.


Execution effect




Main program Data:begin of lt_out occurs 0, "Defines the internal table storage data
Matnr like Mara-matnr, "commodity
Werks like T001l-werks, "factory
NAME1 like T001w-name1, "factory name
Lgort like Mard-lgort, "inventory
Labst like Mard-labst, "inventory quantity
Labst_ky like Mard-labst, "available inventory
Maktx like MAKT-MAKTX, "Product description
UMLMC like MARC-UMLMC, "in transit, transit inventory
Trame like Marc-trame, "inventory in transit
End of Lt_out.
Data:lt_out2 like STANDARD TABLE of the lt_out with HEADER line.
Data:lt_out3 like STANDARD TABLE of the lt_out with HEADER line.



tables:marc,mard,t001l.
Select-options:s_werks for Marc-werks,
S_lgort for T001l-lgort,
S_matnr for Marc-matnr.

Selection-screen BEGIN with the block-with FRAME TITLE TEXT-001.
Query criteria Select check box *****************************
PARAMETERS:KC_DQ as CHECKBOX DEFAULT ' X ', "View current inventory
Kc_zt as CHECKBOX, "view inventory in transit
Kc_flag as CHECKBOX, "whether to include consignment inventory
Kc_ky as CHECKBOX. "Whether to view available inventory
Selection-screen end of Block 10.




Type-pools:slis. " Define a type pool/icons


Data:it_fieldcat TYPE Slis_t_fieldcat_alv,


Wa_fieldcat TYPE Slis_fieldcat_alv, "Define a field table but usually use a macro to do the appropriate function

* It_event type Slis_t_event,

It_layout TYPE Slis_layout_alv.

it_layout-colwidth_optimize = ' X '.

Start-of-selection.
IF kc_flag = ' X '. "Consignment, consignment inventory is no concept of location
SELECT Msku~matnr msku~werks Msku~kulab as Labst makt~maktx "define aliases; Msku User Special Inventory
into corresponding FIELDS of TABLE lt_out
From Msku INNER JOIN makt on msku~matnr = Makt~matnr and Makt~spras = Sy-langu
WHERE Msku~matnr in S_matnr
and Msku~werks in S_werks
and Msku~sobkz = ' W '. "W type represents consignment

IF SY-SUBRC = 0.
Lt_out-lgort = ' Customer consignment '.
MODIFY lt_out transporting lgort WHERE matnr NE '.
ENDIF.
ENDIF.

IF kc_zt = ' X '. "In-transit, in-transit inventory is not a concept of location
SELECT marc~matnr marc~werks MARC~UMLMC marc~trame makt~maktx
Appending corresponding FIELDS of TABLE Lt_out2
From MARC
INNER JOIN makt on marc~matnr = Makt~matnr and Makt~spras = Sy-langu
WHERE Marc~matnr in S_matnr
and Marc~werks in S_werks
and (marc~umlmc ne 0 OR marc~trame ne 0).
ENDIF.


IF not lt_out2[] is INITIAL. "In-Transit inventory for Msku-umlmc,msku-trame
LOOP at Lt_out2.
Lt_out2-lgort = ' in transit '.
Lt_out2-labst = LT_OUT2-UMLMC + lt_out2-trame.
Move-corresponding Lt_out2 to Lt_out.
APPEND Lt_out.
Endloop.
ENDIF.


IF kc_dq = ' X '. The current inventory
SELECT mard~matnr mard~werks mard~lgort mard~labst makt~maktx
Appending corresponding FIELDS of TABLE lt_out
From Mard
INNER JOIN makt on makt~matnr = Mard~matnr and Makt~spras = Sy-langu
WHERE Mard~matnr in S_matnr
and Mard~werks in S_werks
and Mard~lgort in S_lgort
and Mard~labst NE 0.
ENDIF.

* Delete Merchandise with zero inventory

DELETE lt_out WHERE labst = 0.

Field-symbols: <LT_OUT> like Lt_out. " Inner field definition

Data:wmdvsx like TABLE of Bapiwmdvs,
Wmdvex like TABLE of the bapiwmdve with HEADER line.


LOOP at Lt_out assigning <lt_out>.

IF kc_ky = ' X '.
Refresh:wmdvsx,wmdvex. "Query available inventory through BAPI

The call function ' bapi_material_availability ' function calls the parameter configuration

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.