Stock ageing in MM

Did any have stock ageing report in MM. Would you plz send code if available.

*& 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

Similar Messages

  • Urgent: Regarding Stock Ageing report

    hi,
    i want to have stock ageing report in which i want to have the deatils :-
    This is the material which is present in the palnt from dis <b>date</b> and further details of it consumption. plzz tell the <b>tcode</b> for it.
    plzz help me out as it is most urgent to me..
    regards,
    ric.s
    Message was edited by:
            ric .s

    Hi
    The report MC.9 shows Last movement date/Last receipt date / Last issue date.
    In period to analyze give appropriate date range
    Or
    check  MSEG & MARD table to get details about material documents with date
    Vishal...

  • Standard Report for stock Aging

    Hello all,
    can anyone plz let us know that is there any standard report in SAP for stock aging? actually i have to see the materials quantity whose 311 movement not done after 321 and also from how many days it is pending.
    Kindly help and tell how can i find those materials quantity, while user also do 311 for partial quantity?
    Regards.

    Hi  @ABAP@
    Check the followings...
    MB24 - Reservations for Material
    MB25 - Reservations for Account Assignment
    MB51 - Material Document List
    MB52 - List of Warehouse Stocks on Hand MB53 - Display Plant Stock Availability
    MB54 - Consignment Stocks
    MB56 - Analyze Batch Where-Used List
    MB57 - Build Up Batch Where-Used List
    MB58 - Consgmt and Ret. Packag. at Customer
    MB59 - Material Document List
    MB5B - Stocks for Posting Date
    MB5C - Pick-Up List
    MB5L - List of Stock Values: Balances
    MB5M - ShL.exp/prod.date
    MB5S - Display List of GR/IR Balances
    MB5W - List of Stock Values
    MB9A - Analyze Archived Material Documents
    MBAL - Material Documents: Read Archive
    MBGR - Display Material Documents by Movement Reason
    MBSI - Find Inventory Sampling
    MBSM - Display Cancelled Material Documents
    MMBE - Stock Overview
    MD07 - Current Material Overview
    MR51 - Material Line Items
    MRKO - Settle Consignment/Pipeline Liabilities
    MB5T - Stock in transit CC

  • Stock Aging Query/Report

    Dear all,
    We are on SAP B1 2007 PL42 and using Moving average as our cost valuation method.
    It doesn't have an inbuilt stock aging report, I have searched through the forum but none of the queries arebshowing the correct aging of stocks. Could anyone have a query/report/addon for stock aging?
    Kind Regards,
    Asif

    Hi,
    Try this one,with warehouse code as input parameter
    select b.code, b.name, b.Wh, b.Bal, b.Val,
    isnull(case when b.days <30 then b.bal end,0)'0-30 Days' ,
    isnull(case when b.days between 30 and 60 then b.bal end,0) '30-60 Days',
    isnull(case when b.days between 60 and 90 then b.bal end,0) '60-90 Days',
    isnull(case when b.days between 90 and 120 then b.bal end,0) '90-120 Days',
    isnull(case when b.days between 120 and 150 then b.bal end,0) '120-150 Days',
    isnull(case when b.days between 150 and 180 then b.bal end,0) '150-180 Days',
    isnull(case when b.days >180 then b.bal end,0) 'Above 180 Days'
    from (
    select a.code,a.name,a.wh,a.bal,a.val,datediff(dd,dt,getdate())'days'
    from (
    select max(t0.itemcode)'Code',max(t0.Dscription)'Name',
    max(t0.Warehouse)'Wh',
    sum(t0.inqty-t0.outqty)'Bal',sum(t0.transvalue)'Val',max(t0.docdate)'dt'
    from oinm t0 inner join oitm t1 on t0.itemcode=t1.itemcode
    where t0.warehouse='[%1]'
    group by t0.itemcode
    )a
    )b order by code

  • Stock ageing report

    Hi all,
            I am developing stock ageing report i would not able to find Below fields in existing cube, kindly guide me how i can get those fields data in BI. whether i can create generic extraction or ? please give yr suggestion.
    Fields:
    vendor sub range
    consignment no
    Return flag(Returnable)
    And also GR data and GR qty already data availble how to find last GR date based on user input.Please sugges me.
    Last GR date  
    Last GR qty
    Thanks & Regards,
    R. Saravanan

    Try extractor 2LIS_03_BF. Or table MSEG.

  • Facing Issue with Stock Ageing report

    In Blocked Stock Ageing report Output, I am facing following issues
    1. Stock is correct but once we include the "Reason For Movement" then the aging is getting wrong  and in some cases value is coming Negative.
    2. In some cases "Reason For Movement" is coming in ‘#’, but this is a mandatory field. Hence cannot be blank.
    Note:
    1. Overall stock is coming correct.
    2. Reason Movement chat. is in free char
    3. Report is based 0IC_C03.

    Hi Nadeem,
    Reason for Movement is loading from  what attribute?  check in RSRV for that attribute.
    RSRV-->All Elementary Tests ->Master Data ->Compare Size of P-, Q- with X- and Y- Tables respectively .
    If it has any error then  correct that error in RSRV. It  will solve your problem.
    Regards,
    Rajesh

  • How to Calculate the Stock aging report in BW

    Dear All,
    Please let me know the process to calculating the Stock Aging report in BW.
    And what are date field need to be consider and what are customer exits used to populated different agings in Stock like 0-30 days etc.
    Thanks
    Regards,
    Sai

    Hello,
    I would be very happy if you send me some sample code to implement this in User exits.
    I mean which ABAP statements are useful in this case. I think we need to implement the following logic for User Exit variable.
    1. At run time, retieve the SSN data from BW dabase
    2. Convert the first 5 digets into *****
    3. Make it available to report in BEX.
    Thanks
    VNM

  • Batch transaction stock aging report

    Hi Experts,
    Can you some one help me with query which give stock aging report base on Batch wise transactions (IBT1).
    Item Code,    Item description  Batch#(Qty which are >0),  Batch Qty,  Stock "IN" creation Date,
    Thanks for your help.
    Regards,
    Suresh

    Dear parneeth,
    As requested please try this Query to fulfill your requirement.
    SELECT T0.docnum,
    T2.BatchNum,T2.ItemCode,T2.Quantity,
    T2.ItemName,T0.CardName as Supplier,
    T2.SuppSerial,T2.IntrSerial,T2.ExpDate,T2.PrdDate,T2.InDate,T2.Located,
    convert(varchar(8000),T2.Notes)
    FROM OPDN T0 INNER JOIN PDN1 T1 ON T0.DocEntry=T1.DocEntry
    inner join
    OIBT T2 on T1.ItemCode = t2.ItemCode and T0.objtype=T2.basetype and T2.baseentry=T1.Docentry
    inner join
    oitm T5 on T1.Itemcode=T5.Itemcode
    WHERE
    T2.quantity>0
    group by T0.docnum,T2.BatchNum,T2.ItemCode,T2.Quantity,
    T2.ItemName,T0.CardName,
    T2.SuppSerial,T2.IntrSerial,T2.ExpDate,T2.PrdDate,T2.InDate,T2.Located,
    convert(varchar(8000),T2.Notes),T1.Linetotal,T1.Quantity
    REGARDS
    MANGESH PAGDHARE.
    Edited by: MANGESH  PAGDHARE on Jan 9, 2012 6:31 PM

  • Stock ageing report with batch Management active

    Hi Experts,
    My client wants a Stock ageing report and batch management is active
    According to my client, Inventory ageing report should show stock quantities and stock value as follows,
    1. Below one year
    2. Between one and two years
    3. Above two years
    What are the table and fields to be considered for this report.
    Thanks
    NDS

    What steps do you mean? taking an ABAP course and doing it yourself, or stepping to an ABAPer and let him know what he shall do?
    you asked for a stock report, not for a movement report.
    If I go into my warehouse and looking at all the stuff sitting there and want a report that should tell me how old this stuff is, then i am not intrested if there was a goods receipt movement.
    However I would like to know the last movement date. In this case you have to look into table S032 or into the movements MSEG (with MKPF as header table)

  • Stock ageing report in inventory management

    Hi,
    iam working in stock ageing report my requirment is i for developing stock ageing i have chars for plant and material ,and other 2 chars but i dont have cal day i have only creation on date means posting date only availble .my current layout is :
    Plant
    Plant   Material     0 u2013 30 Days  30 u2013 60 Days 60 u2013 90 Days  90 u2013 180 Days   > 180 Days     
    Expired     Blocked     Restricted
    above is mentioned is my current layout.
    but now user will be want  they want see 0-30 below month also mean july- august same as 30-60 also.
    Report to display always 2 months data at a time. Previous month closing and current month ongoing                                        
    this is my requirement please hpe help on this.
    thanks in advance.
    Deva

    As you already noticed not only the input (GR) but the output (GI) is also important.
    The date of the GR is only one thing, but after that you received the goods in your SLoc you cannot make difference between stocks received at different times.
    As your stock is not distinguished in the system as per the GR date you cannot say that which sub-stock has been consumed during GI.
    So, without batch management you cannot achieve your goal in standard system.
    Of course, physically you can realize your idea by putting labels on different batches - this would mean batch management physically and not in SAP.
    If you use warehouse management you can use a workaround: the GR date is stored in the quants and this makes possible to track the age of the stock without batch management. Please check:
    http://help.sap.com/erp2005_ehp_04/helpdata/EN/c6/f83b5e4afa11d182b90000e829fbfe/frameset.htm
    Regards,
    Csaba

  • Stock Aging report in SAP Business One

    Greetings,
    I don't think this issue has been raised successfully on the forums (i checked, there's no real resolution at the moment).
    The end user requires some form of stock aging that their auditors deem important but there's no such feature within SAP B1.
    Their basic requirements would be:
    Stock Code | Description | Date of Purchase | Current Month (qty) | 30-90 Days (qty) | 91-120 Days (qty) | 120 days and above (qty)
    I'm wondering if this is even possible with the end user using multiple warehouses to stock their inventory, and some items are marked as serial items and others are marked as batch.
    Any ideas?

    Thank you for pointing me in the right direction. Amended your query a little so the user input square brackets are there.
    SELECT T0.ITEMCODE , T0.ONHAND as 'Total Qty', CASE WHEN Datediff(day, T1.LASTPURDAT,GETDATE())<45 THEN T0.ONHAND END '<45 Days(Qty)', CASE WHEN Datediff(day, T1.LASTPURDAT,GETDATE())<45 THEN T0.ONHAND*T0.AVGPRICE END '<45 Days(Value)', CASE WHEN DateDiff(day, T1.LASTPURDAT,GETDATE()) >= 45 AND DateDiff(day, T1.LASTPURDAT,GETDATE()) < 90 THEN T0.ONHAND END '45 to 90 Days(Qty)'  , CASE WHEN DateDiff(day, T1.LASTPURDAT,GETDATE()) >= 45 AND DateDiff(day, T1.LASTPURDAT,GETDATE()) < 90 THEN T0.ONHAND*T0.AVGPRICE END '45 to 90 Days(Value)', CASE WHEN Datediff(day, T1.LASTPURDAT,GETDATE()) >= 90 THEN T0.ONHAND END '>90 Days(Qty)', CASE WHEN Datediff(day, T1.LASTPURDAT,GETDATE()) >= 90 THEN T0.ONHAND*T0.AVGPRICE END '>90 Days(Value)'
    FROM OITW T0 INNER JOIN OITM T1 ON T0.ITEMCODE = T1.ITEMCODE INNER JOIN OITB T2 ON T1.ITMSGRPCOD=T2.ITMSGRPCOD WHERE T0.ONHAND>0 AND T0.WhsCode ='[%0]'
    AND T2.ITMSGRPNAM = [%2]
    Will continue to review the aging issue and maybe even update the forums with the results.
    I can understand why in the query you've provided above its not really feaseable to have the Date of Purchase because its showing the stock quantity in total (which would make more sense instead of each item row by row)
    Edited by: Davinder Singh on Apr 18, 2008 4:38 PM

  • Stock Aging report with current date

    Dear Experts
    Can we able to take stock aging report with current date?
    Thanks&Regards,
    Vinoth Raj K

    You're posting in the Portuguese B1 space.
    You might want to post in the English one: SAP Business One Application

  • Stock Aging Analysis Report by Serial Number

    Hi Experts,
    Is it right to create a Stock Analysis Report for all materials based on Serial Numbers? Because I have now developed a Stock Aging Report which will display the values of stock aging based on Goods Receipt created however, when I base it on Goods Receipt and Serial Numbers, the number won't tally. Please explain what happened? Is this approach not feasible?
    Please help.
    Thanks a lot for your answers!

    Hi @Bijoy,
    We are now experiencing a lot of issues regarding tracking the stock by serial numbers because the current stock aging report only applies to a FIFO stock system. There are also stocks that are transferred from Location to another Location (Sto Loc to Sto Loc2) and they wanted their stocks' aged to be based on the first Storage Location Posted. Please tell me if this is feasible.
    Thanks a Lot!

  • Urgent: regarding stock aging report

    hi,
    i want to have t-code for 'STOCK AGING REPORT' which shows that this material is present in the plant from this <b>date</b>. <b>plzzz provide me the tcode for it.</b>
    if anybody provide me solution to it will be definately rewarded.
    Message was edited by:
            ric .s
    Message was edited by:
            ric .s
    Message was edited by:
            ric .s

    Hi,
    Please try transaction code MC50
    also u can use mc.9 in that use fields like last consumed last good issued and last goods receipt
    after runing report u will get material and values t add above fields
    press f6 and add last consumed last good issued and last goods receipt
    and with this data u can analys this data
    Reward if found  helpful ...
    Cheers,
    Chandra Sekhar.

  • Stock Aging report logic

    Hi ,
    There is a report requirement from stock aging report based on the bucket scenario.
    I need to calculate the stock based on quantity(MSEG - MENGE) and moving average price/periodic unit price(MBEW - VERPR).
    Then i need to perform the same into bucket scenario like 0-09 ,91-180,180-360,>360.
    I can see the field (MENGE) in the standard datasource 2LIS_03_BF which is connecting with the infoobject 0QUANT_B.
    But in the update rule/transformation there no assignment for this.
    For which infoobject i can map to the cube and what logic i need to perform.
    There is a calculation for this in the report for the value of the stock below.
    Value = Quantity(MENGE)xmoving average price/periodic unit price(VERPR).
    Stock Logic:
    Stock is consider based on the movement types: 101,701,712.
    Can anyone give me the idea on this how to perform the logic.
    Thanks,
    satya

    Hi Vijay,
    Functional consultant has given the logic for calculating the stock is
    Stock Quantity is restricted based on the movement types 101,701,712.
    Stock Value = QuantityxMoving average price /periodic unit price
    The logic for calculating the buckets based on the Posting date(0PSTNG_DATE).
    My concern is how i can perform the same logic in BW side to calculate the value of the stock.
    Advice...
    Thanks,
    Satya
    Edited by: satya prasad on Aug 5, 2011 7:03 AM

  • Inventory Stock Aging Report

    Hi All.
    I need Inventory Stock Quantity wise aging report from sap b1 sp 00 pl 47 .
    0-30, 31-60,61-90 and above 90
    Regards,
    Haider

    Check below link tooo
    Re: Stock Aging report in SAP Business One
    Re: Inventory Aging Report
    Stock Aging Report
    and this toooo
    SELECT distinct T0.ITEMCODE, T1.itemName,T0.ONHAND as 'Total Qty', T1.ManBtchNum,T1.ManSerNum,
    CASE WHEN Datediff (day,T1.LastPurDat, Getdate ()) <45 THEN T0.ONHAND END '<45 Days (Qty)',
    CASE WHEN Datediff (day,T1.LastPurDat, Getdate ()) <45 THEN T0.ONHAND * T0.Avgprice END  '<45 Days (Value)',
    CASE WHEN Datediff (day,T1.LastPurDat, Getdate ())>45 AND Datediff (day,T1.LastPurDat, Getdate ()) <90 THEN T0.ONHAND END '<45 T0 90 Days (Qty)',
    CASE WHEN Datediff (day,T1.LastPurDat, Getdate ())>45 AND Datediff (day,T1.LastPurDat, Getdate ()) <90 THEN T0.ONHAND * T0.Avgprice END  '<45 T0 90 Days (Value)',
    CASE WHEN Datediff (day,T1.LastPurDat, Getdate ()) >90 THEN T0.ONHAND END '>90 Days (Qty)',
    CASE WHEN Datediff (day,T1.LastPurDat, Getdate ())>90 THEN T0.ONHAND * T0.Avgprice END  '>90 Days (Value)'
    FROM OITW T0 INNER JOIN OITM T1 ON T0.ITEMCODE = T1.ITEMCODE
    INNER JOIN OITB T2 ON T1.ITMSGRPCOD=T2.ITMSGRPCOD
    left join ibt1 t3 on t3.itemcode = t0.whscode
    WHERE T0.ONHAND >0 AND T0.WhsCode = '[%0]' AND T2.ItmsGrpNam ='[%1]'

Maybe you are looking for

  • Hard Disk Not Exist

    my laptop say's please install an operating system on your hard disk. hard disk (3fo) The laptop is Presario CQ61

  • Will not restore or show up in iTunes?!

    Have recently upgraded iPhone 3 software to most recent and has backed up fine, but will not restore. The screen says connect to iTunes but will not be picked up on itunes at all, and will not show on my computer either ?!?!

  • Reg server sizing

    Hi All, My project is implementing BI 7.0. Can any one suggest me reg server sizing. My Problems:  1) Whether better to go for same client for both Functional guyz n                              BW guyz on the same server.                        2) I

  • Help - How to stop Bluetooth on BB10 from repeatedly trying to connect to unknown device

    Hi,  So about a week ago I was trying to connect my Q10 to a Bluetooth speaker. In the process of this (and rather stupidly) I tried to connect to some unknow device that is not mine (nor was it the bluetooth speaker). I quickly deleted this connecti

  • CS6 from PC to Mac

    I just purchased an IMAC and would like to transfer my CS6 installed on my PC to my MAC computer. I was told you are allowed one transfer from PC to MAC. Is this correct? How do I go about transferring this over?