Report on current stock and safety stock

Hi,
I want to have the report on current stock and safety stock.
In MC.9 it gives wrong safety stock. When I go to cross check the safety stock in material master & in MC.9 I see differences.
Thanks,
Kiran

You can user tcode MC.9 or MC.5 to know valuated stock available at given plant. Stock lying in Returns (MB52) will not be a part of this report as it non-valuated stock.
The stock in the accounting view of the material master considers stock at plant level including stock in Transit (Intra & Inter plant stock trasnfers) & special stock like stock issued to vendor , consigment stock etc which is valuated at plant level.
whereas and stock in the plant stock view of the material master does not consider such special stocks hence there will always difference in both veiws.
For Physical stock as on particular date you can consider MB5B report with radio button "Storage location/Batch Stock" wherein you will get Quantity issued & Qunatity received in those SLOC along with Opening stock & Closing stock for the specified period.
use tcode
MBLB to know stock at vendor.
MB54 - Consignment Stock.

Similar Messages

  • MB5B Report table for Open and Closing stock on date wise

    Hi Frds,
    I am trying get values of Open and Closing stock on date wise form the Table MARD and MBEW -Material Valuation but it does not match with MB5B reports,
    Could anyone suggest correct table to fetch the values Open and Closing stock on date wise for MB5B reports.
    Thanks
    Mohan M

    Hi,
    Please check the below links...
    Query for Opening And  Closing Stock
    Inventory Opening and Closing Stock
    open stock and closing stock
    Kuber

  • Report on pending order qty,opening stock, and closing stock

    Any standard Report available on pending order qty against opening stock, and closing stock.
    Points assured
    Mohan

    Hi Mohan
    There is no report in standard SAP for stock in transit that is what you are refering to Pending order Qty & opening stock.
    You can get report in ME2M, ME2L for pending PO's.
    In MD04 you will get all these stock, PO Qty, & Closing stock but this is for individual material this has to be made customized report in reporting format same thing we have done in one of our project.
    Regards

  • Automatic reorder point and safety stock caluclation- MRP type:V2

    Hi,
    I want the system to calculate reorder point and safety stock. To simulate this i created one material with
    MRP type:V2, service level as 97%, Forecast model:D,Hist. period:12,Forecast periods:12, and I entered
    the historical value for past 12 months as 100 nos in material master.
    04.2009     100
    03.2009     100
    02.2009     100
    01.2009     100
    12.2008     100
    11.2008     100
    10.2008     100
    09.2008     100
    08.2008     100
    07.2008     100
    06.2008     100                 
    05.2008      100                
    Then I went to MP30 and executed the forcase.When I checkd the material master the system has calculated the reorder point as 14 nos. But there is no value updated in safety stock field.
    Now I have two questions.
    1) How the system has arrived the reorder point value as 14 nos.
    2) Why there is no safety stock updated in material master.
    Could u please clarify this.
    Thanks and Regards
    Purushothaman

    Hi,
    This is further to my preivous mail. I have changed the consumption values and now i am getting the safety stock.
    MRP type:V2, service level as 97%, Forecast model:D,Hist. period:12,Forecast periods:12, and I entered
    the historical value for past 12 months as.
    04.2009     100
    03.2009     80
    02.2009     110
    01.2009     85
    12.2008     90
    11.2008     95
    10.2008     125
    09.2008     90
    08.2008     90
    07.2008     92
    06.2008     101
    05.2008     100
    After executing the forecase the sytem has calculated the below parameter.
    Basic value:95.759
    MAD:11.448
    Safety stock:10.252
    Reorder point:23.658.
    Can anyone explain me how these calculation arrived.
    Thanks and regards
    Purushothaman

  • Negative stock and Stock below safety stock

    Hi,
    Both negative stock and stock below safety stock create procurement proposals - internal or external.
    But what is the difference between them?
    Thanks in advance.

    Hi,
    NEGATIVE STOCK:
       Negative stock function used when you want to post Goods Issue quantity that larger than the book quantity.
    For example: you have stock of material A000 = 90 qty and you want to Goods Issue with 100 qty.
    Negative stock function is not relevant for the procurement, It can only use for the excess qty issue to to the production than stock qty. System will not create PR .
    You need to do configuration setting to use this function.
    Cust: In customizing negative stock are must allow for a valuation area, Plant and Storage location level.
              In addition you can set the special stock at plant level such as
    Consignment
    Material provided to vendor
    consignment stock at customer
    sales order stock
    project stock
    returnable packaging with customer
    returnable transport packaging
    Application: The indicator for negative stock is with the storage data in the material master mast be maintained.
    Note: It is possible for unrestricted use and blocked stock only.
    With the standard price, There are no special features to the negative stock. But with the Moving average price , a price diff account can be posted to when goods are received.
    STOCK BELOW SAFETY STOCK.
    The Safety stock should cover any excess material consumption that may occur during the replenishment lead time as well as the normal requirements when deliveries delayed.
    The Safety stock is therefore part of reorder point.
    You do not required any special setting to use safety function. Just need to maintain the safety stock level in the material master.
    If stock reduce below safety stock, system will create procurement  proposal i.e Planned order or Purchase requisition.
    I hope it will clear your query.
    Ashish Panchal

  • Overview of AR Invoice and Safety Stock API

    Hello experts,
    I am new to oracle apps. Please send the me overview of AR Invoice and Safety stock API in inventory.
    Thanks a ton in advance.
    Kumar

    Soni,
    Please see (Note: 296559.1 - FAQ: Common Tracing Techniques within the Oracle Applications 11i/R12). Since you run the API from SQL*Plus/TOAD, follow the steps under "d. Note that a similar technique can be used for enabling trace with binds for a user in SQL*Plus" section to generate the trace file, and the steps under the TKPROF section to generate the TKPROF file.
    Thanks,
    Hussein

  • Safety stock and safety period

    Can anybody help me in understanding the effect of safety period in MRP..
    CAn anybody give me an explanation with numbers so that i could test and understand..
    Please help me out..

    Dear
    There are plenty of earlier posting on Safety stock and safety periods .
    Safety Stock : This is one kind of Un-restricted stock which will be used to full fill the un-expected damand for any material apart from the normal stock .Safety Stock calcuation depends on requireiment .It can be pre-defined ( manual safety stock -MRP3 view-Safety Stock ) or Automatic Safety Stock based on the MRP Type set up in OMDQ.If you want automatic safety stock , then it will calcuated based on Forecasting view parametrs , forcast model , MAD, BASIC value calcualted wheil excuting Forecasting collectively or individually .
    Safety Stock Calcualtion happend based on following CONDITION :
    1.MRP type should be Forecast Base MRP -VV,VB,VS,V1,V2.Here MRP type calculates the Automatic Safety stock based on the Forcasting View Maintained in MM02 with proper Consumption History .( 261,501 etc update control in MMR through OMJJ set up --Please check MMR Forcasting View -Cosnumption Histry at least 6 months are there or not ?)
    2.In MRP Type -SPRO-MRP-Check MRP Type -Select any one of the MRP Type like VV , you will find that Calcualtion of Reo-Order Point and Safety Stock Check Box Ticked .Based this set up and above Forcasting view , safety Stock will be calcualted with certain formaul .Here in the Material Master MRP3 view u need to maintain Service Level Percentage of that Material whcih will be consideredr as Service level factor to calcvualte the Safety Stock automatically based on the MAD and Basic Values calcualtion in Forcating View Individually (MM02) or collectively in MP38 .
    Hope this above facts will help you to understand the calcualtrion of Safety Stock .
    Formula : Safety Stock = R x Sq.rt. W x MAD
    Safety Stock = R x W x MAD
    Refer our earlier posting on the similar issues :
    Automatic reorder point calculation
    safety stock and min safety stock
    Hope it clarifies
    Regards
    JH
    Edited by: Jiaul Haque on Feb 21, 2011 10:31 AM

  • Static or Dynamic Reorder Point and Safety Stock

    Hi,
    In a retail scenario, what would be the advantages over the other of setting a static or dynamic reorder point and safety stock?
    The MRP type used is Time Phased Planning, but whether to let the system automatically set the reorder point and safety stock is the question. What should be considered in implementing this?
    Regards,
    Lee

    hi,
    As far as i know is static means manual entry of reorder point.
    The dynamic or automatic reorder point is used for Forecast based planning...
    the sysstem wii automatically calculate the reoder point evrytime there is the forecast run.
    So, it dependig on ur scenario , select either manual or automatic.
    First entry for both is always manual entry....
    hope u got this..
    Regards,
    Smitha

  • Opening Stock and Closing Stock Calculation

    Hi,
         My report requirement is to display the material, opening stock for the lower date, closing stock for the higher date and the in between all stock operations..how to fetch the opening stock and closing stock for a particular  material ???.. what are the tables and fields for calculating them??..
    Thanks,
    Sri
    Edited by: Sri on Feb 13, 2009 8:33 AM

    Hi
    We have done a similar reports. One showing opening stock/Closing stock and another one showing all the transactions for a particular day. What we did was we developed a program to fetch data from MARD table for unrestricted, blocked & Qulaity stock(Our requirement talks only about these 3 stocks). And we scheduled the program exactly at system time 00.00 hrs with A class job.(today's closing day stock is nothing but tomorrow's opening stock)
      And for the second report which needs to pick all the transaction for a particular day, we picked it from MB51 entries. It is nothing but query between MKPF and MSEG.
    I hope this helps.

  • Opening Stock and Closing Stock

    Hi,
      I have one requirement to get a opening stock and closing stock of all materials,  based on the plant date and mat type.
    Could u tell me the flow of tables one by one
    Its is possible to get the opening stock and closing stock of all materials.
    Please Guide Me.
    Thanks & Regards,
        Dhanush.S.T

    go through this....
    *& Report  Z_OPEN_CLOSE                                                *
    REPORT  Z_OPEN_CLOSE MESSAGE-ID YW2 LINE-SIZE 231 LINE-COUNT 45
    NO STANDARD PAGE HEADING.
    Type Declaration *
    TYPE-POOLS SLIS.
    Tables *
    TABLES: MKPF, " Material Document: Header Data
            MSEG, " Material Document: Item Data
            MARA,
            MARD,
            S031,
            EKKO,
            EKPO,
            LIKP,
            MAKT,
            J_1IWRKCUS,
            T001W,
            WB2_V_MKPF_MSEG2,
            MMIM_REP_PRINT,
            YW2_STKMOVEMENTS,
            YPLNT,
            MARDH.
    Internal Tables *
    DATA: I_WERKS LIKE J_1IWRKCUS OCCURS 0 WITH HEADER LINE.
    DATA: BEGIN OF I_YPLNT OCCURS 0,
             PPLNT LIKE YPLNT-PPLNT,
             WPLNT LIKE YPLNT-WPLNT,
          END OF I_YPLNT.
    DATA: BEGIN OF I_MKPF OCCURS 0,
            MBLNR LIKE MKPF-MBLNR,
            MJAHR LIKE MKPF-MJAHR,
            BUDAT LIKE MKPF-BUDAT,
            VGART LIKE MKPF-VGART,
            BWART LIKE MSEG-BWART,
            MATNR LIKE MSEG-MATNR,
            WERKS LIKE MSEG-WERKS,
            LGORT LIKE MSEG-LGORT,
            MENGE LIKE MSEG-MENGE,
            MEINS LIKE MSEG-MEINS,
            KUNNR LIKE MSEG-KUNNR,
            ZEILE LIKE MSEG-ZEILE,
            XAUTO LIKE MSEG-XAUTO,
            SHKZG LIKE MSEG-SHKZG,
            MATNR1 LIKE MSEG-MATNR,
          END OF I_MKPF.
    DATA: BEGIN OF I_MARDH OCCURS 0,
           WERKS LIKE MARDH-WERKS,
           MEINS LIKE MARA-MEINS,
           MATNR LIKE MARDH-MATNR,
           LGORT LIKE MARDH-LGORT,
           LABST LIKE MARDH-LABST,
           LFGJA LIKE MARDH-LFGJA, "Added -MB
           LFMON LIKE MARDH-LFMON, "Added -MB
           PERIO(6),
           INSME LIKE MARDH-LABST,
           EINME LIKE MARDH-LABST,
           SPEME LIKE MARDH-LABST,
           RETME LIKE MARDH-LABST,
           O_STK LIKE MARDH-LABST, " Opening Stock
           C_STK LIKE MARDH-LABST, " Closing Stock
          END OF I_MARDH.
    DATA: BEGIN OF I_MARD OCCURS 0,
           WERKS LIKE MARD-WERKS,
           MATNR LIKE MARD-MATNR,
           LGORT LIKE MARD-LGORT,
           LABST LIKE MARD-LABST,
           INSME LIKE MARD-LABST,
           MEINS LIKE MARA-MEINS,
           EINME LIKE MARD-LABST,
           SPEME LIKE MARD-LABST,
           RETME LIKE MARD-LABST,
          END OF I_MARD.
    DATA: I_MARD1 LIKE I_MARD OCCURS 0 WITH HEADER LINE.
    DATA: I_MARDH1 LIKE I_MARDH OCCURS 0 WITH HEADER LINE.
    DATA: BEGIN OF I_MKPF1 OCCURS 0,
            MBLNR LIKE MKPF-MBLNR,
            WERKS LIKE MSEG-WERKS,
            MATNR LIKE MSEG-MATNR,
            BUDAT LIKE MKPF-BUDAT,
            BWART LIKE MSEG-BWART,
            MJAHR LIKE MKPF-MJAHR,
            VGART LIKE MKPF-VGART,
            LGORT LIKE MSEG-LGORT,
            MENGE LIKE MSEG-MENGE,
            MEINS LIKE MSEG-MEINS,
            XAUTO LIKE MSEG-XAUTO,
            SHKZG LIKE MSEG-SHKZG,
          END OF I_MKPF1.
    DATA: BEGIN OF I_MKPF2 OCCURS 0,
           WERKS LIKE MSEG-WERKS,
           MATNR LIKE MSEG-MATNR,
           BUDAT LIKE MKPF-BUDAT,
           BWART LIKE MSEG-BWART,
           MJAHR LIKE MKPF-MJAHR,
           VGART LIKE MKPF-VGART,
           LGORT LIKE MSEG-LGORT,
           MENGE LIKE MSEG-MENGE,
           MEINS LIKE MSEG-MEINS,
           XAUTO LIKE MSEG-XAUTO,
         END OF I_MKPF2.
    DATA: BEGIN OF I_FINAL5 OCCURS 0,
           WERKS LIKE MSEG-WERKS, " Plant
           MATNR LIKE MSEG-MATNR, " Material
           LGORT LIKE MSEG-LGORT, " Storage Location
           BUDAT LIKE MKPF-BUDAT, " Posting Date
           MTART LIKE MARA-MTART, " Material Type
           SPMON LIKE S031-SPMON, " Month
           MAKTX LIKE MAKT-MAKTX, " Description
    meins(3), " UOM
            MEINS LIKE MSEG-MEINS,
            O_STK LIKE MARDH-LABST, " opening stock
            TRECEP LIKE MARDH-LABST, " total receipts
            PRODU LIKE MARDH-LABST, " Net Receipts - Production
            RECEP LIKE MARDH-LABST, " Net Receipts - Receipts
            SAL_RET LIKE MARDH-LABST, " Net Receipts - Sales Return
            TDISP LIKE MARDH-LABST, " total dispatches
            CUSTMR LIKE MARDH-LABST, " Net Dispatches - Customers
            OPLANT LIKE MARDH-LABST, " Net Dispatches - To Other Plant
            TLOSS LIKE MARDH-LABST, " Total Loss
            TRLOSS LIKE MARDH-LABST, " Transit Loss
            WHLOSS LIKE MARDH-LABST, " Warehouse Loss
            C_STK LIKE MARDH-LABST, " Closing Stock
            TRFSTK LIKE MARDH-LABST, "Transfer stock
            MENGE LIKE MSEG-MENGE,
            OTHADJ LIKE MARDH-LABST,
          END OF I_FINAL5.
    DATA: BEGIN OF I_FINAL OCCURS 0,
            WERKS LIKE MSEG-WERKS, " Plant
            MATNR LIKE MSEG-MATNR, " Material
            BUDAT LIKE MKPF-BUDAT, " Posting Date
            MTART LIKE MARA-MTART, " Material Type
            SPMON LIKE S031-SPMON, " Month
            MAKTX LIKE MAKT-MAKTX, " Description
    meins(3), " UOM
            MEINS LIKE MSEG-MEINS,
            O_STK LIKE MARDH-LABST, " opening stock
            TRECEP LIKE MARDH-LABST, " total receipts
            PRODU LIKE MARDH-LABST, " Net Receipts - Production
            RECEP LIKE MARDH-LABST, " Net Receipts - Receipts
            SAL_RET LIKE MARDH-LABST, " Net Receipts - Sales Return
            TDISP LIKE MARDH-LABST, " total dispatches
            CUSTMR LIKE MARDH-LABST, " Net Dispatches - Customers
            OPLANT LIKE MARDH-LABST, " Net Dispatches - To Other Plant
            TRFSTK LIKE MARDH-LABST, "Material Transfer stock
            TRLOSS LIKE MARDH-LABST, " Transit Loss
            WHLOSS LIKE MARDH-LABST, " Warehouse Loss
            TLOSS LIKE MARDH-LABST, " Total Loss
            C_STK LIKE MARDH-LABST, " Closing Stock
            OTHADJ LIKE MARDH-LABST,
           END OF I_FINAL.
    DATA: I_FINAL1 LIKE I_FINAL OCCURS 0 WITH HEADER LINE.
    DATA: BEGIN OF I_FINAL_TEMP OCCURS 0,
            WERKS LIKE MSEG-WERKS, " Plant
            MATNR LIKE MSEG-MATNR, " Material
            MTART LIKE MARA-MTART, " Material Type
            MAKTX LIKE MAKT-MAKTX, " Description
            MEINS LIKE MSEG-MEINS,
            O_STK LIKE MARDH-LABST, " opening stock
            TRECEP LIKE MARDH-LABST, " total receipts
            PRODU LIKE MARDH-LABST, " Net Receipts - Production
            RECEP LIKE MARDH-LABST, " Net Receipts - Receipts
            SAL_RET LIKE MARDH-LABST, " Net Receipts - Sales Return
            TDISP LIKE MARDH-LABST, " total dispatches
            CUSTMR LIKE MARDH-LABST, " Net Dispatches - Customers
            OPLANT LIKE MARDH-LABST, " Net Dispatches - To Other Plant
            TRFSTK LIKE MARDH-LABST, "Material Transfer stock
            TRLOSS LIKE MARDH-LABST, " Transit Loss
            WHLOSS LIKE MARDH-LABST, " Warehouse Loss
            TLOSS LIKE MARDH-LABST, " Total Loss
            C_STK LIKE MARDH-LABST, " Closing Stock
            OTHADJ LIKE MARDH-LABST,
          END OF I_FINAL_TEMP.
    For Materials
    DATA: BEGIN OF I_MARA OCCURS 0,
           MATNR TYPE MARA-MATNR,
           MTART TYPE MARA-MTART,
           MEINS LIKE MARA-MEINS,
           LABST TYPE MARD-LABST,
           MAKTX LIKE MAKT-MAKTX,
          END OF I_MARA.
    DATA: BEGIN OF I_STKMVMNTS OCCURS 0,
           BWART LIKE MSEG-BWART,
           SHKZG LIKE MSEG-SHKZG,
           VZBEW LIKE YW2_STKMOVEMENTS-VZBEW,
          END OF I_STKMVMNTS.
    DATA: BEGIN OF I_FINALT OCCURS 0,
           WERKS LIKE MSEG-WERKS, " Plant
           MATNR LIKE MSEG-MATNR, " Material
           BUDAT LIKE MKPF-BUDAT, " Posting Date
           MTART LIKE MARA-MTART, " Material Type
           SPMON LIKE S031-SPMON, " Month
           MAKTX LIKE MAKT-MAKTX, " Description
    meins(3), " UOM
           MEINS LIKE MSEG-MEINS,
           O_STK LIKE MARDH-LABST, " opening stock
           TRECEP LIKE MARDH-LABST, " total receipts
           PRODU LIKE MARDH-LABST, " Net Receipts - Production
           RECEP LIKE MARDH-LABST, " Net Receipts - Receipts
           SAL_RET LIKE MARDH-LABST, " Net Receipts - Sales Return
           TDISP LIKE MARDH-LABST, " total dispatches
           CUSTMR LIKE MARDH-LABST, " Net Dispatches - Customers
           OPLANT LIKE MARDH-LABST, " Net Dispatches - To Other Plant
           TRFSTK LIKE MARDH-LABST, "Material Transfer stock
           TRLOSS LIKE MARDH-LABST, " Transit Loss
           WHLOSS LIKE MARDH-LABST, " Warehouse Loss
           TLOSS LIKE MARDH-LABST, " Total Loss
           C_STK LIKE MARDH-LABST, " Closing Stock
           OTHADJ LIKE MARDH-LABST,
           MONTH(8) ,
          END OF I_FINALT.
    DATA: IMKPFT LIKE I_MKPF OCCURS 0 WITH HEADER LINE.
    DATA: IMKPFT1 LIKE I_MKPF1 OCCURS 0 WITH HEADER LINE.
    DATA: IMARDT LIKE I_MARD OCCURS 0 WITH HEADER LINE.
    DATA: IMARDHT LIKE I_MARDH OCCURS 0 WITH HEADER LINE.
    DATA: T_FINAL LIKE I_MKPF OCCURS 0 WITH HEADER LINE.
    DATA: IMKPFT2 LIKE I_MKPF OCCURS 0 WITH HEADER LINE.
    FCAT is used for the field catalog
    DATA: FCAT TYPE TABLE OF SLIS_FIELDCAT_ALV WITH NON-UNIQUE DEFAULT KEY
                      WITH HEADER LINE INITIAL SIZE 0,
    for excluding the ICONs from the application toolbar
          FEXC TYPE TABLE OF SLIS_EXTAB WITH NON-UNIQUE DEFAULT KEY
                     WITH HEADER LINE INITIAL SIZE 0,
    FS_LAYO is used for Grid Layout
          FS_LAYO TYPE SLIS_LAYOUT_ALV,
    FEVENTS to handle the events TOP OF PAGE & USER_COMMAND
          FEVENTS TYPE TABLE OF SLIS_ALV_EVENT WITH NON-UNIQUE DEFAULT KEY
                     WITH HEADER LINE INITIAL SIZE 0,
    FHEADER is used for List header
          FHEADER TYPE TABLE OF SLIS_LISTHEADER WITH NON-UNIQUE DEFAULT KEY
                     WITH HEADER LINE INITIAL SIZE 0,
    sort is used for sorting
          FSORT TYPE TABLE OF SLIS_SORTINFO_ALV WITH NON-UNIQUE DEFAULT KEY
                     WITH HEADER LINE INITIAL SIZE 0,
          FCAT1 TYPE TABLE OF SLIS_FIELDCAT_ALV WITH NON-UNIQUE DEFAULT KEY
                    WITH HEADER LINE INITIAL SIZE 0,
          FS_LAYO1 TYPE SLIS_LAYOUT_ALV,
          GT_LIST_TOP_OF_PAGE1 TYPE SLIS_T_LISTHEADER,
          FEVENTS1 TYPE TABLE OF SLIS_ALV_EVENT WITH NON-UNIQUE DEFAULT KEY
                 WITH HEADER LINE INITIAL SIZE 0,
           FHEADER1 TYPE TABLE OF SLIS_LISTHEADER WITH NON-UNIQUE DEFAULT  
                  KEY WITH HEADER LINE INITIAL SIZE 0,
           G_STATU_071 TYPE SLIS_FORMNAME VALUE 'Z_PFSTATUS',
           ALV_VARIANT1 LIKE DISVARIANT.
    Variable Declaration *
    TYPES: TRFF_TYPE_DEC_6_5(6) TYPE P DECIMALS 5.
    DATA: FYEAR(4),
          MON(2),
          FYEAR1(4),
          MON1(2),
          OBAL LIKE MARD-LABST,
          CBAL LIKE MARD-LABST,
          INDEX TYPE I,
          COUNT,
          COUNT1 TYPE I,
          O_STK TYPE P DECIMALS 3,
          C_STK TYPE P DECIMALS 3,
          V_MJAHR LIKE MKPF-MJAHR,
          MONTHS TYPE TRFF_TYPE_DEC_6_5,
          MONTH TYPE I.
    Global variables for handling ALV functionality
    DATA: ALV_KEYINFO TYPE SLIS_KEYINFO_ALV,
          ALV_VARIANT LIKE DISVARIANT,
          ALV_LAYOUT TYPE SLIS_LAYOUT_ALV,
          ALV_REPID LIKE SY-REPID,
          ALV_PRINT TYPE SLIS_PRINT_ALV,
          ALV_DETAIL_FUNC(30),
          ALV_DEFAULT_VARIANT LIKE DISVARIANT-VARIANT,
          ALV_COLOURIZE_FIELDS LIKE MMIM_REP_PRINT-COLOR.
    RANGES: R_BUDAT FOR MKPF-BUDAT.
    *Added by Prabhu for year on 26.4.05.
    DATA: IDATE LIKE R_BUDAT OCCURS 0 WITH HEADER LINE.
    Selection Screen Elements *
    SELECTION-SCREEN BEGIN OF BLOCK BLK WITH FRAME TITLE TEXT-001.
      SELECT-OPTIONS: S_WERKS FOR MARD-WERKS OBLIGATORY NO INTERVALS.
      PARAMETER: P_SPMON LIKE S031-SPMON NO-DISPLAY .
      SELECT-OPTIONS: S_MATNR FOR MARA-MATNR OBLIGATORY,
                      S_LGORT FOR MSEG-LGORT NO-EXTENSION NO INTERVALS,
                      S_MBLNR FOR MKPF-MBLNR,
                      S_BUDAT FOR MKPF-BUDAT OBLIGATORY .
    SELECTION-SCREEN END OF BLOCK BLK.
    SELECTION-SCREEN BEGIN OF BLOCK BLK3 WITH FRAME TITLE TEXT-004.
          PARAMETER : MTART LIKE MARA-MTART DEFAULT 'FERT' NO-DISPLAY.
    SELECTION-SCREEN END OF BLOCK BLK3.
    SELECTION-SCREEN BEGIN OF BLOCK BLK2 WITH FRAME TITLE TEXT-003.
    SELECTION-SCREEN END OF BLOCK BLK2.
    ADDED BY PRABHU FOR DAY-WISE REPORT.
    SELECTION-SCREEN BEGIN OF BLOCK B3 WITH FRAME TITLE TEXT-007.
      PARAMETERS: D1 RADIOBUTTON GROUP P1 DEFAULT 'X',
                  M1 RADIOBUTTON GROUP P1,
                  Y1 RADIOBUTTON GROUP P1.
    SELECTION-SCREEN END OF BLOCK B3.
    SELECTION-SCREEN BEGIN OF BLOCK B2 WITH FRAME TITLE TEXT-006.
    PARAMETERS: ALV_DEF LIKE DISVARIANT-VARIANT.
    SELECTION-SCREEN END OF BLOCK B2.
    DATA: S_BUDAT1 LIKE S_BUDAT OCCURS 0 WITH HEADER LINE."prabhu
    Initialization *
    INITIALIZATION.
      PERFORM ALV_INIT.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR ALV_DEF.
      PERFORM ALV_F4.
    At Selection Screen
    *AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_spmon.
    PERFORM monat_f4.
    At Selection Screen *
    AT SELECTION-SCREEN.
    checking for the layout
      PERFORM ALV_CHECK.
    authorisation check for the Plant
    PERFORM auth_check.
    Validation for the Plant
      PERFORM VALIDITY_CHECK.
      IF MTART NE 'FERT'.
        MESSAGE E041 WITH 'Material Type must be FERT Only...'.
      ENDIF.
      IF D1 = 'X'." On 26.4.05.
        P_SPMON0(4) = S_BUDAT-LOW0(4).
        P_SPMON4(2) = S_BUDAT-LOW4(2).
      ELSE.
        P_SPMON0(4) = S_BUDAT-LOW0(4).
        P_SPMON4(2) = S_BUDAT-LOW4(2).
      ENDIF.
      LOOP AT S_BUDAT.
        IF S_BUDAT-HIGH IS INITIAL.
          S_BUDAT-HIGH = S_BUDAT-LOW.
          MODIFY S_BUDAT.
        ENDIF.
      ENDLOOP.
      IDATE-LOW = S_BUDAT-LOW.
      IDATE-HIGH = S_BUDAT-HIGH.
      CALL FUNCTION 'FIMA_DAYS_AND_MONTHS_AND_YEARS'
        EXPORTING
           I_DATE_FROM = IDATE-LOW
           I_DATE_TO = IDATE-HIGH
       IMPORTING
    E_DAYS =
          E_MONTHS = MONTH
    E_YEARS =
      DATA: I(3) TYPE C.
      I = S_BUDAT-LOW+4(2).
      CLEAR: R_BUDAT.
      REFRESH: R_BUDAT.
    *added by Prabhu for Only for Oneday.on 18.5.5
      IF MONTH EQ '0'.
        MONTH = MONTH + 1.
      ENDIF.
    *added by Prabhu for Only for Oneday.on 18.5.5
      DO MONTH TIMES.
        R_BUDAT-LOW = S_BUDAT-LOW.
        APPEND R_BUDAT.
      ENDDO.
      I = 0.
      LOOP AT R_BUDAT.
        R_BUDAT-LOW4(2) = S_BUDAT-LOW4(2) + I.
        I = I + 1.
        R_BUDAT-LOW+6(2) = '01'.
        MODIFY R_BUDAT.
      ENDLOOP.
      LOOP AT R_BUDAT.
        CALL FUNCTION 'RP_LAST_DAY_OF_MONTHS'
           EXPORTING
             DAY_IN = R_BUDAT-LOW
           IMPORTING
             LAST_DAY_OF_MONTH = R_BUDAT-HIGH
          EXCEPTIONS
            DAY_IN_NO_DATE = 1
            OTHERS = 2
        MODIFY R_BUDAT.
      ENDLOOP.
      LOOP AT R_BUDAT.
        IF R_BUDAT-LOW4(2) = S_BUDAT-LOW4(2).
          R_BUDAT-LOW = S_BUDAT-LOW.
          MODIFY R_BUDAT.
        ENDIF.
        IF R_BUDAT-HIGH4(2) = S_BUDAT-HIGH4(2).
          R_BUDAT-HIGH = S_BUDAT-HIGH.
          MODIFY R_BUDAT.
        ENDIF.
    For Summary on 26.4.05.
        IF Y1 = 'X'.
          CLEAR R_BUDAT.
          REFRESH R_BUDAT.
          R_BUDAT-LOW = S_BUDAT-LOW.
          R_BUDAT-HIGH = S_BUDAT-HIGH.
          APPEND R_BUDAT.
          CLEAR R_BUDAT.
        ENDIF.
      ENDLOOP.
    At Selection Screen *
    AT SELECTION-SCREEN OUTPUT.
    Start of Selection *
    START-OF-SELECTION.
      V_MJAHR = P_SPMON+0(4).
    Get plant distinction warehouse/production
      PERFORM GET_PLANT_DISTINCTION.
    Collect the data from various tables
      PERFORM GETDATA_FG_STOCK.
    here the number of rows in the output table is found
      PERFORM OUTPUT_TABLE_CHECK.
    here the top of the page code is written, that is to be displayed
    in the output
      PERFORM Z_TOP_OF_PAGE.
    here ALV layout properties are set
      PERFORM Z_LAYOUT_SETTINGS.
    ALV EVENTS for TOP OF PAGE and for USER COMMAND
      PERFORM Z_ALV_EVENTS.
    The field catalog is defined for the Primary List is defined in
    the subroutine CREATE_FIELD_CATALOG include program ZPRRDOCR_FCAT
      PERFORM Z_CREATE_FIELD_CATALOG.
    This is for displaying the output
      PERFORM Z_REUSE_ALV_GRID_DISPLAY.
    *& Form getdata_fg_stock
    Getting data from standard tables
    FORM GETDATA_FG_STOCK.
    For getting the Start date & end date of the month
    PERFORM get_month_dates.
    Getting the Opening Stock from MARDH table
      IF MON EQ '01'.
        MON1 = MON.
        FYEAR1 = FYEAR.
        MON = '12'.
        FYEAR = FYEAR - 1.
      ELSE.
        MON1 = MON.
        FYEAR1 = FYEAR.
        MON = MON - 1.
        FYEAR = FYEAR.
      ENDIF.
      PERFORM GET_RECORDS_FROM_DB.
    *added for Month Summary on 26.4.05.
      LOOP AT R_BUDAT.
        S_BUDAT-LOW = R_BUDAT-LOW.
        S_BUDAT-HIGH = R_BUDAT-HIGH.
    *for Month
        P_SPMON0(4) = S_BUDAT-LOW0(4).
        P_SPMON4(2) = S_BUDAT-LOW4(2).
    *for summary.
        IF Y1 = 'X'.
          LOOP AT S_BUDAT.
            S_BUDAT1-SIGN = 'I'.
            S_BUDAT1-OPTION = 'NB'.
            S_BUDAT1-LOW = S_BUDAT-LOW.
            S_BUDAT1-HIGH = S_BUDAT-HIGH.
            APPEND S_BUDAT1.
            CLEAR S_BUDAT1.
          ENDLOOP.
        ENDIF.
        IMKPFT[] = I_MKPF[].
        IMKPFT2[] = I_MKPF[].
        IMARDT[] = I_MARD[].
        IMARDHT[] = I_MARDH[].
        PERFORM MONTH_WISE.
        PERFORM PROCESS_MOVEMENTS.
        PERFORM CALCULATE_OPENING_STOCK.
        PERFORM UPDATE_NON_TRANSACTION_ITMS.
        PERFORM DELETE_EMPTY_RECORDS.
        CLEAR: IMARDHT,IMARDT,IMKPFT1,IMKPFT,I_FINAL,I_FINAL5.
        REFRESH: IMARDHT,IMARDT,IMKPFT1,I_FINAL,I_FINAL5,IMKPFT.
      ENDLOOP.
      CLEAR: R_BUDAT.
      REFRESH: R_BUDAT.
    *end of changes for month.
    ENDFORM. " getdata_fg_stock
    FORM MONAT_F4 *
    F4-Hilfe für Monat *
    FORM MONAT_F4.
      DATA: BEGIN OF MF_DYNPFIELDS OCCURS 1.
              INCLUDE STRUCTURE DYNPREAD.
      DATA: END OF MF_DYNPFIELDS.
      DATA: MF_RETURNCODE LIKE SY-SUBRC,
             MF_MONAT LIKE ISELLIST-MONTH,
             MF_HLP_REPID LIKE SY-REPID.
      FIELD-SYMBOLS: .
    Wert von Dynpro lesen
      GET CURSOR FIELD MF_DYNPFIELDS-FIELDNAME.
      APPEND MF_DYNPFIELDS.
      MF_HLP_REPID = SY-REPID.
      DO 2 TIMES.
        CALL FUNCTION 'DYNP_VALUES_READ'
          EXPORTING
            DYNAME               = MF_HLP_REPID
            DYNUMB               = SY-DYNNR
          TABLES
            DYNPFIELDS           = MF_DYNPFIELDS
          EXCEPTIONS
            INVALID_ABAPWORKAREA = 01
            INVALID_DYNPROFIELD  = 02
            INVALID_DYNPRONAME   = 03
            INVALID_DYNPRONUMMER = 04
            INVALID_REQUEST      = 05
            NO_FIELDDESCRIPTION  = 06
            UNDEFIND_ERROR       = 07.
        IF SY-SUBRC = 3.
    Aktuelles Dynpro ist Wertemengenbild
          MF_HLP_REPID = 'SAPLALDB'.
        ELSE.
          READ TABLE MF_DYNPFIELDS INDEX 1.
    Unterstriche durch Blanks ersetzen
          TRANSLATE MF_DYNPFIELDS-FIELDVALUE USING '_ '.
          EXIT.
        ENDIF.
      ENDDO.
      IF SY-SUBRC = 0.
    Konvertierung ins interne Format
        CALL FUNCTION 'CONVERSION_EXIT_PERI_INPUT'
          EXPORTING
            INPUT         = MF_DYNPFIELDS-FIELDVALUE
          IMPORTING
            OUTPUT        = MF_MONAT
          EXCEPTIONS
            ERROR_MESSAGE = 1.
        IF MF_MONAT IS INITIAL.
    Monat ist initial => Vorschlagswert aus akt. Datum ableiten
          MF_MONAT = SY-DATLO(6).
        ENDIF.
        CALL FUNCTION 'POPUP_TO_SELECT_MONTH'
          EXPORTING
            ACTUAL_MONTH               = MF_MONAT
          IMPORTING
            SELECTED_MONTH             = MF_MONAT
            RETURN_CODE                = MF_RETURNCODE
          EXCEPTIONS
            FACTORY_CALENDAR_NOT_FOUND = 01
            HOLIDAY_CALENDAR_NOT_FOUND = 02
            MONTH_NOT_FOUND            = 03.
        IF SY-SUBRC = 0 AND MF_RETURNCODE = 0.
    ASSIGN (MF_DYNPFIELDS-FIELDNAME) TO <MF_FELD>. " ==>> note 148804
    <MF_FELD> = MF_MONAT.
          CALL FUNCTION 'CONVERSION_EXIT_PERI_OUTPUT'
            EXPORTING
              INPUT  = MF_MONAT
            IMPORTING
              OUTPUT = MF_DYNPFIELDS-FIELDVALUE.
          COLLECT MF_DYNPFIELDS.
          CALL FUNCTION 'DYNP_VALUES_UPDATE'
            EXPORTING
              DYNAME               = MF_HLP_REPID
              DYNUMB               = SY-DYNNR
            TABLES
              DYNPFIELDS           = MF_DYNPFIELDS
            EXCEPTIONS
              INVALID_ABAPWORKAREA = 01
              INVALID_DYNPROFIELD  = 02
              INVALID_DYNPRONAME   = 03
              INVALID_DYNPRONUMMER = 04
              INVALID_REQUEST      = 05
              NO_FIELDDESCRIPTION  = 06
              UNDEFIND_ERROR       = 07. "<<== note 148804
        ENDIF.
      ENDIF.
    ENDFORM.                                                    "MONAT_F4
    *& Form get_month_dates
    Calculating the Month Start & End Date
    FORM GET_MONTH_DATES.
      IF M1 = 'X'.
        FYEAR = P_SPMON+0(4).
        MON = P_SPMON+4(2).
        CONCATENATE FYEAR MON '01' INTO R_BUDAT-LOW.
        R_BUDAT-SIGN = 'I'.
        R_BUDAT-OPTION = 'BT'.
        CALL FUNCTION 'BKK_GET_MONTH_LASTDAY'
          EXPORTING
            I_DATE = R_BUDAT-LOW
          IMPORTING
            E_DATE = R_BUDAT-HIGH.
        APPEND R_BUDAT.
        CLEAR S_BUDAT.
        REFRESH S_BUDAT.
        S_BUDAT-SIGN = 'I'.
        S_BUDAT-OPTION = 'BT'.
        S_BUDAT-LOW = R_BUDAT-LOW.
        S_BUDAT-HIGH = R_BUDAT-HIGH.
        APPEND S_BUDAT.
      ELSE.
        FYEAR = P_SPMON+0(4).
        MON = P_SPMON+4(2).
        CONCATENATE FYEAR MON '01' INTO R_BUDAT-LOW.
        R_BUDAT-SIGN = 'I'.
        R_BUDAT-OPTION = 'BT'.
        CALL FUNCTION 'BKK_GET_MONTH_LASTDAY'
          EXPORTING
            I_DATE = R_BUDAT-LOW
          IMPORTING
            E_DATE = R_BUDAT-HIGH.
        APPEND R_BUDAT.
      ENDIF.
    ENDFORM. " get_month_dates
    *& Form output_table_Check
    checking for records for output
    FORM OUTPUT_TABLE_CHECK .
      DESCRIBE TABLE I_FINALT LINES INDEX.
      IF INDEX EQ 0.
        MESSAGE I041 WITH TEXT-005.
        LEAVE LIST-PROCESSING.
      ENDIF.
    ENDFORM. "OUTPUT_TABLE_CHECK
    *& Form Z_TOP_OF_PAGE
    for setting the details in the top of page *
    has no formal paramters *
    FORM Z_TOP_OF_PAGE.
      DATA: V_MON(2),
      V_YR(40),
      V_FIN(18),
      V_FIN1(48),
      LOW(10),
      HIGH(10).
      V_MON = P_SPMON+4(2).
      V_YR = P_SPMON+0(4).
      FHEADER-TYP = 'H'.
      FHEADER-INFO = 'Stock Register Report (FG Stock)'.
      APPEND FHEADER.
      CLEAR FHEADER.
    *if m1 = 'X'.
    CONCATENATE 'Month = ' v_mon '.' v_yr INTO v_fin.
    fheader-typ = 'H'.
    fheader-info = v_fin.
    APPEND fheader.
    CLEAR fheader.
    *endif."prabhu on 18.5.5
      IF D1 = 'X'.
        CLEAR S_BUDAT.
        LOOP AT S_BUDAT.
          CONCATENATE S_BUDAT-LOW6(2) '/' S_BUDAT-LOW4(2) '/'
          S_BUDAT-LOW+0(4) INTO LOW.
          CONCATENATE S_BUDAT-HIGH6(2) '/' S_BUDAT-HIGH4(2) '/'
          S_BUDAT-HIGH+0(4) INTO HIGH.
          CONCATENATE 'Date = ' LOW ' - ' HIGH INTO V_FIN1.
          FHEADER-TYP = 'H'.
          FHEADER-INFO = V_FIN1.
          APPEND FHEADER.
          CLEAR FHEADER.
        ENDLOOP.
      ENDIF.
    ENDFORM. " Z_TOP_OF_PAGE
    *& Form Z_LAYOUT_SETTINGS
    this is done for setting the properties for the layout of the *
    grid *
    has no formal paramters *
    FORM Z_LAYOUT_SETTINGS.
      FS_LAYO-ZEBRA = 'X'. " Output in Zebra pattern
      FS_LAYO-DETAIL_POPUP = 'X'. " A popup window appears to give
      FS_LAYO-DETAIL_TITLEBAR = TEXT-022.
      FS_LAYO-COLWIDTH_OPTIMIZE = 'X'.
    ENDFORM. " Z_LAYOUT_SETTINGS
    *& Form Z_ALV_EVENTS
    This is used for handling the events TOP OF PAGE and the USER *
    COMMAND event *
    has no formal paramters *
    FORM Z_ALV_EVENTS.
      CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
        EXPORTING
          I_LIST_TYPE = 0
        IMPORTING
          ET_EVENTS   = FEVENTS[].
      READ TABLE FEVENTS WITH KEY NAME = 'TOP_OF_PAGE'.
      IF SY-SUBRC = 0.
        FEVENTS-FORM = 'Z_TOPOFPAGE'.
        MODIFY FEVENTS INDEX SY-TABIX.
        CLEAR FEVENTS.
      ENDIF.
      READ TABLE FEVENTS WITH KEY NAME = 'USER_COMMAND'.
      IF SY-SUBRC = 0.
        FEVENTS-FORM = 'Z_USER_COMMAND'.
        MODIFY FEVENTS INDEX SY-TABIX.
        CLEAR FEVENTS.
      ENDIF.
    ENDFORM. "Z_ALV_EVENTS
    *& Form Z_CREATE_FIELD_CATALOG
    here the field catalog is created for the primary list *
    no formal parameters *
    FORM Z_CREATE_FIELD_CATALOG.
    for the Plant
      FCAT-FIELDNAME = 'WERKS'.
      FCAT-KEY = 'X'.
      FCAT-OUTPUTLEN = '000005'.
      FCAT-JUST = 'L'.
      FCAT-SELTEXT_M = 'Plant'.
      FCAT-DDICTXT = 'M'.
      FCAT-INTTYPE = 'C'.
      FCAT-DATATYPE = 'CHAR'.
      APPEND FCAT.
      CLEAR FCAT.
    for the Material Type
      FCAT-FIELDNAME = 'MTART'.
      FCAT-KEY = 'X'.
      FCAT-OUTPUTLEN = '000006'.
      FCAT-JUST = 'L'.
      FCAT-SELTEXT_M = 'MatTyp'.
      FCAT-DDICTXT = 'M'.
      FCAT-INTTYPE = 'C'.
      FCAT-DATATYPE = 'CHAR'.
      APPEND FCAT.
      CLEAR FCAT.
    for the Material No.
      FCAT-FIELDNAME = 'MATNR'.
      FCAT-KEY = 'X'.
    fcat-hotspot = 'X'.
      FCAT-OUTPUTLEN = '000018'.
      FCAT-JUST = 'L'.
      FCAT-SELTEXT_M = 'Material'.
      FCAT-DDICTXT = 'M'.
      FCAT-INTTYPE = 'C'.
      FCAT-DATATYPE = 'CHAR'.
      APPEND FCAT.
      CLEAR FCAT.
    for the Material Description
      FCAT-FIELDNAME = 'MAKTX'.
      FCAT-KEY = ''.
      FCAT-OUTPUTLEN = '000040'.
      FCAT-JUST = 'L'.
      FCAT-SELTEXT_M = 'Description'.
      FCAT-DDICTXT = 'M'.
      FCAT-INTTYPE = 'C'.
      FCAT-DATATYPE = 'CHAR'.
      APPEND FCAT.
      CLEAR FCAT.
    for the Unit of Measure
      FCAT-FIELDNAME = 'MEINS'.
      FCAT-KEY = ''.
      FCAT-OUTPUTLEN = '03'.
      FCAT-JUST = 'C'.
      FCAT-SELTEXT_M = 'UOM'.
      FCAT-DDICTXT = 'M'.
      FCAT-INTTYPE = 'C'.
      FCAT-DATATYPE = 'UNIT'.
      APPEND FCAT.
      CLEAR FCAT.
    for the Plant
      FCAT-FIELDNAME = 'MONTH'.
      FCAT-KEY = 'X'.
      FCAT-OUTPUTLEN = '08'.
      FCAT-JUST = 'L'.
      FCAT-SELTEXT_M = 'MONTH'.
      FCAT-DDICTXT = 'M'.
      FCAT-INTTYPE = 'C'.
      FCAT-DATATYPE = 'CHAR'.
      APPEND FCAT.
      CLEAR FCAT.
    for the Opening Stock
      FCAT-FIELDNAME = 'C_STK'.
      FCAT-HOTSPOT = ' '.
      FCAT-OUTPUTLEN = '000016'.
      FCAT-JUST = 'L'.
      FCAT-SELTEXT_M = 'Opening Stock'.
      FCAT-DDICTXT = 'M'.
      FCAT-INTTYPE = 'Q'.
      FCAT-DATATYPE = 'QUAN'.
    fcat-do_sum = 'X'.
      FCAT-JUST = 'R'.
      FCAT-NO_ZERO = 'X'.
      APPEND FCAT.
      CLEAR FCAT.
    for the Total Receipts
      FCAT-FIELDNAME = 'TRECEP'.
      FCAT-HOTSPOT = ' '.
      FCAT-OUTPUTLEN = '000016'.
      FCAT-JUST = 'L'.
      FCAT-SELTEXT_M = 'Total Receipts'.
      FCAT-DDICTXT = 'M'.
      FCAT-INTTYPE = 'Q'.
      FCAT-DATATYPE = 'QUAN'.
      FCAT-DO_SUM = 'X'.
      FCAT-JUST = 'R'.
      FCAT-NO_ZERO = 'X'.
      APPEND FCAT.
      CLEAR FCAT.
    for the Production
      FCAT-FIELDNAME = 'PRODU'.
      FCAT-HOTSPOT = ' '.
      FCAT-OUTPUTLEN = '000016'.
      FCAT-JUST = 'L'.
      FCAT-SELTEXT_M = 'Production'.
      FCAT-DDICTXT = 'M'.
      FCAT-INTTYPE = 'Q'.
      FCAT-DATATYPE = 'QUAN'.
      FCAT-DO_SUM = 'X'.
      FCAT-JUST = 'R'.
      FCAT-NO_ZERO = 'X'.
      APPEND FCAT.
      CLEAR FCAT.
    for the Other Plant Receipts
      FCAT-FIELDNAME = 'RECEP'.
      FCAT-HOTSPOT = ' '.
      FCAT-OUTPUTLEN = '000016'.
      FCAT-JUST = 'L'.
      FCAT-SELTEXT_M = 'Othr Plnt Recpts'.
      FCAT-DDICTXT = 'M'.
      FCAT-INTTYPE = 'Q'.
      FCAT-DATATYPE = 'QUAN'.
      FCAT-DO_SUM = 'X'.
      FCAT-JUST = 'R'.
      FCAT-NO_ZERO = 'X'.
      APPEND FCAT.
      CLEAR FCAT.
    Sales Return
      FCAT-FIELDNAME = 'SAL_RET'.
      FCAT-HOTSPOT = ' '.
      FCAT-OUTPUTLEN = '000016'.
      FCAT-JUST = 'L'.
      FCAT-SELTEXT_M = 'Sales Return'.
      FCAT-DDICTXT = 'M'.
      FCAT-INTTYPE = 'Q'.
      FCAT-DATATYPE = 'QUAN'.
      FCAT-DO_SUM = 'X'.
      FCAT-JUST = 'R'.
      FCAT-NO_ZERO = 'X'.
      APPEND FCAT.
      CLEAR FCAT.
    Total Dispatches
      FCAT-FIELDNAME = 'TDISP'.
      FCAT-HOTSPOT = ' '.
      FCAT-OUTPUTLEN = '000016'.
      FCAT-JUST = 'L'.
      FCAT-SELTEXT_M = 'Total Dispatches'.
      FCAT-DDICTXT = 'M'.
      FCAT-INTTYPE = 'Q'.
      FCAT-DATATYPE = 'QUAN'.
      FCAT-DO_SUM = 'X'.
      FCAT-JUST = 'R'.
      FCAT-NO_ZERO = 'X'.
      APPEND FCAT.
      CLEAR FCAT.

  • Opening Stock and Closing Stock fields and Calculation

    Hi,
    My report requirement is to display the material, opening stock for the lower date, closing stock for the higher date and the in between all stock operations..how to fetch the opening stock and closing stock for a particular material ???.. what are the tables and fields for calculating them??..
    Thanks,
    Sri

    this is the code i wrote..
    I had selected the data for the date entered and the previous date(l_date) also..
    previous date for the opening stock.
    now i am getting only receipts and issues correctly.. opening stock and the remaining
    balance fields are not coming properly..please help me..
    here rmenge for receipts,imenge for issues.
    REPORT  ZSTOCK no standard page heading line-size 180.
    types: begin of ty_date,
           budat type budat,
           end of ty_date,
           begin of ty_mard,
            matnr type matnr,
            lgort type lgort_d,
            labst type labst,
            UMLME TYPE UMLMD,
            INSME TYPE INSME,
            EINME TYPE EINME,
            SPEME TYPE SPEME,
            RETME TYPE RETME,
           end of ty_mard,
           begin of ty_makt,
            matnr type matnr,
            maktx type maktx,
           end of ty_makt,
           begin of ty_mbew,
           matnr type matnr,
           bwkey type bwkey,
           lbkum type lbkum,
           salk3 type salk3,
           end of ty_mbew,
           begin of ty_mkpfmseg,
            mblnr type mblnr,
            budat type budat,
            bwart type bwart,
            matnr type matnr,
            lgort type lgort_d,
            shkzg type shkzg,
            dmbtr type dmbtr,
            menge type mseg-menge,
           end of ty_mkpfmseg,
           begin of ty_opstock,
           matnr type matnr,
           rdmbtr type dmbtr,
           idmbtr type dmbtr,
           bdmbtr type dmbtr,
           bmenge type menge_d,
           end of ty_opstock,
           begin of ty_output,
            mblnr type mblnr,
            budat type budat,
            matnr type matnr,
            maktx type maktx,
            bwart type bwart,
            lgort type lgort_d,
            shkzg type shkzg,
            rmenge type mseg-menge,
            rdmbtr type dmbtr,
            imenge type mseg-menge,
            idmbtr type dmbtr,
            dmbtr type dmbtr,
            bdmbtr type dmbtr,
            bmenge type menge_d,
           end of ty_output.
    data: t_date type standard table of ty_date initial size 0,
          t_mard type standard table of ty_mard initial size 0,
          t_makt type standard table of ty_makt initial size 0,
          t_mkpfmseg type standard table of ty_mkpfmseg initial size 0,
          t_opstock type standard table of ty_opstock initial size 0,
          t_out type standard table of ty_output initial size 0,
          w_date type ty_date,
          w_mard type ty_mard,
          w_makt type ty_makt,
          w_mkpfmseg type ty_mkpfmseg,
          w_opstock type ty_opstock,
          w_out type ty_output,
          g_matnr type mara-matnr,
          g_lgort type t001l-lgort.
    selection-screen begin of block b1 with frame.
    parameters:p_werks type t001l-werks obligatory memory id pw.
    select-options:s_lgort for g_lgort no-extension no intervals.
    select-options: s_matnr for g_matnr.
    parameters:p_date type mkpf-budat obligatory.
    selection-screen end of block b1.
    at selection-screen.
    perform sub_validate_date.
    start-of-selection.
    data: l_date type sy-datum,
          l_row type i.
    refresh t_date.
    select budat from mkpf into table t_date.
    sort t_date.
    delete adjacent duplicates from t_date.
    clear w_date.
    read table t_date into w_date with key budat = p_date.
    l_row = sy-tabix.
    l_row = l_row - 1.
    clear w_date.
    read table t_date into w_date index l_row.
    l_date = w_date-budat.
    select    k~mblnr
              k~budat
              s~bwart
              s~matnr
              s~lgort
              s~shkzg
              s~dmbtr
              s~menge
              into table t_mkpfmseg
              from mkpf as k inner join mseg as s
              on kmblnr = smblnr and
                 kmjahr = smjahr
              where k~budat between l_date and p_date and
                    s~matnr in s_matnr and
                    s~werks = p_werks and
                    s~lgort in s_lgort.
    if t_mkpfmseg is not initial.
    sort t_mkpfmseg by budat ascending
                       matnr ascending.
    select     matnr
               lgort
               labst
               umlme
               insme
               einme
               speme
               retme
               from mard
               into table t_mard
               for all entries in t_mkpfmseg
               where matnr = t_mkpfmseg-matnr and
                     werks = p_werks and
                     lgort in s_lgort.
    select    matnr
              maktx
              from makt
              into table t_makt
              for all entries in t_mkpfmseg
              where matnr = t_mkpfmseg-matnr.
    endif.
    loop at t_mkpfmseg into w_mkpfmseg where budat = l_date.
       loop at t_mard into w_mard where matnr = w_mkpfmseg-matnr.
          w_opstock-matnr = w_mkpfmseg-matnr.
          if w_mkpfmseg-shkzg = 'S'.             " Receive
               w_opstock-rdmbtr = w_mkpfmseg-dmbtr.
               w_opstock-bmenge = w_mard-labst + w_mard-insme + w_mard-speme
                                    + w_mard-einme +               w_mard-retme
                                    - w_mkpfmseg-menge.
          elseif w_mkpfmseg-shkzg = 'H'.         " Issue
               w_opstock-idmbtr = w_mkpfmseg-dmbtr.
               w_opstock-bmenge = w_out-bmenge + w_mkpfmseg-menge.
          endif.
              w_opstock-bdmbtr = w_out-rdmbtr - w_out-idmbtr.
                   append w_opstock to t_opstock.
                  clear w_opstock.
       endloop.
    endloop.
    loop at t_mkpfmseg into w_mkpfmseg where budat = p_date.
       loop at t_mard into w_mard where matnr = w_mkpfmseg-matnr.
         clear w_makt.
         read table t_makt into w_makt with key matnr = w_mkpfmseg-matnr.
         if sy-subrc = 0.
          w_out-budat = w_mkpfmseg-budat.
          w_out-matnr = w_mard-matnr.
          w_out-maktx = w_makt-maktx.
          w_out-lgort = w_mard-lgort.
          w_out-mblnr = w_mkpfmseg-mblnr.
          w_out-bwart = w_mkpfmseg-bwart.
          w_out-shkzg = w_mkpfmseg-shkzg.
            if w_mkpfmseg-shkzg = 'S'.             " Receive
               w_out-rmenge = w_mkpfmseg-menge.
               w_out-rdmbtr = w_mkpfmseg-dmbtr.
               w_out-imenge = 0.
               w_out-bmenge = w_mard-labst + w_mard-insme + w_mard-speme
                                    + w_mard-einme + w_mard-retme
                                    - w_mkpfmseg-menge.
            elseif w_mkpfmseg-shkzg = 'H'.         " Issue
               w_out-imenge = w_mkpfmseg-menge.
               w_out-idmbtr = w_mkpfmseg-dmbtr.
               w_out-rmenge = 0.
               w_out-bmenge = w_out-bmenge + w_mkpfmseg-menge.
            endif.
               w_out-bdmbtr = w_out-rdmbtr - w_out-idmbtr.
                   append w_out to t_out.
                  clear w_out.
    endif.
       endloop.
    endloop.
    write: / 'Material' , 12 'Description' ,40 'Location', 50 'Opening stock',70 'MvT',
              83 'Receipts' , 102 'Issues', 118 'Amount',135 'Balance Quan', 155 'Balance Amount'.
    loop at t_out into w_out.
       write: / w_out-matnr, 12 w_out-maktx, 40 w_out-lgort.
       clear w_opstock.
       read table t_opstock into w_opstock with key matnr = w_out-matnr.
       if sy-subrc = 0.
         write: 45 w_out-bmenge.
        endif.
       write: 70 w_out-bwart,75 w_out-rmenge,92  w_out-imenge,
             110 w_out-bdmbtr, 130 w_out-bmenge, 150 w_out-bdmbtr.
    endloop.
    *&      Form  SUB_VALIDATE_DATE
    FORM SUB_VALIDATE_DATE.
        select budat
               from mkpf
               into table t_date
               where budat = p_date.
        if t_date is initial.
           message e001(zks) with 'select another date range'.
        endif.
    ENDFORM.                    " SUB_VALIDATE_DATE
    Edited by: Sri on Feb 18, 2009 8:31 AM

  • Moving Average Price for Sales stock and Project stock of a material

    Hiya Gurus,
                     I am developing a report to display inventory details. My requirement is that I have to display the Moving average price of a material for all Valuation type. I also need to display the Moving average price if a material has got Project stock or Sales stock.
                     In MBEW table I can get the Valuation type and its Moving average price, but how can I find the moving average price for the same material if it has got Sales stock and project stock. Please let me know the table and field where I could get the relevant data.
                    Kindly help me on this, it would be deeply appreciated.
    Cheers,
    ZIa

    Hi
    can you look at tables
    EBEW                             Sales Order Stock Valuation
    QBEW                             Project Stock Valuation
    Nat

  • Discrepancy between IM stock and WM Stock

    Hi experts,
    We found there is discrepancy between IM stock and WM Stock.Before configuring WM storage types , IM Stocks are not syched. So WM stocks are showing less then IM stocks,. Now i need to synch up the IM stock and WM stock. what we needs to do. Can you please guide us.
    Thanks & Regards,
    Vamsi

    OR
    have a look at using transaction LX23 (provided you dont use HUM this should help you determine/ analyse and post any differences between IM and WM).
    thanks,
    A
    LX23: Stock Comparison Inventory Management / Warehouse Management
    Description
    Using this report you can generate an inventory comparison between the IM System (Inventory Management) and the WM System (Warehouse Management).
    On the selection screen, you can limit the area for comparison by entering the plant / storage location, plant / warehouse number or only the warehouse number.
    In addition to specifying the area, you can also determine the extent of information to be issued.  Here you have three options:
    1. "With bin inventory"
    In addition to generating the corresponding stock figures, you can also have a list of the corresponding WM bin quantities included.
    2. "All data on material"
    Even if only one difference occurs in one of the listed combinatations of material / batch / special stock indicator / supplier, all material combinations are listed. This can be very helpful when searching for errors.
    3. "Clear differences"
    If you mark this field, the system will generate a batch input session. By starting the batch input session, the differences to be cleared are removed in the IM system.  Negative WM stock figures and stock differences in returns will not be cleared.
    If you want to have a batch input file generated for the purpose of clearing the differences, it is important, for consistency reasons, that the materials in the respective warehouse are blocked in order that postings affecting stock figures can be prevented.
    CAREFUL: If you generate this session, all the material stocks belonging to the respective warehouse number are blocked completely, that is, for the duration of the program, no postings affecting the stock in the warehouse will be possible!
    Prerequisites
    The comparison is also possible for warehosue numbers managed on a decentralized basis.
    Output
    You receive a list with various materials. The list contains the following information, for example:
    The first line contains the plant, storage location, warehouse number, material number, total stock in inventory management, total stock in the warehouse, and the difference between the stocks.
    The following line contains the first combination of batch / special stock indicator / supplier (or sales document and item number for sales order stock) and stock category (Q,R,S, ), the stock figures in Inventory Management, in Warehouse Management, and the difference.
    If a batch input session is to be generated, the list contains a note in the log as to whether or not a session has been generated or behind the pushbutton "non-postable stocks", which materials could not be cleared because of negative stock figures or because they belong to returns stock.
    Edited by: WILSAQ on Aug 11, 2009 12:09 AM

  • How to create a query to see Opening stock and closing stock as on particul

    Hi All,
    How to create a query to see Opening stock and closing stock as on particul.
    Regards
    Albaik

    Hi,
    In BI 0IC_C03 will provide u the  required information and also having standard queries provided by the SAP.
    Plz find the list of Queries provided by the SAP.
    =======================================================================================================
    Inventory turnover      0IC_C01_Q0001
    Range of coverage - quantity      0IC_C01_Q0002
    Range of Coverage - Value      0IC_C01_Q0003
    Range of coverage of finished goods - quantity      0IC_C01_Q0004
    Range of Coverage of Finished Goods - Value      0IC_C01_Q0005
    Range of coverage of raw materials - quantity      0IC_C01_Q0006
    Range of Coverage of Raw Materials - Value      0IC_C01_Q0007
    Obsolete Stock on Hand      0IC_C01_Q0008
    Period-dependent requirement coverage      0IC_C01_Q0009
    Value of stock on hand      0IC_C01_Q0010
    Quantity of stock on hand      0IC_C01_Q0011
    Material consumption      0IC_C01_Q0012
    Material Movements      0IC_C01_Q0013
    Consignment stock: receipts and issues      0IC_C01_Q0014
    Valuated stock: receipts and issues      0IC_C01_Q0015
    Material stock and movements      0IC_C01_Q0016
    Material Movements (Healthcare)      0IC_C01_Q0020
    Material Consumption (Healthcare)      0IC_C01_Q0021
    Material Availability      0IC_C01_Q0022
    Inventory Turnover Frequency (Value)      0IC_C01_Q0023
    Consignment Stock Received and Issued per Unit      0IC_C01_Q0024
    Material Consumption (Quantity)      0IC_C02_Q0001
    Valuated Stock Receipts and Issues (Quantity)      0IC_C02_Q0002
    Range of Valuated Stock (Quantity)      0IC_C02_Q0003
    Inventory Turnover      0IC_C02_Q0004
    Receipt and Issue Consignment Stock at Customer      0IC_C03_Q0001
    Receipt and Issue Quality Inspection Stock      0IC_C03_Q0002
    Vendor Consignment Stock Receipt and Issue      0IC_C03_Q0003
    Receipt and Issue Stock in Transit      0IC_C03_Q0004
    Receipt and Issue of Blocked Stock      0IC_C03_Q0005
    Valuated Stock      0IC_C03_Q0006
    Stock in Quality Inspection      0IC_C03_Q0007
    Stock in Transit      0IC_C03_Q0008
    Blocked Stock      0IC_C03_Q0009
    Vendor Consignment Stock      0IC_C03_Q0010
    Consignment Stock at Customer      0IC_C03_Q0011
    Stock Overview      0IC_C03_Q0012
    Stock Overview (as of 3.1 Content)      0IC_C03_Q0013
    Quantities of Valuated Project Stock (as of 3.1 Content)      0IC_C03_Q0014
    Valuated Stock (as of 3.1 Content)      0IC_C03_Q0015
    Quantities of Valuated Sales Order Stock (as of 2.1 Cont.)      0IC_C03_Q0016
    Inventory Turnover      0IC_C03_Q0017
    Days' Supply      0IC_C03_Q0018
    SUS: Vendor Consignment Stock      0IC_C03_Q0019
    Scrap      0IC_C03_Q0020
    Inventory Aging      0IC_C03_Q0021
    Stock Overview - extended      0IC_C03_Q0022
    Demand Supply Match      0IC_C03_Q0023
    Warehouse Stock Analytics – Inventory Turnover      0IC_C03_Q0024
    Warehouse Analytics - Obsolescence and Variance      0IC_C03_Q0025
    Stock Overview: Materials      0IC_C03_Q0030
    Average Stock Value Over Time      0IC_C03_Q0031
    Stock Overview Over Time      0IC_C03_Q0032
    Range of Coverage Over Time      0IC_C03_Q0033
    ==================================================================================================
    Regards
    Ram.
    Edited by: Ramakanth Deepak Gandepalli on Jan 18, 2010 8:06 AM

  • On hand stock and avilable stock

    Hello experts,
    Could you please tell me the difference between "ON HAND STOCK" and "AVAILABLE STOCK". How is it maintained in the system??
    Regards,
    Sanjay

    Hi Sanjay,
    Companies have stock on hand to safeguard against uncertainties and fluctuations in demand. However, holding an excessive amount of stock ties up too much capital and generates high storage costs. If there is insufficient on-hand stock, there is a danger that unexpected demand might arise that cannot be fulfilled.
    Therefore, the SNP optimizeru2019s main purpose in stock planning is to keep the on-hand stock between specific upper and lower bounds.
    In system:
    http://help.sap.com/saphelp_scm50/helpdata/en/79/70833c8b079c2ee10000000a114084/content.htm
    Availibility Stock:
    The inventory on-hand minus allocations, reservations and backorders.
    Thanks and Regards,
    Naveen Dasari.

