Find opening stock as on date storage locationwise.

Hi,
  Whether below mentioned logic is correct to find out storage locationwise stock.If its wrong please reply.
TABLES : WB2_V_MKPF_MSEG2,MACKW.
  RANGES : O_DATE FOR SY-DATUM.
  DATA : BEGIN OF ITAB OCCURS 0.
        INCLUDE STRUCTURE WB2_V_MKPF_MSEG2.
  DATA : MTART TYPE MACKW-MTART.
  DATA : END OF ITAB.
  DATA : BEGIN OF IT_COL OCCURS 0,
           MATNR_I TYPE WB2_V_MKPF_MSEG2-MATNR_I,
           LGORT_I TYPE WB2_V_MKPF_MSEG2-LGORT_I,
           MENGE_I TYPE WB2_V_MKPF_MSEG2-MENGE_I,
           MEINS_I TYPE WB2_V_MKPF_MSEG2-MEINS_I,
           LGOBE TYPE T001L-LGOBE,
       END OF IT_COL.
  SELECT-OPTIONS:  S_BUKRS FOR WB2_V_MKPF_MSEG2-BUKRS_I,
                 S_WERKS FOR WB2_V_MKPF_MSEG2-WERKS_I,
                 S_MATNR FOR WB2_V_MKPF_MSEG2-MATNR_I,
                 S_MTART FOR MACKW-MTART,
                 S_BUDAT FOR WB2_V_MKPF_MSEG2-BUDAT
                 NO-EXTENSION NO INTERVALS.
O_DATE-SIGN = 'I'.
O_DATE-OPTION = 'BT'.
O_DATE-LOW = '19780218'.
O_DATE-HIGH = S_BUDAT-LOW - 1.
APPEND O_DATE.
START-OF-SELECTION.
SELECT * FROM WB2_V_MKPF_MSEG2 AS A INNER JOIN MACKW
   AS B ON B~MATNR = A~MATNR_I AND B~WERKS = A~WERKS_I
   INTO CORRESPONDING FIELDS OF TABLE ITAB WHERE
   A~MATNR_I IN S_MATNR AND A~WERKS_I IN S_WERKS AND
   A~BUKRS_I IN S_BUKRS AND
   A~BUDAT IN O_DATE AND
   B~MTART IN S_MTART.
  SORT ITAB BY  BUDAT WERKS_I MTART  MATNR_I .
  LOOP AT ITAB.
    IF ITAB-SHKZG_I = 'H'.
      ITAB-MENGE_I = ITAB-MENGE_I * -1.
    ENDIF.
    MODIFY ITAB.
  ENDLOOP.
LOOP AT ITAB.
    MOVE : ITAB-MATNR_I TO IT_COL-MATNR_I,
           ITAB-LGORT_I TO IT_COL-LGORT_I,
           ITAB-MENGE_I TO IT_COL-MENGE_I.
    COLLECT IT_COL.
  ENDLOOP.
LOOP AT IT_COL.
WRITE : / IT_COL-LGORT_I,IT_COL-MATNR_I,IT_COL-MENGE_I.
ENDLOOP.
Regards,
Bathri.
Edited by: Bathrinath Sankaranarayanan on Jun 5, 2009 7:36 PM
Edited by: Bathrinath Sankaranarayanan on Jun 5, 2009 7:38 PM
Moderator message - Please ask a specific question - like I expect results that look like this, but I get this. You are the one that can test this. People on the forum can't do much more than desk check your code for you.
Post locked
Edited by: Rob Burbank on Jun 5, 2009 1:41 PM

Sure - write a program.
Rob

