Stock on particular date
How the system finds stock of material on specified date .
Example In report MB5b system gives stock of material on date we have selected . If I select date 31 Mar 2010 then system displays stock as on 31 Mar . From which table it comes ?
(In table MBEW we can get stock as on todays date)
Hi,
In MB5B, the system will first take in to account of all total valuated stock for the particular valuation area on system date. This will be in the table S032. Then it will take in to account total issues and receipts during the back date. Then the difference will be added or subtracted accordingly from the present stock and value.
Regards
Similar Messages
-
Functional Specification For Opening And closing stock On Particular Date
Dear Gurus,
I am creating report for opening and closing stock on particular date in which batch and storage location should also be included. I want to know the tables and fields for the same.I have searched the forum and got report on month basis but I want this report on posting day basis.kindly suggest tables and fields. Thanks in AdvanceDear sir,
There are many other colums that client wants to add which are not present in MB5B transaction.columns which client wants to add are as follows...
Material Number
Material Description
Material Type
Material Group
External material Group
Movement Type
Plant
Storage Location
Customer Number
Customer Name
Vendor Number
Vendor Name
Posting Date Receipt Doc. Number
Issue Doc. Number
Reference Issue Document Number
Opening Stock Quanity
Material Receipt Quantity
Material Issue Quantity
Material Closing Stock Quantity
Value Of Closing Stock
And for this I want tables and logic for the same. kindly provide the solution for the same. -
Need stock on particular date entered on selection screen
I am creating a stock in transit report and need stock on particular date entered by the user on selection screen.How do I calculate stock on a particular date?
same thread...
Re: Stock on a particulare date -
Vendor stock on particular date
vendor stock on particular date..any std Tcode
plz help
mb5b,mblb,mc.9 wont work
thanks
ramesh reddy(vallur)ME2O
Or
ME2M & ME2L, choose , Item Category L, and choose selection parameter of your requirement.
Choose MB5B,
Choose radio Button Special stock and give special stock as O.It may help u.
Edited by: sudhansu satapathy on Dec 16, 2011 11:46 AM
Edited by: sudhansu satapathy on Dec 16, 2011 11:49 AM -
Closing Stock on Particular Date(MB5B Tcode)
Hi Experts,
I need closing stock as on some particular date. For e.g. closing stock as on 28.02.2014.
In my requirement i have to use that closing stock value for further calculations in a new customized report.I can see closing stock value by using MB5B tcode.
Please suggest some way to get closing stock as on some date so that i can use that in my Report.
Can i directly call MB5B transaction in my Report and get closing stock value?
Thanks & Regards,
PankajHello Pankaj,
In your Customised Report use MKPF and MSEG table
MKPF -----> Material and date range as the input
Then Pass Material document number from MKPF to MSEG table
MSEG -----> based on material document number from mkpf
Create Temporary variable
values comes from the mseg where have credit and debit entries
if debit entry "S" then subtract the values of the Mseg table from the temporary variable1
if credit entry "H" then Add the values of the mseg table to the temporary variable2
finally Add the temporary variable1 and temporary variable 2 and get the total stock. -
Stock on particular date (performance issue)
Hi Folks,
I m calculating stock at all vendor on a particular date.
But it takes very long and time_out occurs.
I m calculating opening closing provided return and rejection based on movement types.
The report hangs up at following particular Join.
SELECT MKPFBUDAT MSEGBWART MSEGMATNR MSEGLIFNR SUM( MSEG~MENGE )
AS MENGE
INTO CORRESPONDING FIELDS OF TABLE IT_OPEN
FROM
MKPF INNER JOIN MSEG ON
MKPFMBLNR = MSEGMBLNR AND
MKPFMJAHR = MSEGMJAHR
WHERE MKPF~MJAHR = D_YEAR AND
MKPF~BUDAT GE D_DATE AND
MKPF~BUDAT LT S_BUDAT-LOW AND
MSEG~BWART IN ('541','542','543','544','551','702') AND
MSEG~XAUTO NE 'X' AND
MSEG~MATNR IN S_MATNR AND
MSEG~WERKS IN P_WERKS AND
MSEG~LIFNR IN P_LIFNR
GROUP BY LIFNR MATNR BUDAT BWART.
Is there any way to increase performance by breaking this inner join into select statements or anyhow.
Regards
SachinHI,
On seeing your code, it seems like,
SELECT MKPFBUDAT MSEGBWART MSEGMATNR MSEGLIFNR SUM( MSEG~MENGE )
AS MENGE
INTO CORRESPONDING FIELDS OF TABLE IT_OPEN
FROM
MKPF INNER JOIN MSEG ON
MKPFMBLNR = MSEGMBLNR AND
MKPFMJAHR = MSEGMJAHR
WHERE MKPF~MJAHR = D_YEAR AND
MKPF~BUDAT GE D_DATE AND
MKPF~BUDAT LT S_BUDAT-LOW AND
MSEG~BWART IN ('541','542','543','544','551','702') AND
MSEG~XAUTO NE 'X' AND
MSEG~MATNR IN S_MATNR AND
<b>MSEG~WERKS EQ P_WERKS</b> AND
<b>MSEG~LIFNR EQ P_LIFNR</b>
GROUP BY LIFNR MATNR BUDAT BWART.
Please see the code marked with bold as parameter passing in the select statement must be EQ and not IN.
Secondly, remove the aggregate function SUM from the select. First select all the records into an internal table and either use control break statements or Collect to sum up the entries.
Next, while selecting from the database use INTO TABLE IT_OPEN rather than into corresponding fields of table.
Also remove the movement types from the select and restrict it inside the Loop and Endloop.
Lakshminarayanan
Please mark all helpful answers for points -
Table to see stock on particular date
Hello SAP Gurus,
I know that through mb5b report you can see the stock on posting date.But guys can u tell me that from which table and field it takes the data?Please look at transactions MCBE and MCBR. They are part of the inventory standard analysis. These will show total consumption for the selected time periods.
There is a ton of data availablie via the Logistics Information System and I think it is the most under utilized functionality in SAP. If consultants and users really learned how to use this functionality you could probably do away with 80% of your custom reports.
You can also use flexiblie analysis against structure/table S032, (not S039), and create your own analysis and reports. These can be highly customized and saved and reused. Variants can be created and the results can be saved in personal reports, emailed or downloaded.
Other structures you might find of use in your particular query would be
S031 - Movements
S032 - Stocks
S033 - Movements (indiv. records)
S034 - Movements (batches)
S035 - Stocks (batches)
S039 as suggested above provides primarily averages which is not what your looking for.
Craig
Edited by: Craig Snyder on Apr 30, 2008 1:26 AM -
Inventory cube 0IC_C03 ,Stock on particular date
Hi All,
We are trying to get the stock on a particular date using cube 0IC_C03 ,but we are unable to get the total stock on a given date.
1)Ex: I want stock on 01.12.2009 ,but in the query output I am getting null values.
I am only getting the total stock quantity on the loaded date for ex:04.01.2010(which is my data loading date in to the cube).
2)And when we restrict 0calday with <=01.12.2009 ,i have to get the total stock till 01.12.2009
Thanks®ards,
SunithaHi,
Check
Treatment of historical full loads with Inventory cube
Setting up material movement/inventory with limit locking time
1)Ex: I want stock on 01.12.2009 ,but in the query output I am getting null values.
I am only getting the total stock quantity on the loaded date for ex:04.01.2010(which is my data loading date in to the cube).
For 2LIS_03_BX it will give the extracted date only
2)And when we restrict 0calday with <=01.12.2009 ,i have to get the total stock till 01.12.2009
try with below options.
Use :
0VALSTCKVAL " for Value
0VALSTCKQTY " for Qty
0CALMONTH " for Month
Use the above combinations in New Selections in columns and go it.
For Qty Opening:
New Selection bad drag abd drop following things
0VALSTCKQTY " for Qty
0CALMONTH " for Month and restrict with less then or equalto option variable (single value, user input) and set the offeset
value = -1 bcoz if user will give 12.2009 , so it will display 11.2009 closing stock, this is opening for 12.2009.
For Qty Closing:
New Selection bad drag abd drop following things
0VALSTCKQTY " for Qty
0CALMONTH " for Month and restrict with less then or equalto option variable (single value, user input) .
In the same way build for Value and other Keyfigures on 0IC_C03.
And
Drag & drop
0MATERAIL
0PLANT " Give some Input Variable.
See the steps.
Treatment of historical full loads with Inventory cube
Setting up material movement/inventory with limit locking time
If it is BI 7 then for BX in in DTP in Extraction Tab you need to select Extacrion mode = NON-Cumulative option.
Thanks
Reddy -
Regarding Stock on Particular Date
hi all,
I am getting Current Stock through MARD table but when i am going to Previous date i am getting Current Stock only.
How can we calculate Previous day Stock.
Please suggest solution.
Regards
ReddyRM,
Why you not using SAP standard report.i guess there is hell lot of reports on stock already in System.
use them for less error risk.
MB51,MB5B,MMBEthere all ares tock report which build by system only.
Amit. -
Hi guys,
Can we get stock of any material as on a specified date without using mb5b? Which table will store this data?
Please help me out on this
thanks in advance
saiHello Chintu,
MB5B is the best report to get material stock on specific date.
There is no direct table which stores stock on particular date, but SAP system calculates strategically with GR, GI and material transfers to get this data. If you want report on that then I think need to develop it.
Does MB5B not meet your requirement? Pl. explain the requirement so we can suggest accordingly.
Regards
Arif Mansuri -
FG stock on a particular date for a specific customer
Hi all,
I need to develop one report in which i need FG stock for a particular customer on a particular date. For ex on 5/11/11 what was the FG stock against xyz customer.
Is there any logic available for this requirement. can you please tell me which tables i should look for?
ThanksFG stock for a particular customer on a particular date.
Is it Make to Order stock? If it is not, then you may not find the details. If it is MTO, then use t.code MB5B. Using this, you can find stock on particular date.
Regards, -
Stock at subcontractor for Particular Date
Dear Experts
There is a t-code to get the Stk at subcontractor for a particular date .MBLB will show only current Stk, i need it for Particular date.
Rgds
Pankaj AgarwalHi,
There's no standard report for this.
You can develop you own report using current stock level (MARD, MSPR, MSKA, EKBE (stock in transit), etc) and goods movement (MKPF, MSEG) data.
Regards,
Csaba
remark:
ME2O won't provide information on stock on particular date. The date field is "requirement date".
Edited by: Csaba Szommer on Jul 24, 2009 7:51 AM -
Closing stock of a particular date
how to get plant wise material closing stock on any particular date. say previous months end date. I am calculating that from MSEG table with the help of MSEGINSMK and MSEGSHKZG field. (with date filtaration by joining MBLNR of MKPF table) But stock is showing different with the closing stock showing in MB5B report for that date. I don't know which BWART of MSEG table to be excluded. My email id is [email protected]
Hi,
This is a stock aging report, you can use this for reference.
Logic: Based on current stock and value from MBEW table. The latest receipt dates were taken till the qty tallies off.Rejections and reversals are considered.
The movement types considered are ('101','102','105','106','122','123','131','132','301','302','309','310','501','502','531','532','561','562','701','702').
*& Report ZMM03_TRY *
REPORT ZMM03 LINE-SIZE 226
LINE-COUNT 35(2)
NO STANDARD PAGE HEADING..
TABLES : S032, "Current Stock And Grouping Terms
MBEW, "Material Valuation
T023T, "Material Group Desc.
MAKT, "Material Description
EKPO. "Purchasing Document Item.
DATA : BEGIN OF T_HEADER OCCURS 0,
MTART LIKE MARA-MTART,
MATNR LIKE MBEW-MATNR,
BWKEY LIKE MBEW-BWKEY,
MATKL LIKE MARA-MATKL,
MAKTX LIKE MAKT-MAKTX,
MEINS LIKE MARA-MEINS,
LBKUM LIKE MBEW-LBKUM,
SALK3 LIKE MBEW-SALK3,
VERPR LIKE MBEW-VERPR,
CLSTK LIKE MBEW-LBKUM,
CLVAL LIKE CKMLCR-SALK3,
UNIT LIKE CKMLCR-PVPRS,
END OF T_HEADER.
DATA : BEGIN OF T_MSEG OCCURS 0,
MATNR LIKE MSEG-MATNR,
WERKS LIKE MSEG-WERKS,
BUDAT LIKE MKPF-BUDAT,
MBLNR LIKE MKPF-MBLNR,
MJAHR LIKE MKPF-MJAHR,
ZEILE LIKE MSEG-ZEILE,
LFBNR LIKE MSEG-LFBNR,
LFBJA LIKE MSEG-LFBJA,
LFPOS LIKE MSEG-LFPOS,
BWART LIKE MSEG-BWART,
MENGE LIKE MSEG-MENGE,
EBELN LIKE MSEG-EBELN,
EBELP LIKE MSEG-EBELP,
XAUTO LIKE MSEG-XAUTO,
UMMAT LIKE MSEG-UMMAT,
UMWRK LIKE MSEG-UMWRK,
MARK(1),
END OF T_MSEG.
TYPE-POOLS : SLIS.
DATA : L_STOCK TYPE MSEG-MENGE.
DATA : WA_MSEG LIKE T_MSEG.
DATA : WA_MSEG1 LIKE T_MSEG.
DATA : T_ITEMS LIKE T_MSEG OCCURS 0 WITH HEADER LINE.
DATA : T_CUR_STOCK LIKE T_MSEG OCCURS 0 WITH HEADER LINE.
DATA : L_LBKUM TYPE MBEW-LBKUM.
DATA : BEGIN OF T_OUTPUT OCCURS 0,
WERKS LIKE MSEG-WERKS,
MATNR LIKE MSEG-MATNR,
BUDAT LIKE MKPF-BUDAT,
MENGE LIKE MSEG-MENGE,
PDAYS TYPE I,
PVAL TYPE MSEG-MENGE,
MAKTX LIKE MAKT-MAKTX,
CQTY LIKE MSEG-MENGE,
CPRC LIKE MBEW-SALK3,
END OF T_OUTPUT.
DATA: GRID_TAB TYPE SLIS_T_FIELDCAT_ALV WITH HEADER LINE.
DATA : T_SORT TYPE SLIS_T_SORTINFO_ALV,
WA_SORT TYPE SLIS_SORTINFO_ALV.
*AT SELECTION-SCREEN.
SELECTION-SCREEN BEGIN OF BLOCK 1 WITH FRAME TITLE TEXT-014.
SELECTION-SCREEN SKIP 1.
PARAMETERS : P_DATE LIKE S032-LETZTABG OBLIGATORY DEFAULT SY-DATUM.
SELECTION-SCREEN SKIP 1.
SELECTION-SCREEN END OF BLOCK 1.
SELECTION-SCREEN BEGIN OF BLOCK 2 WITH FRAME TITLE TEXT-015.
PARAMETERS : P_WERKS TYPE S032-WERKS OBLIGATORY.
SELECT-OPTIONS : S_LGORT FOR S032-LGORT,
S_MATNR FOR S032-MATNR.
SELECTION-SCREEN END OF BLOCK 2.
SELECTION-SCREEN BEGIN OF BLOCK 3 WITH FRAME TITLE TEXT-016.
SELECT-OPTIONS : S_MTART FOR S032-MTART,
S_MATKL FOR S032-MATKL.
SELECTION-SCREEN END OF BLOCK 3.
IF P_DATE IS INITIAL AND
P_WERKS IS INITIAL AND
S_LGORT IS INITIAL AND
S_MATNR IS INITIAL AND
S_MTART IS INITIAL AND
S_MATKL IS INITIAL.
MESSAGE I398(00) WITH 'Enter Selection Critirea'(019).
SY-SUBRC = '1'.
ELSE.
SELECT AMATNR ABWKEY BMATKL BMTART CMAKTX BMEINS A~LBKUM
A~SALK3
INTO CORRESPONDING FIELDS OF TABLE T_HEADER
FROM MBEW AS A INNER JOIN MARA AS B ON AMATNR = BMATNR
INNER JOIN MAKT AS C ON AMATNR = CMATNR
WHERE A~MATNR IN S_MATNR
AND A~BWKEY EQ P_WERKS
AND MATKL IN S_MATKL
AND MTART IN S_MTART
AND BWTAR EQ ' '
AND C~SPRAS = SY-LANGU.
IF SY-SUBRC EQ 0.
SELECT ABUDAT AMBLNR AMJAHR BZEILE BMATNR BWERKS B~BWART
BMENGE BLFBNR BLFBJA BLFPOS BEBELN BEBELP B~XAUTO
BUMMAT BUMWRK
INTO CORRESPONDING FIELDS OF TABLE T_MSEG
FROM MKPF AS A INNER JOIN MSEG AS B ON AMBLNR = BMBLNR
AND AMJAHR = BMJAHR
FOR ALL ENTRIES IN T_HEADER
WHERE A~BUDAT <= P_DATE
AND B~MATNR = T_HEADER-MATNR
AND B~WERKS = T_HEADER-BWKEY
AND B~BWART IN ('101',
'102',
'105',
'106',
'122',
'123',
'301',
'302',
'701',
'702',
'131',
'132',
'309',
'310',
'501',
'502',
'531',
'532',
'561',
'562').
PERFORM GET_DEAD_STOCK.
PERFORM DISPLAY_OUTPUT.
ELSE.
MESSAGE S398(00) WITH 'No Data found for'(013)
'Given Selection Critirea'(017).
LEAVE LIST-PROCESSING.
ENDIF.
ENDIF.
*& Form get_dead_stock
text
FORM GET_DEAD_STOCK .
LOOP AT T_HEADER.
SORT T_MSEG BY MATNR WERKS BUDAT DESCENDING MBLNR DESCENDING.
LOOP AT T_MSEG WHERE MATNR = T_HEADER-MATNR
AND WERKS = T_HEADER-BWKEY
AND ( BWART = '101' OR
BWART = '105' OR
BWART = '501' OR
BWART = '531' OR
BWART = '561' OR
BWART = '701' OR
BWART = '309' OR
BWART = '301' OR
BWART = '131' ).
IF T_MSEG-BWART = 101.
READ TABLE T_MSEG WITH KEY LFBNR = T_MSEG-MBLNR
LFBJA = T_MSEG-MJAHR
LFPOS = T_MSEG-ZEILE
BWART = 102.
IF SY-SUBRC = 0.
T_MSEG-MARK = 'X'.
MODIFY T_MSEG.
CONTINUE.
ENDIF.
READ TABLE T_MSEG INTO WA_MSEG WITH KEY LFBNR = T_MSEG-MBLNR
LFBJA = T_MSEG-MJAHR
LFPOS = T_MSEG-ZEILE
BWART = 122.
IF SY-SUBRC = 0.
READ TABLE T_MSEG INTO WA_MSEG1 WITH KEY LFBNR = WA_MSEG-MBLNR
LFBJA = WA_MSEG-MJAHR
LFPOS = WA_MSEG-ZEILE
BWART = 123.
IF SY-SUBRC EQ 0.
WA_MSEG-MARK = 'X'.
MODIFY T_MSEG FROM WA_MSEG.
CONTINUE.
ELSE.
IF T_MSEG-MENGE EQ WA_MSEG-MENGE.
T_MSEG-MARK = 'X'.
MODIFY T_MSEG.
CONTINUE.
ELSE.
T_MSEG-MENGE = T_MSEG-MENGE - WA_MSEG-MENGE.
MODIFY T_MSEG.
ENDIF.
ENDIF.
ENDIF.
ELSEIF T_MSEG-BWART = 105.
READ TABLE T_MSEG INTO WA_MSEG WITH KEY LFBNR = T_MSEG-MBLNR
LFBJA = T_MSEG-MJAHR
LFPOS = T_MSEG-ZEILE
BWART = 106.
IF SY-SUBRC = 0.
T_MSEG-MARK = 'X'.
MODIFY T_MSEG.
CONTINUE.
ENDIF.
ELSEIF T_MSEG-BWART = 131.
READ TABLE T_MSEG INTO WA_MSEG WITH KEY LFBNR = T_MSEG-MBLNR
LFBJA = T_MSEG-MJAHR
LFPOS = T_MSEG-ZEILE
BWART = 132.
IF SY-SUBRC = 0.
T_MSEG-MARK = 'X'.
MODIFY T_MSEG.
CONTINUE.
ENDIF.
ELSEIF T_MSEG-BWART = 501.
READ TABLE T_MSEG WITH KEY LFBNR = T_MSEG-MBLNR
LFBJA = T_MSEG-MJAHR
LFPOS = T_MSEG-ZEILE
BWART = 502.
IF SY-SUBRC = 0.
T_MSEG-MARK = 'X'.
MODIFY T_MSEG.
CONTINUE.
ENDIF.
ELSEIF T_MSEG-BWART = 301.
READ TABLE T_MSEG WITH KEY LFBNR = T_MSEG-MBLNR
LFBJA = T_MSEG-MJAHR
LFPOS = T_MSEG-ZEILE
BWART = 302.
IF SY-SUBRC = 0.
T_MSEG-MARK = 'X'.
MODIFY T_MSEG.
CONTINUE.
ENDIF.
ELSEIF T_MSEG-BWART = 531.
READ TABLE T_MSEG WITH KEY LFBNR = T_MSEG-MBLNR
LFBJA = T_MSEG-MJAHR
LFPOS = T_MSEG-ZEILE
BWART = 532.
IF SY-SUBRC = 0.
T_MSEG-MARK = 'X'.
MODIFY T_MSEG.
CONTINUE.
ENDIF.
ELSEIF T_MSEG-BWART = 561.
READ TABLE T_MSEG WITH KEY LFBNR = T_MSEG-MBLNR
LFBJA = T_MSEG-MJAHR
LFPOS = T_MSEG-ZEILE
BWART = 562.
IF SY-SUBRC = 0.
T_MSEG-MARK = 'X'.
MODIFY T_MSEG.
CONTINUE.
ENDIF.
ELSEIF T_MSEG-BWART = 701.
READ TABLE T_MSEG WITH KEY LFBNR = T_MSEG-MBLNR
LFBJA = T_MSEG-MJAHR
LFPOS = T_MSEG-ZEILE
BWART = 702.
IF SY-SUBRC = 0.
T_MSEG-MARK = 'X'.
MODIFY T_MSEG.
CONTINUE.
ENDIF.
ELSEIF T_MSEG-BWART = 309.
READ TABLE T_MSEG WITH KEY LFBNR = T_MSEG-MBLNR
LFBJA = T_MSEG-MJAHR
LFPOS = T_MSEG-ZEILE
BWART = 310.
IF SY-SUBRC = 0.
T_MSEG-MARK = 'X'.
MODIFY T_MSEG.
CONTINUE.
ELSEIF T_MSEG-XAUTO = ' '.
T_MSEG-MARK = 'X'.
MODIFY T_MSEG.
CONTINUE.
ELSEIF T_MSEG-MATNR EQ T_MSEG-UMMAT.
T_MSEG-MARK = 'X'.
MODIFY T_MSEG.
CONTINUE.
ENDIF.
ENDIF.
SELECT SINGLE EBELN INTO EKPO-EBELN FROM EKPO
WHERE EBELN = T_MSEG-EBELN
AND EBELP = T_MSEG-EBELP
AND KNTTP = 'K'.
IF SY-SUBRC = 0.
T_MSEG-MARK = 'X'.
MODIFY T_MSEG.
CONTINUE.
ENDIF.
TMENGE = TMENGE - t_mseg-MENGE.
ENDLOOP.
ENDLOOP.
DELETE T_MSEG WHERE MARK = 'X'.
DELETE T_MSEG WHERE ( BWART = '102' OR
BWART = '106' OR
BWART = '502' OR
BWART = '532' OR
BWART = '562' OR
BWART = '702' OR
BWART = '310' OR
BWART = '302' OR
BWART = '123' OR
BWART = '122' OR
BWART = '132' ).
SORT T_HEADER BY MATNR BWKEY.
DELETE ADJACENT DUPLICATES FROM T_HEADER COMPARING MATNR BWKEY.
T_CUR_STOCK[] = T_MSEG[].
SORT T_CUR_STOCK BY MATNR WERKS.
LOOP AT T_CUR_STOCK.
WA_MSEG = T_CUR_STOCK.
AT END OF WERKS.
ENDAT.
ENDLOOP.
LOOP AT T_HEADER.
CLEAR L_LBKUM.
L_LBKUM = T_HEADER-LBKUM.
REFRESH T_ITEMS.
CLEAR T_ITEMS.
LOOP AT T_MSEG WHERE MATNR EQ T_HEADER-MATNR
AND WERKS EQ T_HEADER-BWKEY.
T_ITEMS = T_MSEG.
APPEND T_ITEMS.
CLEAR T_ITEMS.
ENDLOOP.
SORT T_ITEMS BY BUDAT DESCENDING
MBLNR DESCENDING.
CLEAR L_LBKUM.
LOOP AT T_ITEMS.
L_LBKUM = T_ITEMS-MENGE - T_HEADER-LBKUM.
IF L_LBKUM GE 0.
T_OUTPUT-MATNR = T_HEADER-MATNR.
T_OUTPUT-WERKS = T_HEADER-BWKEY.
T_OUTPUT-BUDAT = T_ITEMS-BUDAT.
T_OUTPUT-MENGE = T_HEADER-LBKUM.
APPEND T_OUTPUT.
CLEAR T_OUTPUT.
EXIT.
ELSE.
T_HEADER-LBKUM = T_HEADER-LBKUM - T_ITEMS-MENGE.
T_OUTPUT-MATNR = T_HEADER-MATNR.
T_OUTPUT-WERKS = T_HEADER-BWKEY.
T_OUTPUT-BUDAT = T_ITEMS-BUDAT.
T_OUTPUT-MENGE = T_ITEMS-MENGE.
APPEND T_OUTPUT.
CLEAR T_OUTPUT.
CONTINUE.
ENDIF.
ENDLOOP.
ENDLOOP.
ENDFORM. " get_dead_stock
*& Form DISPLAY_OUTPUT
text
FORM DISPLAY_OUTPUT .
DATA: L_DAYS TYPE I.
DATA : WA_OUTPUT LIKE T_OUTPUT.
DATA : T_FINAL LIKE T_OUTPUT OCCURS 0 WITH HEADER LINE.
DATA : WA_FINAL LIKE T_OUTPUT.
DATA : L_CQTY TYPE MSEG-MENGE,
L_CPRC TYPE MBEW-SALK3.
DATA : L_TITLE TYPE LVC_TITLE.
DATA : L_NAME1 TYPE T001W-NAME1.
*C-- Not to output when the quantity is zero.
DELETE T_OUTPUT WHERE MENGE EQ 0.
SORT T_OUTPUT BY WERKS MATNR BUDAT.
LOOP AT T_OUTPUT.
T_FINAL = T_OUTPUT.
AT NEW MATNR.
CLEAR T_HEADER.
READ TABLE T_HEADER WITH KEY MATNR = T_OUTPUT-MATNR
BWKEY = T_OUTPUT-WERKS.
ENDAT.
T_FINAL-MAKTX = T_HEADER-MAKTX.
IF T_HEADER-LBKUM GT 0.
T_FINAL-PVAL = ( T_OUTPUT-MENGE * T_HEADER-SALK3 / T_HEADER-LBKUM ).
ELSE.
CLEAR T_FINAL-PVAL.
ENDIF.
L_CQTY = L_CQTY + T_OUTPUT-MENGE.
IF T_HEADER-LBKUM GT 0.
L_CPRC = L_CPRC + ( T_OUTPUT-MENGE * T_HEADER-SALK3 / T_HEADER-LBKUM ).
ENDIF.
CALL FUNCTION 'HR_SGPBS_YRS_MTHS_DAYS'
EXPORTING
BEG_DA = T_OUTPUT-BUDAT
END_DA = P_DATE
IMPORTING
NO_CAL_DAY = L_DAYS
EXCEPTIONS
DATEINT_ERROR = 1
OTHERS = 2.
IF SY-SUBRC <> 0.
WRITE : 70 'Error While Calculating days'(018) .
ELSE.
T_FINAL-PDAYS = L_DAYS.
ENDIF.
T_FINAL-CQTY = L_CQTY.
T_FINAL-CPRC = L_CPRC.
APPEND T_FINAL.
AT END OF MATNR.
CLEAR : L_CPRC, L_CQTY.
ENDAT.
ENDLOOP.
PERFORM BUILD_FIELD_CATALOG.
WA_SORT-FIELDNAME = 'MATNR'.
WA_SORT-SPOS = '1'.
APPEND WA_SORT TO T_SORT.
SELECT SINGLE NAME1 FROM T001W INTO L_NAME1
WHERE WERKS = P_WERKS.
CONCATENATE 'Plant: ' P_WERKS ',' L_NAME1 INTO L_TITLE.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = SY-CPROG
I_GRID_TITLE = L_TITLE
IT_FIELDCAT = GRID_TAB[]
IT_SORT = T_SORT
I_SAVE = 'A'
TABLES
T_OUTTAB = T_FINAL[].
SORT T_FINAL BY WERKS MATNR BUDAT.
LOOP AT T_FINAL.
WRITE : /10 T_FINAL-MATNR.
WRITE : 30 T_FINAL-WERKS.
WRITE : 40 T_FINAL-BUDAT.
WRITE : 50 T_FINAL-MENGE.
**C-- FM to find the number of days between
**C-- todays date and the posting date
CALL FUNCTION 'HR_SGPBS_YRS_MTHS_DAYS'
EXPORTING
BEG_DA = T_FINAL-BUDAT
END_DA = P_DATE
IMPORTING
NO_CAL_DAY = L_DAYS
EXCEPTIONS
DATEINT_ERROR = 1
OTHERS = 2.
IF SY-SUBRC <> 0.
WRITE : 70 'Error While Calculating days'(018) .
ELSE.
WRITE : 70 L_DAYS.
ENDIF.
AT END OF MATNR.
ULINE.
READ TABLE T_HEADER WITH KEY MATNR = T_FINAL-MATNR
BWKEY = T_FINAL-WERKS.
IF SY-SUBRC EQ 0.
WRITE : /1 'Total Valuated Stock', T_HEADER-LBKUM.
WRITE : /1 'Value of total valuated Stock', T_HEADER-SALK3.
ULINE.
ENDIF.
ENDAT.
ENDLOOP.
ENDFORM. " DISPLAY_OUTPUT
*& Form BUILD_FIELD_CATALOG
text
--> p1 text
<-- p2 text
FORM BUILD_FIELD_CATALOG .
DATA : CNT1 TYPE I.
CNT1 = CNT1 + 1.
GRID_TAB-COL_POS = CNT1.
GRID_TAB-SELTEXT_L = 'Material'.
GRID_TAB-FIELDNAME = 'MATNR'.
GRID_TAB-KEY = 'X'.
GRID_TAB-NO_ZERO = 'X'.
GRID_TAB-TABNAME = 'T_FINAL'.
APPEND GRID_TAB.
CLEAR GRID_TAB.
CNT1 = CNT1 + 1.
GRID_TAB-COL_POS = CNT1.
GRID_TAB-SELTEXT_L = 'Material Description'.
GRID_TAB-FIELDNAME = 'MAKTX'.
GRID_TAB-OUTPUTLEN = '30'.
GRID_TAB-KEY = 'X'.
GRID_TAB-NO_ZERO = 'X'.
GRID_TAB-TABNAME = 'T_FINAL'.
APPEND GRID_TAB.
CLEAR GRID_TAB.
CNT1 = CNT1 + 1.
GRID_TAB-COL_POS = CNT1.
GRID_TAB-SELTEXT_L = 'Date of Reciept'.
GRID_TAB-FIELDNAME = 'BUDAT'.
GRID_TAB-KEY = 'X'.
GRID_TAB-NO_ZERO = 'X'.
GRID_TAB-TABNAME = 'T_FINAL'.
APPEND GRID_TAB.
CLEAR GRID_TAB.
CNT1 = CNT1 + 1.
GRID_TAB-COL_POS = CNT1.
GRID_TAB-SELTEXT_L = 'Quantity'.
GRID_TAB-FIELDNAME = 'MENGE'.
GRID_TAB-KEY = 'X'.
GRID_TAB-NO_ZERO = 'X'.
GRID_TAB-TABNAME = 'T_FINAL'.
APPEND GRID_TAB.
CLEAR GRID_TAB.
CNT1 = CNT1 + 1.
GRID_TAB-COL_POS = CNT1.
GRID_TAB-SELTEXT_L = 'Pending Days'.
GRID_TAB-FIELDNAME = 'PDAYS'.
GRID_TAB-KEY = 'X'.
GRID_TAB-NO_ZERO = 'X'.
GRID_TAB-TABNAME = 'T_FINAL'.
APPEND GRID_TAB.
CLEAR GRID_TAB.
CNT1 = CNT1 + 1.
GRID_TAB-COL_POS = CNT1.
GRID_TAB-SELTEXT_L = 'Value'.
GRID_TAB-FIELDNAME = 'PVAL'.
GRID_TAB-KEY = 'X'.
GRID_TAB-NO_ZERO = 'X'.
GRID_TAB-TABNAME = 'T_FINAL'.
APPEND GRID_TAB.
CLEAR GRID_TAB.
CNT1 = CNT1 + 1.
GRID_TAB-COL_POS = CNT1.
GRID_TAB-SELTEXT_L = 'Cumulative Quantity'.
GRID_TAB-FIELDNAME = 'CQTY'.
GRID_TAB-KEY = 'X'.
GRID_TAB-NO_ZERO = 'X'.
GRID_TAB-TABNAME = 'T_FINAL'.
APPEND GRID_TAB.
CLEAR GRID_TAB.
CNT1 = CNT1 + 1.
GRID_TAB-COL_POS = CNT1.
GRID_TAB-SELTEXT_L = 'Value of Cumulative Quantity'.
GRID_TAB-OUTPUTLEN = '30'.
GRID_TAB-FIELDNAME = 'CPRC'.
GRID_TAB-KEY = 'X'.
GRID_TAB-NO_ZERO = 'X'.
GRID_TAB-TABNAME = 'T_FINAL'.
APPEND GRID_TAB.
ENDFORM. " BUILD_FIELD_CATALOG -
Dear All,
I am creating a customised report for showing all the importatnt data (like stock, consumption, production, sale in one report) at client level.
In this report I am required to show the stock of material on a particular date, entered by the user in the selection screen.
(In stanard SAP, report MB5B servers the purpose.)
Can you please suggest how can I get the same information in the customised report.?
(I do not prefer using method: month opening stock + total receipts - total consumption)
Is there any alternative way?
Thanks and regards
SarangHi
The MB5B report gives you all the data, if you donot want some of the data, copy the Report, & from the Output Parameters remove the Fields which you dont want.
if you want the ALV functionality add the same to that.
Thanks & Regards
Kishore -
Material Stock at storage location for particular date!
Dear Friend,
I need a table or bapi which gives stock for particular storage location on particular day. That is MMBE and if you go into detail list (shift+f7). I want same thing.
I have tried in MARD table, but it gives stock of a material for most current date.
Waiting for your early Reply.
Regards,
Bhavin Shahhi check:
MB_ADD_PURCHASE_ORDER_QUANTITY
Regards
Ashok P
Maybe you are looking for
-
When I open safari I get a blank white screen.
When I open safari I get a blank white screen. When I open top sites, and choose google, the screen is still blank, with the search bar at the top a quarter full. If it does open, it suddenly becomes unresponsive and returns to that blank, white scre
-
HT1550 Convert music from reel to reel tapes (Analog) to MP3?
Wanting to convert music accumulated over the years on reel to reel and cassette. Need to see if there is converting this music (Analog) and play it on my destop(Digital).
-
Preview-picture making fix in After Effects CS6 before rendering
Hello guys,I use tutorials for learning after effects cs6...I can't find how I can rendering a preview-picture which will be showed in the ready movieclip. Do we have a possibility for making a special picture/ICON in CS6 before rendering? Greetings
-
I have the Apple docs on "providing assistance ..." and the specs on HTML 4.01 & XHTML 1.0. Since I am writing software just for myself, I don't want to spend megabucks on Dreamweaver or GoLive in order to write help files. Is there a poor man's rout
-
Guys please help me in this problem, my phone is not getting booted, i just updated ios6.1, after updation its not booting