Stock of a material as on given date
Hi all,
Is there any function module or any BAPI to calculate the opening and closing stock of a material as on the given date, based on which a customizing report is to be developed.. There was a Transaction MB5B to know the as on date stock, but it's taking longer time to use it in customizing report.Please let me know if any BAPI or any F.module is there to find the stock of a material as on given date.
Thanks in advance.
Edited by: Jaya on Apr 23, 2009 9:15 AM
Hi,
Try to develop a report using the logic of MB5B report and minimize the selection criteria
Regards,
Vikas
Similar Messages
-
Any function module to get Stock and value of material on a given date?
Hi Friends
Is there any function module available to get Stock/and value of material on a given date?
Thanks
HarishSorry I didn't elaborate the requirement.
I am asked to develop a custom report for inventory management. For range of materials it is required to display stock and value on particular date and GRs GIs for the range.
I need function module to use in Zreport.
Thanks
Harish -
How to get a opening stock of a material on a particular date
Hi,
Could you pls provide me the logic of how to get the opening stock of the material on a particular date. I searched the forum and found the logic to fetch the closing stock at a given period but not for a date.
An immediate response would be really appreciated.
Thanks
HarrisDear,
Please read following part of my code
FORM GET_OPENING .
IF IT_FINAL[] IS NOT INITIAL.
SELECT * FROM MARD
INTO CORRESPONDING FIELDS OF TABLE IT_MARD
FOR ALL ENTRIES IN IT_FINAL
WHERE MATNR = IT_FINAL-MATNR
AND WERKS = '1000'.
SELECT A~MBLNR A~MJAHR A~BUDAT B~WAERS B~ZEILE B~BWART B~MATNR B~WERKS B~LGORT B~CHARG B~SHKZG B~MENGE B~MEINS B~BUSTM B~XAUTO
INTO CORRESPONDING FIELDS OF TABLE IT_MKPF
FROM MKPF AS A JOIN MSEG AS B
ON A~MANDT = B~MANDT
AND A~MBLNR = B~MBLNR
AND A~MJAHR = B~MJAHR
FOR ALL ENTRIES IN IT_FINAL
WHERE B~MATNR = IT_FINAL-MATNR
AND A~BUDAT GE P_BUDAT-LOW
AND B~WERKS = '1000'.
ENDIF.
AKTDAT = SY-DATLO + 30.
IF NOT ( P_BUDAT-HIGH IS INITIAL OR P_BUDAT-HIGH > AKTDAT ).
LOOP AT IT_MKPF INTO WA_MKPF WHERE BUDAT > P_BUDAT-HIGH.
MOVE-CORRESPONDING WA_MKPF TO IT_MKPF1.
APPEND IT_MKPF1.
DELETE IT_MKPF.
ENDLOOP.
ENDIF.
SORT IT_MKPF1 BY WERKS MATNR SHKZG.
LOOP AT IT_MKPF1.
IF ( IT_MKPF1-XAUTO IS INITIAL ) OR
( IT_MKPF1-BUSTM <> 'MA02' AND IT_MKPF1-BUSTM <> 'MA05' ) .
MOVE-CORRESPONDING IT_MKPF1 TO IT_MAT.
COLLECT IT_MAT.
ELSE.
DELETE IT_MKPF1.
ENDIF.
ENDLOOP.
SORT IT_MKPF BY WERKS MATNR SHKZG DESCENDING.
LOOP AT IT_MKPF INTO WA_MKPF.
IF ( WA_MKPF-XAUTO IS INITIAL ) OR
( WA_MKPF-BUSTM <> 'MA02' AND
WA_MKPF-BUSTM <> 'MA05' ).
MOVE-CORRESPONDING WA_MKPF TO T_MAT.
COLLECT T_MAT.
ELSE.
DELETE IT_MKPF.
ENDIF.
ENDLOOP.
LOOP AT IT_MARD.
CLEAR IT_MAT-MENGE.
MOVE-CORRESPONDING IT_MARD TO FINAL.
READ TABLE IT_MAT WITH KEY WERKS = IT_MARD-WERKS
LGORT = IT_MARD-LGORT
MATNR = IT_MARD-MATNR
SHKZG = 'S'.
FINAL-ENDMENGE = IT_MARD-LABST + IT_MARD-INSME + IT_MARD-SPEME + IT_MARD-EINME + IT_MARD-RETME - IT_MAT-MENGE.
CLEAR IT_MAT-MENGE.
READ TABLE IT_MAT WITH KEY WERKS = IT_MARD-WERKS
LGORT = IT_MARD-LGORT
MATNR = IT_MARD-MATNR
SHKZG = 'H'.
FINAL-ENDMENGE = FINAL-ENDMENGE + IT_MAT-MENGE.
COLLECT FINAL.
ENDLOOP.
LOOP AT FINAL.
CLEAR T_MAT-MENGE.
READ TABLE T_MAT WITH KEY WERKS = FINAL-WERKS
MATNR = FINAL-MATNR
SHKZG = 'S'.
MOVE T_MAT-MENGE TO FINAL-SOLL.
CLEAR T_MAT-MENGE.
READ TABLE T_MAT WITH KEY WERKS = FINAL-WERKS
MATNR = FINAL-MATNR
SHKZG = 'H'.
MOVE T_MAT-MENGE TO FINAL-HABEN.
FINAL-ANFMENGE = FINAL-ENDMENGE - FINAL-SOLL + FINAL-HABEN.
MODIFY FINAL.
ENDLOOP.
LOOP AT FINAL.
WA_FINAL1-MATNR = FINAL-MATNR.
WA_FINAL1-MEINS = FINAL-MEINS.
WA_FINAL1-OP_MENGE = FINAL-ANFMENGE.
WA_FINAL1-RE_MENGE = FINAL-SOLL.
WA_FINAL1-IS_MENGE = FINAL-HABEN.
WA_FINAL1-CL_MENGE = FINAL-ENDMENGE.
* WA_FINAL-LGORT = FINAL-LGORT.
* READ TABLE IT_MAKT WITH KEY MATNR = FINAL-MATNR.
* MOVE IT_MAKT-MAKTX TO WA_FINAL-MAKTX.
APPEND WA_FINAL1 TO IT_FINAL1.
ENDLOOP.
ENDFORM. " GET_OPENING -
Calculate stock of material on a particular date ..very urgent (have points
Hi all,
My requirement is to calulate stock of a material on a particular date..
See.
I need a function mudule that will accept..
matnr, date, werks....n give me stock as output..
Please help me reg. this..
Have ur points...hai pradeep,
As there is no function module as u said but u can create the function moudule as per ur requimrent in SE37. Just you need the tables from where you want the stock and from which you are giving matnr, date and werks.
Take the import paramters as matnr, date and werks and export parameter as stock. In source code write the select qurey depending up on the input. i think u know how to write the qurey depending up on the tables from where you want the stock .
hope this will help you.
<b>reward if useful</b>
regards,
sunil kairam. -
Block stock calculation from mseg table for any given date.
I am calculating stock from mseg table for any given date. Not just month end stock or current stock. It could be back date also. It is tallying also with MB5B stock report of that date. Now I have to bifurcate that stock into unrestricted stock, quality stock and block stock.
I have checked INSMK and ZUSTD field in mseg table, but could not concluded. Should I check movement type wise? Block/ Quality stock could be transferred into unrestricted stock also. That also I have to take care.
Can anyone clearly explain how the stock type posting takes place in mseg table when goods receipt as block / quality stock and when the same goods transferred in unrestricted stock, what are the reference indication.DATA : LIST_TAB TYPE TABLE OF ABAPLIST.
DATA: BEGIN OF VLIST OCCURS 0,
FIELD1(5) TYPE C,
FIELD2(19) TYPE C,
FIELD3(16) TYPE C,
FIELD4(17) TYPE C,
FIELD5(25) TYPE C,
FIELD6(24) TYPE C,
FIELD7(25) TYPE C,
FIELD8(25) TYPE C,
END OF VLIST.
TYPES : BEGIN OF ITAB,
MATNR(18) TYPE C,
WERKS(5) TYPE C,
END_MENGE(20) TYPE C,
END OF ITAB.
DATA : ITAB TYPE STANDARD TABLE OF ITAB WITH HEADER LINE,
WA_TAB TYPE ITAB.
----submit command to run mb5b in the background and -
----push the data into an internal table -
" Calling MB5B for displaying the Closing Stock
SUBMIT RM07MLBD USING SELECTION-SCREEN '1000'
WITH DATUM BETWEEN S_DATE-LOW AND S_DATE-HIGH
WITH MATNR IN S_MATNR WITH WERKS IN S_WERKS
WITH BWART-LOW = '601' EXPORTING LIST TO MEMORY
AND RETURN.
CALL FUNCTION 'LIST_FROM_MEMORY'
TABLES
LISTOBJECT = LIST_TAB
EXCEPTIONS
NOT_FOUND = 1
OTHERS = 2.
CALL FUNCTION 'LIST_TO_ASCI'
EXPORTING
LIST_INDEX = -1
TABLES
LISTASCI = VLIST
LISTOBJECT = LIST_TAB
EXCEPTIONS
EMPTY_LIST = 1
LIST_INDEX_INVALID = 2
OTHERS = 3.
LOOP AT VLIST WHERE FIELD1 CS '|'.
CHECK SY-TABIX GE 4.
MOVE : VLIST-FIELD1+1(4) TO ITAB-WERKS,
VLIST-FIELD2+1(18) TO ITAB-MATNR,
VLIST-FIELD8 TO ITAB-END_MENGE.
APPEND ITAB.
ENDLOOP.
This is the program to call MB5B and the standard program and use the following settings for the closing stock opening stock and block stock -
If I know the Material Code and Plant then how can I determine the closing stock of that material for a particular date?
I know that from the table MARD I can get the value of today's closing stock. But how can I know any other days closing stock.
This is very urgent.
Regards,
SubhasishHi
Check this out.... <b>Though this is for Opening Stock</b>, you can have receipts and issues in that period for the material and then calculate the Closing Stock.
*& Form GET_OPENING_STOCK
******* USE THIS LOGIC FOR GETTING OPENING STOCK OF A BATCH ******
********** THE WAY ITS DONE (TO SOME EXTENT) IN Trxn MB5B **********
**************** VERY USEFUL TO GET STOCK FASTER **************
FORM GET_OPENING_STOCK .
DATA: TOTAL TYPE P DECIMALS 3.
CLEAR OPTOT.
REFRESH: IMARD, G_T_MSEG_LEAN.
CLEAR: IMARD, G_T_MSEG_LEAN.
*- Select data from IMARD
SELECT * FROM MARD INTO CORRESPONDING FIELDS OF TABLE IMARD
WHERE WERKS = P_PLANT-LOW
AND MATNR = OPBAL-MATNR.
IF SY-SUBRC = 0.
READ TABLE IMARD INDEX 1.
IF SY-SUBRC = 0.
TOTAL = IMARD-LABST.
ENDIF.
ENDIF.
*- Select data from MSEG and MKPF
SELECT
MKPF~MBLNR
MKPF~MJAHR
MKPF~BLART
MKPF~BUDAT
MKPF~CPUDT
MSEG~MATNR
MSEG~WERKS
MSEG~LGORT
MSEG~CHARG
MSEG~SHKZG
MSEG~MENGE
INTO CORRESPONDING FIELDS OF TABLE G_T_MSEG_LEAN
FROM MKPF AS MKPF JOIN MSEG AS MSEG
ON MKPFMANDT = MSEGMANDT AND
MKPFMBLNR = MSEGMBLNR AND
MKPFMJAHR = MSEGMJAHR
WHERE MSEG~MATNR = OPBAL-MATNR
AND MSEG~WERKS = P_PLANT-LOW
AND MSEG~CHARG = OPBAL-BATCH
AND MKPF~BUDAT GE P_DATE-LOW.
SORT G_T_MSEG_LEAN BY WERKS MATNR CHARG SHKZG DESCENDING.
IF NOT G_T_MSEG_LEAN[] IS INITIAL.
LOOP AT G_T_MSEG_LEAN.
IF G_T_MSEG_LEAN-SHKZG = 'H'.
TOTAL = TOTAL + G_T_MSEG_LEAN-MENGE.
ELSE.
TOTAL = TOTAL - G_T_MSEG_LEAN-MENGE.
ENDIF.
ENDLOOP.
*- Assign Stock
OPTOT = TOTAL.
ENDIF.
ENDFORM. " GET_OPENING_STOCK
Regards,
Raj -
Find material Stock to given date
I have been asked to customize the standard report transaction MB5L. I have created ZPROGRAM for the report. I have an input field for date to get material stock till that date.How can i calculate material stock till the given date ?
Basically you will have to use
An "historical" table with stock at end of periods
- MBEWH Material Valuation: History
- MARDH Material Master Storage Location Segment: History
etc.
A "flow" table for movement before last period recorded and date asked for
- MSEG/MKPF Document Segment: Material
- BSIM Secondary Index, Documents for Material
<i>(Use MSEG/MKPF for quantities and BSIM for valuations its easier than matching the two files, valuation can vary without movement in MSEG and some movement in MSEG don't reflect in accounting)</i>
Regards -
Stock report with value and qauntity for given date not month wise
Hi gems,
can any body give me the standard report for Stock value and qauntity for given date not month wise at storage location levelHi
check the report S_P00_07000139 with the option inventory and raw material report- detail and selection date (from, to date same). List will give opening & closing balances with goods movment and their values.
Thanks -
Material stock received and issued for a given period of time
HOW to get the material stock received and issued for a given period of time including the open orders.
if there is any BAPI Available then please tell me. or give me the table relations thaks.
thanks inadvancehi friend,
Why don't you try using a TIMER. Try using this code
Timer timer = new Timer((TIMER), new ActionListener()
public void actionPerformed(ActionEvent ae)
// perform your task here...
timer.setInitialDelay(TIMER);
timer.setRepeats(true);
timer.start();
I think this will work fine.
Bye,
Ravi. -
Table to get "stock of material on a past date "
Hi Guru's,
Can anyone tell me "how to get stock of material on a past date".
Pls tell me from which Table you can fetch these values and in what logic.
Any Input is highly appreciated.
Thanks and Regards,
SelvaHello,
You can get the stock from the table MARDH, MCHBH period wise.
this table is use for history stocks.
Regards
Bhima -
Status of Stock on any given date/Complex
Hi Experts,
I want to display the status of stock(Like MMBE) on any given date. Actually i am trying to capture the MSEG data and categorize based on the movement types/stock status/special stock indicator and trying to calculate the status of stock in each category.
I find it complex when i handle the case like following...as there is no clue direclty available in the MSEG for the stock status.
1. Mov .643 - Stock 100 kg is posted as Stock in TransferC.C
2. Mov. 101 - GR Stock 50Kg posted in Restricted stock category
Now when i display the stock status as per my logic it shows that Stock in Transit is 100kg and Restricted Stock is 50Kg
Actually it has to be 50Kg in each category.
How to acheive the above ?
Could You please share your experience and suggestions to overcome the above situation.
Regards
PrasathHi,
Try with folowing t.codes
MB52,
MC.9,
MCRE,
WSL7,
MB5B,
MB5T
Regards,
Biju K -
How to query a item stock quantity for a given date
Hi there,
I need to query the stock quantity of an item for a given date. For example, i want to know how many pieces of A i have on stock at the 20th of march 2009.
I know there is a report, but i need the value for a subquery.
Regards SteffenSorry Gordon,
Your query is not wrong, far from me to insult your work. It does indeed make full sense if the business process allows the item description to change.
If not, we can avoid a "inner join" = smaller, cleaner and (theoritically) faster query
Here is your code with the little review:
SELECT T0.ItemCode, T0.Dscription, sum(T0.InQty - T0.OutQty) as 'On Hand'
FROM DBO.OINM T0
WHERE T0.DocDate <= '[%0]' and T0.ItemCode = '[%1]'
GROUP BY T0.ItemCode, T0.Dscription
Cheers
tested on 2007 SP00 PL46 -
Opening Stock Comapny - Plant - Material - Batch - Storage location Wise
Dear Friends,
I want to do the following report. I will explain the details to you. Pleaes suggest on how to go about it.
1. Since you know that SAP stores stock in a summary form (Plant / Material wise). Our management wants the report on the following hierarchy. (Company - Plant - Material - Batch - Storage). Our management has suggested the following:
a. Create a ZTABLE with the above columns including Quantity (which will contain closing stock quantity).
b. In this calculate and store Closing stock for each month.
c. an insert / update program has to be created for uploading data in the ZTABLE (selection will contain date).
for ex:
When running the program for 31st March 2008. system will take the closing stock stored in the ZTABLE for previous months + March Receipt - March issues. the result will be the closing stock for March 2008.
d. Then a report will be prepared using the ZTABLE and other calculated fields.
Can anyone give me the guideline as to how to go about it. Tables to be used and logic to be followed? Or if any other way the result can be achieved then nothing like it.
The Managements final goal is to have any given date closing stock in the above hierarchy (minimizing the Performance issue... that is why the suggestion of ZTABLE)...
Awaiting for your expert opinions.....
Regards,
Jitesh M NairFigured out
-
Transfering the stock of old material
Hi guru's,
Iam transfering the stock from old material to new materialcode w.r.t. order Mvt 261 & then receiving it in new material by Mvt 262. Now the problem is one material is given for subcontracting how can I transfer it. By the above said process the stock is not becoming zero for the old material. When I looked at the material document for the given material, it is displaying sub items / materials in that MB51 list.
how can I transfer the material.
its urgent
thanks
tuljasingh.hi,
Entering the purchase order number is simply a way of saving you time re-entering data. No data in the purchase order is actually updated - i.e. you can make transfer postings for components more than once.
so u can transfer post material without po
try ME2O so that u
can post ur material from there and also u can monitor ur stock aslo
refer
http://help.sap.com/erp2005_ehp_03/helpdata/EN/4d/2b906243ad11d189410000e829fbbd/frameset.htm
Thanks & Regards
Swathi -
Stock Quantity & Stock Value at vendor on a Particular Date
HI,
My client requirement is to get a report for Stock Quantity & Stock Value at vendor on a Particular Date .
Please give suggestions to get the stock & value in tables or Any standard T.codes
Note : I am getting Stock qty on paricular date In MB5B & S_P00_07000140 , but not getting the values
Regards,
PRHI,
we can get this report thru SAP standard without vendor selection, do the following steps
1. goto MB5B
2. Give plant /material details
3. give selection date
4. select stock type option as special stock
5. select special stoct indicator as "O" for material provided to vendor
excute the same , you will get a report with qty and value posted for the vendor from the plant
here by copying this standard program we can add one more input parameter as vendor, then we can get this report vendorwise also.
try this and let us know
Regards
Sridharan
Maybe you are looking for
-
I created an application to open a PDF and print it directly on the default printer. This application works if the file is a Windows' network address (example: \\192.168.0.4). But if I put an internet address (URL), the Acrobat Reader presents the fo
-
Having problems trying to install ipod
I keep running the install disk and it asks to connect the ipod to see if it needs to be formatted. I do this and it says that it is rebooting the ipod...then it says to press the format button again. It will do this a couple times then say that it i
-
Oracle Workflow timeout issue ....
Hey Guys , Happy new year to you all. I have a issue facing in in our custom oracle Workflow. Here are details : The workflow custom process has handled in such way that after five days of the notificaiton generation if its unattended then it will ti
-
Error Handling in SOA Composite
Hi, Is it possible to show the error message thats thrown in SOA composite on OIM UI for request ? Any ideas on this ?? Thanks, Hrushi
-
What's the best camcorder for taking video to edit in final cut express?
I had a sony, but the file type was MTS and it required conversion to edit in Final Cut Express 3. So i sold it on ebay, and I'm looking to replace it. Does anyone have a set up that is easy to transfer HD video from their camera to their Mac, and