Maybe you are looking for

  • CTSMan 1.9.1 and CUCM 8.6.2 sync problems Error 502407

    Hi, I ran into recent problem synchronizing CUCM 8.6.2(b) into CTSman 1.9.1 CTSMan is getting an Error message: 502407 Details ID: 502407 Severity: critical Module: DiscoveryMgr SubModule: CTIAdapter Summary: Communication to Unified CM failure Recom

  • Hard Drive suddenly incapable of reformating

    Hey, I've got a LaCie hard drive here, about 300 gigs. It was going fine for a couple years now until Time Machine gave me an error and stopped. The next morning the disk can't be read, so I enter Disk Utility. Seems it's there, but it's now 0 bytes,

  • How to give constant data in RFC function module

    Hello;     I have created a BAPI which doesnt have any data i want to put some data in that BAPI so tried with constants but it is not working..how put hard code data in function module..when i put the data it gives error stating that 'Function-Pool'

  • How to reject week 41 to 52 from 2007 data in rules file

    Hi there, I have to reject 2007W41 to 2007W52 from the data loading, meaning i just want data till 2007W40. Now so far what i have done is i edited the rules files went to select Time column>Records>reject>since i have to reject more than one i have

  • Line Manager

    Hi, I have a little problem, I have a small approval process, which is started by a requestor and then the next step is, that the direct line manager of the requestor has to approve or reject the request. So I find out who is the line manager (by an