Similar Messages

  • How To Find Opening Stock And Value For a Material

    Hi Experts,
    How To Find Opening Stock And Value For a Material  in Given Dates
    Moderator Message: Search.
    Edited by: kishan P on Sep 15, 2010 4:05 PM

    Thanks For Answering.....
    But I Need Any Function Module To Get Opening Stock And Value For Given Material With in Dates.

  • Report for shedule vs supply and report for opening stock at back date.

    Dear All Guru,
    please can anybody reply me is there any standard report is available for
    1) Report for shedule vs supply
    2) and report for opening stock at back date.(ex- opening stock at last month 16th july or two months back on 10th may
    pl suggest if any standard report is available or how we can data for this
    Regards,
    Vimlesh

    Hi,
    To see the opening stock at a particular date use T.Code: MB5B,
    To see the scheduled quantity & delivered quantity use table EKET with the filed names MENGE & WEMNG.
    Regards,
    Prabu

  • FM To Find Opening Stock

    Is There Any FM To Find Opening Stock in Given Date

    Hi Sreedhar,
    Check BAPI_MATERIAL_AVAILABILITY.
    This function needs to imput Plant, Material number, Unit (usually ST) and Check rule (this is comming from customizing).
    You need to append first entry into WMDVSX table with REQ_DATE = your datum to which you need to know how many
    stocks are confirmed by Disposition. After executing you just read the first entry in the table WMDVEX, in the field
    COM_QTY you can find the quantity confirmed. This works in many of our programs well

  • Stock on posting date -storage location and batch wise

    Dear All
    I need to developa report exactly same as MB5B but with storage location and batch wise.
    We need  storage location wise opening stock, total receipts, total issues and closing stock, and values for given time period.
    I have gone through some history tables like MCHBH and MBEWH.
    But all the history tables are having fileds for period wise but not date wise.
    Any focus on this?

    You have to read the coding of MB5B to see how SAP is doing it.
    The stock per date is calculated, starting from a month end, adding or reducing quantities based on movements until the date in question is reached.

  • 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

  • Table for Stock on Specific Date in the Past.

    Hi ..,
    Please give me the Name of the Table to find the stock on Specific Date for a given material in the Past. like the T.code we use MB5B.
    regards.

    Hi
    MB5B uses a list of tables & logic to get the Stock for a particular posting date.
    if you want the stock run this report in your Z- report & export the Values to your Z-report & use them accordingly.
    Hope this helps
    Thanks & Regards
    Kishore

  • Open stock and closing stock

    Hi
    how to findout open stock for the date and closing stock .

    hi
    good
    DATA : it_mard LIKE mard OCCURS 0 WITH HEADER LINE.
    DATA : BEGIN OF t_mard OCCURS 0 ,
    matnr LIKE mseg-matnr,
    labst LIKE mard-labst,
    END OF t_mard.
    DATA : it_mardh TYPE mardh.
    DATA : buper LIKE t009b-poper,
    gjahr LIKE t009b-bdatj.
    DATA : p_buper LIKE t009b-poper,
    p_gjahr LIKE t009b-bdatj.
    DATA : dt LIKE sy-datum.
    *CLOSING STOCK OF PREVIOUS PERIOD
    dt = sy-datum.
    *get current period
    CALL FUNCTION 'DATE_TO_PERIOD_CONVERT'
    EXPORTING
    i_date = dt
    i_periv = 'M3' "apr to march 4 spl periods
    IMPORTING
    e_buper = buper
    e_gjahr = gjahr
    EXCEPTIONS
    input_false = 1
    t009_notfound = 2
    t009b_notfound = 3
    OTHERS = 4.
    *fetch previous period
    CALL FUNCTION 'CKML_F_GET_PREVIOUS_PERIOD'
    EXPORTING
    input_period = buper
    input_year = gjahr
    input_periv = 'M3'
    IMPORTING
    previous_period = p_buper
    previous_year = p_gjahr.
    SELECT SINGLE * FROM mardh
    WHERE matnr = p_matnr
    AND werks = p_werks
    AND lfmon = p_buper
    AND lfgja = p_gjahr.
    IF sy-subrc = 0.
    CLOSING STOCK = mardh-labst.
    ENDIF.
    *to calculate current stock-----
    SELECT * FROM mard
    INTO CORRESPONDING FIELDS OF TABLE it_mard
    WHERE matnr = it_marc-matnr
    AND werks = p_werks.
    IF NOT it_mard[] IS INITIAL.
    LOOP AT it_mard.
    t_mard-matnr = it_mard-matnr.
    t_mard-labst = it_mard-labst.
    COLLECT t_mard.
    ENDLOOP.
    READ TABLE t_mard INDEX 1.
    CURRENT STOCK= t_mard-labst.
    ENDIF.
    thanks
    mrutyun^

  • Opening stock of a material for each day for a month

    Hi ,
    Is it possible to get a opening stock of a material for each day for a month . For Example for the month of Feb From 01/02/2014 to 28/02/2014 i want to see the opening stock for each day .
    Thanks .
    Message was edited by: Jürgen L

    If you give 01.02.2014 to 28.02.2014 in MB5B report, then you will got the opening stock for 01.02.2014 and closing stock for 28.02.2014...
    the MB5B report designed like that
    It will give you the opening stock for from date and closing stock for end date...
    If you want to see the opening stock per each day, then you have to give the date each date in MB5B report...
    Like as for opening for 02.02.2014, you have to enter the from date as 02.02.2014..
    You can make your own report from copy the existing program RM07MLBD and you can add you additional code...
    Make the program output will be for each day...

  • Storage location wise Opening/Closing Stock on posting date (mb5b)

    Hi,
    Report mb5b gives opening stock and closing stock as on date. In the selection screen, if we do not enter specific storage location then the opening/closing stock is displayed as sum of all storage location stocks for a given material.
    Where as if we enter storage location, it gives storage location specific output. (with Storage loc/batch stock radio button)
    My requirement is - without entering storage location in the initial screen, the system should display storage location specific opening/closing stock.
    To get this, presently I need to execute mb5b transaction individually for every storage location.
    Warm regards,
    MS

    Hi Madhavi
    This report you can have in T code MC.6 and another t code for opening and closing stock in t code MC.9
    Regards
    Vivek
    -- Reward if helpful
    Edited by: Supergene on Feb 28, 2008 3:17 PM

  • 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 Advance

    Dear 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.

  • MB5B - Stock on posting date doesn't show Storage Location field

    Hi All,
    I run report MB5B - Stock on posting date with Stock Types = Storage Loc/Batch Stock, but the report doesn't show
    Storage Location field in result.
    How can I see it in this report?
    Thank you very much for your kind support!
    Cao Huy.

    hi
    what i think i sthis report is only for the OPENINGand CLOSING stock for the period or day
    now whenu give SL field then system will only concider stock from that SL
    the filed of SL will not be viewable in report as it is just opening and closing balance
    regards
    kunal

  • How to find opening or closing stock for a plant

    hi experts,
                    can u help me to know is there any function module to know the opening and closing stocks of plant for particular period per each material type. Or the way to follow to find it

    Hi Kiran,
    You would like to findout opening and closing stock of a particular period and of a particular period....
    If we would like to findout opening and closing stock of material A as of 18 / 8 / 2008,
    then do like this.
    go to MBEW table .. there u get opening stock as on today. Today the date is 20/8/2008. from today's opening stock if we add / subtract the movements which have happened on 19/8/2008 and 18/8/2008 u'll get opening and closing stock as on 18/8/2008.
    U get the movements from MKPF ( material doc header) and MSEG (material doc item ) based on posting date. In MSEG u get movement type.
    If the movement type is 101, it means the stock is added.
    If the movement type is 102, it means the added stock is reversed.
    from today's opening stock deduct the stock with moverment type 101 and add the stock with movement type 102.
    This will give u opening stock as on 18/8/2008.
    To get closing stock of 18/8/2008 ..... the opening stock of 19/8/2008 is 18/8/2008's closing stock.

  • Opening stock will be the closing stock of previous date

    Hi All,
    Good day. I am developing an ALV report that will show opening stock(LABST) as well as closing stock(Calculated) for a range of date and materials. Problem here is that from MARD table I am getting only the last opening stock, because it has no common date field with MSEG table. So, I have to calculate the opening stock as the closing stock of previous date. How can I calculate this? Is there any FM to get the opening stock ?
    Date          Material            Opening St       Closing St
    27.03.2009     2100002          91.000          191.00
    28.03.2009     2100002          191.000          123.00
    29.03.2009     2100002          123.000          103.00
    With regards,
    Tripod.
    Edited by: Tripod on Aug 23, 2011 12:13 PM

    Try not only to use MARD and MKPF/MSEG but also MARDH which contains closing stock of period preceding periods where movements happened. (ie. there is a record for May if a movement happened in June, and none for June if there was no movement in July, and no record exists for August as this is current period) - First look for MARD, MARDH records; and then only read MKPF/MSEG from last MARDH record found. (created back to 4.5A - [Material Master (Industry/Retail): Enhancements to Period Closing|http://help.sap.com/saphelp_45b/helpdata/en/35/b0e7ef87a62488e10000009b38f9b7/content.htm])
    Regards,
    Raymond

  • Sales order stock and storage location stock on past date with value

    Hi everyone.
    I m looking for a report which can give sales order stock with value as it is shown in mb5b and storage location stock with value as in mc.5 is there any report which can give the combination of both the things on past date with values.

    can you tell me what shall be the fields and table for special stock on past date with value and sloc stock on past date with value

Maybe you are looking for

  • Can I change the default "Save As" options?

    When I have finished a document and press "Save As"  the defalt is the Template name and the Folder is "My Templates" so i often end up saving a document as a template - very annoying?  Is there anyway I can change the setting so that the default fol

  • Delete blog in iweb which acts as index to whole website

    Does anyone know if I can delete one of my blogs on my website which acts as the opening page of the site, in other words as the index? My files got corrupted, and although I've gone to .mac and downloaded the whole site, I can't make iWeb see the fu

  • App to show app file sizes in flash memory?

    Is there an app in the store that shows the file sizes of all apps I've downloaded? I can't find one, but I'm often blind. As I run out of space, I'd like to delete big apps that I don't care much about any more, but I don't know which are big. Thank

  • Need Solution on Forms Customization

    Hi All, We are trying to insert a record in the custom table while Clicking of "Submit" So We have written the code in WHEN-BUTTON-PRESSED trigger of "Submit" Buttton. but when we click on submit button the record is inserted properly but it is showi

  • Help! i can't see my files that i saved with my PC..and open in MAC

    Does anyone know..how come i dont see my files that i saved with my PC..and open in MAC?