FG stock on a particular date for a specific customer

Hi all,
I need to develop one report in which i need FG stock for a particular customer on a particular date. For ex on 5/11/11 what was the FG stock against xyz customer.
Is there any logic available for this requirement. can you please tell me which tables i should look for?
Thanks

FG stock for a particular customer on a particular date.
Is it Make to Order stock? If it is not, then you may not find the details. If it is MTO, then use t.code MB5B. Using this, you can find stock on particular date.
Regards,

Similar Messages

  • Closing stock of a particular date

    how to get plant wise material closing stock on any particular date. say previous months end date. I am calculating that from MSEG table with the help of MSEGINSMK and MSEGSHKZG field. (with date filtaration by joining MBLNR of MKPF table) But stock is showing different with the closing stock showing in MB5B report for that date. I don't know which BWART of MSEG table to be excluded. My email id is [email protected]

    Hi,
    This is a stock aging report, you can use this for reference.
    Logic: Based on current stock and value from MBEW table. The latest receipt dates were taken till the qty tallies off.Rejections and reversals are considered.
    The movement types considered are ('101','102','105','106','122','123','131','132','301','302','309','310','501','502','531','532','561','562','701','702').
    *& Report  ZMM03_TRY                                                 *
    REPORT  ZMM03 LINE-SIZE 226
                   LINE-COUNT 35(2)
                    NO STANDARD PAGE HEADING..
    TABLES : S032,  "Current Stock And Grouping Terms
             MBEW,  "Material Valuation
             T023T, "Material Group Desc.
             MAKT,  "Material Description
             EKPO.  "Purchasing Document Item.
    DATA : BEGIN OF T_HEADER OCCURS 0,
           MTART LIKE MARA-MTART,
           MATNR LIKE MBEW-MATNR,
           BWKEY LIKE MBEW-BWKEY,
           MATKL LIKE MARA-MATKL,
           MAKTX LIKE MAKT-MAKTX,
           MEINS LIKE MARA-MEINS,
           LBKUM LIKE MBEW-LBKUM,
           SALK3 LIKE MBEW-SALK3,
           VERPR LIKE MBEW-VERPR,
           CLSTK LIKE MBEW-LBKUM,
           CLVAL LIKE CKMLCR-SALK3,
           UNIT LIKE CKMLCR-PVPRS,
           END OF T_HEADER.
    DATA : BEGIN OF T_MSEG OCCURS 0,
           MATNR LIKE MSEG-MATNR,
           WERKS LIKE MSEG-WERKS,
           BUDAT LIKE MKPF-BUDAT,
           MBLNR LIKE MKPF-MBLNR,
           MJAHR LIKE MKPF-MJAHR,
           ZEILE LIKE MSEG-ZEILE,
           LFBNR LIKE MSEG-LFBNR,
           LFBJA LIKE MSEG-LFBJA,
           LFPOS LIKE MSEG-LFPOS,
           BWART LIKE MSEG-BWART,
           MENGE LIKE MSEG-MENGE,
           EBELN LIKE MSEG-EBELN,
           EBELP LIKE MSEG-EBELP,
           XAUTO LIKE MSEG-XAUTO,
           UMMAT LIKE MSEG-UMMAT,
           UMWRK LIKE MSEG-UMWRK,
           MARK(1),
           END OF T_MSEG.
    TYPE-POOLS : SLIS.
    DATA : L_STOCK TYPE MSEG-MENGE.
    DATA : WA_MSEG LIKE T_MSEG.
    DATA : WA_MSEG1 LIKE T_MSEG.
    DATA : T_ITEMS LIKE T_MSEG OCCURS 0 WITH HEADER LINE.
    DATA : T_CUR_STOCK LIKE T_MSEG OCCURS 0 WITH HEADER LINE.
    DATA : L_LBKUM TYPE MBEW-LBKUM.
    DATA : BEGIN OF T_OUTPUT OCCURS 0,
             WERKS LIKE MSEG-WERKS,
             MATNR LIKE MSEG-MATNR,
             BUDAT LIKE MKPF-BUDAT,
             MENGE LIKE MSEG-MENGE,
             PDAYS TYPE I,
             PVAL  TYPE MSEG-MENGE,
             MAKTX LIKE MAKT-MAKTX,
             CQTY  LIKE MSEG-MENGE,
             CPRC  LIKE MBEW-SALK3,
           END OF T_OUTPUT.
    DATA: GRID_TAB TYPE SLIS_T_FIELDCAT_ALV  WITH HEADER LINE.
    DATA : T_SORT TYPE SLIS_T_SORTINFO_ALV,
           WA_SORT TYPE SLIS_SORTINFO_ALV.
    *AT SELECTION-SCREEN.
    SELECTION-SCREEN BEGIN OF BLOCK 1 WITH FRAME TITLE TEXT-014.
    SELECTION-SCREEN SKIP 1.
    PARAMETERS : P_DATE LIKE S032-LETZTABG OBLIGATORY DEFAULT SY-DATUM.
    SELECTION-SCREEN SKIP 1.
    SELECTION-SCREEN END OF BLOCK 1.
    SELECTION-SCREEN BEGIN OF BLOCK 2 WITH FRAME TITLE TEXT-015.
    PARAMETERS     : P_WERKS    TYPE S032-WERKS OBLIGATORY.
    SELECT-OPTIONS : S_LGORT    FOR S032-LGORT,
                     S_MATNR    FOR S032-MATNR.
    SELECTION-SCREEN END OF BLOCK 2.
    SELECTION-SCREEN BEGIN OF BLOCK 3 WITH FRAME TITLE TEXT-016.
    SELECT-OPTIONS : S_MTART    FOR S032-MTART,
                     S_MATKL    FOR S032-MATKL.
    SELECTION-SCREEN END OF BLOCK 3.
    IF  P_DATE IS INITIAL AND
        P_WERKS IS INITIAL AND
        S_LGORT IS INITIAL AND
        S_MATNR IS INITIAL AND
        S_MTART IS INITIAL AND
        S_MATKL  IS INITIAL.
      MESSAGE I398(00) WITH 'Enter Selection Critirea'(019).
      SY-SUBRC = '1'.
    ELSE.
      SELECT AMATNR ABWKEY BMATKL BMTART CMAKTX BMEINS A~LBKUM
             A~SALK3
           INTO CORRESPONDING FIELDS OF TABLE T_HEADER
           FROM MBEW AS A INNER JOIN MARA AS B ON AMATNR = BMATNR
                          INNER JOIN MAKT AS C ON AMATNR = CMATNR
                                            WHERE A~MATNR IN S_MATNR
                                              AND A~BWKEY EQ P_WERKS
                                              AND MATKL IN S_MATKL
                                              AND MTART IN S_MTART
                                              AND BWTAR EQ ' '
                                              AND C~SPRAS = SY-LANGU.
      IF SY-SUBRC EQ 0.
        SELECT ABUDAT AMBLNR AMJAHR BZEILE BMATNR BWERKS B~BWART
               BMENGE BLFBNR BLFBJA BLFPOS BEBELN BEBELP B~XAUTO
               BUMMAT BUMWRK
            INTO CORRESPONDING FIELDS OF TABLE T_MSEG
            FROM MKPF AS A INNER JOIN MSEG AS B ON AMBLNR = BMBLNR
                                               AND AMJAHR = BMJAHR
             FOR ALL ENTRIES IN T_HEADER
                                             WHERE A~BUDAT <= P_DATE
                                               AND B~MATNR = T_HEADER-MATNR
                                               AND B~WERKS = T_HEADER-BWKEY
                                               AND B~BWART IN ('101',
                                                               '102',
                                                               '105',
                                                               '106',
                                                               '122',
                                                               '123',
                                                               '301',
                                                               '302',
                                                               '701',
                                                               '702',
                                                               '131',
                                                               '132',
                                                               '309',
                                                               '310',
                                                               '501',
                                                               '502',
                                                               '531',
                                                               '532',
                                                               '561',
                                                               '562').
        PERFORM GET_DEAD_STOCK.
        PERFORM DISPLAY_OUTPUT.
      ELSE.
        MESSAGE S398(00) WITH 'No Data found for'(013)
        'Given Selection Critirea'(017).
        LEAVE LIST-PROCESSING.
      ENDIF.
    ENDIF.
    *&      Form  get_dead_stock
          text
    FORM GET_DEAD_STOCK .
      LOOP AT T_HEADER.
        SORT T_MSEG BY MATNR WERKS BUDAT DESCENDING MBLNR DESCENDING.
        LOOP AT T_MSEG WHERE MATNR = T_HEADER-MATNR
                         AND WERKS = T_HEADER-BWKEY
                         AND ( BWART = '101' OR
                               BWART = '105' OR
                               BWART = '501' OR
                               BWART = '531' OR
                               BWART = '561' OR
                               BWART = '701' OR
                               BWART = '309' OR
                               BWART = '301' OR
                               BWART = '131' ).
          IF T_MSEG-BWART = 101.
            READ TABLE T_MSEG WITH KEY LFBNR = T_MSEG-MBLNR
                                       LFBJA = T_MSEG-MJAHR
                                       LFPOS = T_MSEG-ZEILE
                                       BWART = 102.
            IF SY-SUBRC = 0.
              T_MSEG-MARK = 'X'.
              MODIFY T_MSEG.
              CONTINUE.
            ENDIF.
            READ TABLE T_MSEG INTO WA_MSEG WITH KEY LFBNR = T_MSEG-MBLNR
                                       LFBJA = T_MSEG-MJAHR
                                       LFPOS = T_MSEG-ZEILE
                                       BWART = 122.
            IF SY-SUBRC = 0.
              READ TABLE T_MSEG INTO WA_MSEG1 WITH KEY LFBNR = WA_MSEG-MBLNR
                                         LFBJA = WA_MSEG-MJAHR
                                         LFPOS = WA_MSEG-ZEILE
                                         BWART = 123.
              IF SY-SUBRC EQ 0.
                WA_MSEG-MARK = 'X'.
                MODIFY T_MSEG FROM WA_MSEG.
                CONTINUE.
              ELSE.
                IF T_MSEG-MENGE EQ WA_MSEG-MENGE.
                  T_MSEG-MARK = 'X'.
                  MODIFY T_MSEG.
                  CONTINUE.
                ELSE.
                  T_MSEG-MENGE = T_MSEG-MENGE - WA_MSEG-MENGE.
                  MODIFY T_MSEG.
                ENDIF.
              ENDIF.
            ENDIF.
          ELSEIF T_MSEG-BWART = 105.
            READ TABLE T_MSEG INTO WA_MSEG WITH KEY LFBNR = T_MSEG-MBLNR
                                       LFBJA = T_MSEG-MJAHR
                                       LFPOS = T_MSEG-ZEILE
                                       BWART = 106.
            IF SY-SUBRC = 0.
              T_MSEG-MARK = 'X'.
              MODIFY T_MSEG.
              CONTINUE.
            ENDIF.
          ELSEIF T_MSEG-BWART = 131.
            READ TABLE T_MSEG INTO WA_MSEG WITH KEY LFBNR = T_MSEG-MBLNR
                                       LFBJA = T_MSEG-MJAHR
                                       LFPOS = T_MSEG-ZEILE
                                       BWART = 132.
            IF SY-SUBRC = 0.
              T_MSEG-MARK = 'X'.
              MODIFY T_MSEG.
              CONTINUE.
            ENDIF.
          ELSEIF T_MSEG-BWART = 501.
            READ TABLE T_MSEG WITH KEY LFBNR = T_MSEG-MBLNR
                                       LFBJA = T_MSEG-MJAHR
                                       LFPOS = T_MSEG-ZEILE
                                       BWART = 502.
            IF SY-SUBRC = 0.
              T_MSEG-MARK = 'X'.
              MODIFY T_MSEG.
              CONTINUE.
            ENDIF.
          ELSEIF T_MSEG-BWART = 301.
            READ TABLE T_MSEG WITH KEY LFBNR = T_MSEG-MBLNR
                                       LFBJA = T_MSEG-MJAHR
                                       LFPOS = T_MSEG-ZEILE
                                       BWART = 302.
            IF SY-SUBRC = 0.
              T_MSEG-MARK = 'X'.
              MODIFY T_MSEG.
              CONTINUE.
            ENDIF.
          ELSEIF T_MSEG-BWART = 531.
            READ TABLE T_MSEG WITH KEY LFBNR = T_MSEG-MBLNR
                                       LFBJA = T_MSEG-MJAHR
                                       LFPOS = T_MSEG-ZEILE
                                       BWART = 532.
            IF SY-SUBRC = 0.
              T_MSEG-MARK = 'X'.
              MODIFY T_MSEG.
              CONTINUE.
            ENDIF.
          ELSEIF T_MSEG-BWART = 561.
            READ TABLE T_MSEG WITH KEY LFBNR = T_MSEG-MBLNR
                                       LFBJA = T_MSEG-MJAHR
                                       LFPOS = T_MSEG-ZEILE
                                       BWART = 562.
            IF SY-SUBRC = 0.
              T_MSEG-MARK = 'X'.
              MODIFY T_MSEG.
              CONTINUE.
            ENDIF.
          ELSEIF T_MSEG-BWART = 701.
            READ TABLE T_MSEG WITH KEY LFBNR = T_MSEG-MBLNR
                                       LFBJA = T_MSEG-MJAHR
                                       LFPOS = T_MSEG-ZEILE
                                       BWART = 702.
            IF SY-SUBRC = 0.
              T_MSEG-MARK = 'X'.
              MODIFY T_MSEG.
              CONTINUE.
            ENDIF.
          ELSEIF T_MSEG-BWART = 309.
            READ TABLE T_MSEG WITH KEY LFBNR = T_MSEG-MBLNR
                                       LFBJA = T_MSEG-MJAHR
                                       LFPOS = T_MSEG-ZEILE
                                       BWART = 310.
            IF SY-SUBRC = 0.
              T_MSEG-MARK = 'X'.
              MODIFY T_MSEG.
              CONTINUE.
            ELSEIF T_MSEG-XAUTO = ' '.
              T_MSEG-MARK = 'X'.
              MODIFY T_MSEG.
              CONTINUE.
            ELSEIF T_MSEG-MATNR EQ T_MSEG-UMMAT.
              T_MSEG-MARK = 'X'.
              MODIFY T_MSEG.
              CONTINUE.
            ENDIF.
          ENDIF.
          SELECT SINGLE EBELN INTO EKPO-EBELN FROM EKPO
                             WHERE EBELN = T_MSEG-EBELN
                               AND EBELP = T_MSEG-EBELP
                               AND KNTTP = 'K'.
          IF SY-SUBRC = 0.
            T_MSEG-MARK = 'X'.
            MODIFY T_MSEG.
            CONTINUE.
          ENDIF.
         TMENGE = TMENGE - t_mseg-MENGE.
        ENDLOOP.
      ENDLOOP.
      DELETE T_MSEG WHERE MARK = 'X'.
      DELETE T_MSEG WHERE ( BWART = '102' OR
                            BWART = '106' OR
                            BWART = '502' OR
                            BWART = '532' OR
                            BWART = '562' OR
                            BWART = '702' OR
                            BWART = '310' OR
                            BWART = '302' OR
                            BWART = '123' OR
                            BWART = '122' OR
                            BWART = '132' ).
      SORT T_HEADER BY MATNR BWKEY.
      DELETE ADJACENT DUPLICATES FROM T_HEADER COMPARING MATNR BWKEY.
      T_CUR_STOCK[] = T_MSEG[].
      SORT T_CUR_STOCK BY MATNR WERKS.
      LOOP AT T_CUR_STOCK.
        WA_MSEG = T_CUR_STOCK.
        AT END OF WERKS.
        ENDAT.
      ENDLOOP.
      LOOP AT T_HEADER.
        CLEAR L_LBKUM.
        L_LBKUM = T_HEADER-LBKUM.
        REFRESH T_ITEMS.
        CLEAR T_ITEMS.
        LOOP AT T_MSEG WHERE MATNR EQ T_HEADER-MATNR
                         AND WERKS EQ T_HEADER-BWKEY.
          T_ITEMS = T_MSEG.
          APPEND T_ITEMS.
          CLEAR T_ITEMS.
        ENDLOOP.
        SORT T_ITEMS BY BUDAT DESCENDING
                        MBLNR DESCENDING.
        CLEAR L_LBKUM.
        LOOP AT T_ITEMS.
          L_LBKUM = T_ITEMS-MENGE - T_HEADER-LBKUM.
          IF L_LBKUM GE 0.
            T_OUTPUT-MATNR = T_HEADER-MATNR.
            T_OUTPUT-WERKS = T_HEADER-BWKEY.
            T_OUTPUT-BUDAT = T_ITEMS-BUDAT.
            T_OUTPUT-MENGE = T_HEADER-LBKUM.
            APPEND T_OUTPUT.
            CLEAR T_OUTPUT.
            EXIT.
          ELSE.
            T_HEADER-LBKUM = T_HEADER-LBKUM - T_ITEMS-MENGE.
            T_OUTPUT-MATNR = T_HEADER-MATNR.
            T_OUTPUT-WERKS = T_HEADER-BWKEY.
            T_OUTPUT-BUDAT = T_ITEMS-BUDAT.
            T_OUTPUT-MENGE = T_ITEMS-MENGE.
            APPEND T_OUTPUT.
            CLEAR T_OUTPUT.
            CONTINUE.
          ENDIF.
        ENDLOOP.
      ENDLOOP.
    ENDFORM.                    " get_dead_stock
    *&      Form  DISPLAY_OUTPUT
          text
    FORM DISPLAY_OUTPUT .
      DATA: L_DAYS TYPE I.
      DATA : WA_OUTPUT LIKE T_OUTPUT.
      DATA : T_FINAL LIKE T_OUTPUT OCCURS 0 WITH HEADER LINE.
      DATA : WA_FINAL LIKE T_OUTPUT.
      DATA : L_CQTY TYPE MSEG-MENGE,
             L_CPRC TYPE MBEW-SALK3.
      DATA : L_TITLE TYPE LVC_TITLE.
      DATA : L_NAME1 TYPE T001W-NAME1.
    *C-- Not to output when the quantity is zero.
      DELETE T_OUTPUT WHERE MENGE EQ 0.
      SORT T_OUTPUT BY WERKS MATNR BUDAT.
      LOOP AT T_OUTPUT.
        T_FINAL = T_OUTPUT.
        AT NEW MATNR.
          CLEAR T_HEADER.
          READ TABLE T_HEADER WITH KEY MATNR = T_OUTPUT-MATNR
                                       BWKEY = T_OUTPUT-WERKS.
        ENDAT.
        T_FINAL-MAKTX = T_HEADER-MAKTX.
        IF T_HEADER-LBKUM GT 0.
          T_FINAL-PVAL = ( T_OUTPUT-MENGE * T_HEADER-SALK3 / T_HEADER-LBKUM ).
        ELSE.
          CLEAR T_FINAL-PVAL.
        ENDIF.
        L_CQTY = L_CQTY + T_OUTPUT-MENGE.
        IF T_HEADER-LBKUM GT 0.
          L_CPRC = L_CPRC + ( T_OUTPUT-MENGE * T_HEADER-SALK3 / T_HEADER-LBKUM ).
        ENDIF.
        CALL FUNCTION 'HR_SGPBS_YRS_MTHS_DAYS'
          EXPORTING
            BEG_DA        = T_OUTPUT-BUDAT
            END_DA        = P_DATE
          IMPORTING
            NO_CAL_DAY    = L_DAYS
          EXCEPTIONS
            DATEINT_ERROR = 1
            OTHERS        = 2.
        IF SY-SUBRC <> 0.
          WRITE : 70 'Error While Calculating days'(018) .
        ELSE.
          T_FINAL-PDAYS = L_DAYS.
        ENDIF.
        T_FINAL-CQTY = L_CQTY.
        T_FINAL-CPRC = L_CPRC.
        APPEND T_FINAL.
        AT END OF MATNR.
          CLEAR : L_CPRC, L_CQTY.
        ENDAT.
      ENDLOOP.
      PERFORM BUILD_FIELD_CATALOG.
      WA_SORT-FIELDNAME = 'MATNR'.
      WA_SORT-SPOS = '1'.
      APPEND WA_SORT TO T_SORT.
      SELECT SINGLE NAME1 FROM T001W INTO L_NAME1
      WHERE WERKS = P_WERKS.
      CONCATENATE 'Plant: ' P_WERKS ',' L_NAME1 INTO L_TITLE.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          I_CALLBACK_PROGRAM = SY-CPROG
          I_GRID_TITLE       = L_TITLE
          IT_FIELDCAT        = GRID_TAB[]
          IT_SORT            = T_SORT
          I_SAVE             = 'A'
        TABLES
          T_OUTTAB           = T_FINAL[].
    SORT T_FINAL BY WERKS MATNR BUDAT.
    LOOP AT T_FINAL.
       WRITE : /10 T_FINAL-MATNR.
       WRITE : 30 T_FINAL-WERKS.
       WRITE : 40 T_FINAL-BUDAT.
       WRITE : 50 T_FINAL-MENGE.
    **C-- FM to find the number of days between
    **C-- todays date and the posting date
       CALL FUNCTION 'HR_SGPBS_YRS_MTHS_DAYS'
         EXPORTING
           BEG_DA        = T_FINAL-BUDAT
           END_DA        = P_DATE
         IMPORTING
           NO_CAL_DAY    = L_DAYS
         EXCEPTIONS
           DATEINT_ERROR = 1
           OTHERS        = 2.
       IF SY-SUBRC <> 0.
         WRITE : 70 'Error While Calculating days'(018) .
       ELSE.
         WRITE : 70 L_DAYS.
       ENDIF.
       AT END OF MATNR.
         ULINE.
         READ TABLE T_HEADER WITH KEY MATNR = T_FINAL-MATNR
                                      BWKEY = T_FINAL-WERKS.
         IF SY-SUBRC EQ 0.
           WRITE : /1 'Total Valuated Stock', T_HEADER-LBKUM.
           WRITE : /1 'Value of total valuated Stock', T_HEADER-SALK3.
           ULINE.
         ENDIF.
       ENDAT.
    ENDLOOP.
    ENDFORM.                    " DISPLAY_OUTPUT
    *&      Form  BUILD_FIELD_CATALOG
          text
    -->  p1        text
    <--  p2        text
    FORM BUILD_FIELD_CATALOG .
      DATA : CNT1 TYPE I.
      CNT1 = CNT1 + 1.
      GRID_TAB-COL_POS = CNT1.
      GRID_TAB-SELTEXT_L = 'Material'.
      GRID_TAB-FIELDNAME = 'MATNR'.
      GRID_TAB-KEY = 'X'.
      GRID_TAB-NO_ZERO = 'X'.
      GRID_TAB-TABNAME = 'T_FINAL'.
      APPEND GRID_TAB.
      CLEAR GRID_TAB.
      CNT1 = CNT1 + 1.
      GRID_TAB-COL_POS = CNT1.
      GRID_TAB-SELTEXT_L = 'Material Description'.
      GRID_TAB-FIELDNAME = 'MAKTX'.
      GRID_TAB-OUTPUTLEN = '30'.
    GRID_TAB-KEY = 'X'.
    GRID_TAB-NO_ZERO = 'X'.
      GRID_TAB-TABNAME = 'T_FINAL'.
      APPEND GRID_TAB.
      CLEAR GRID_TAB.
      CNT1 = CNT1 + 1.
      GRID_TAB-COL_POS = CNT1.
      GRID_TAB-SELTEXT_L = 'Date of Reciept'.
      GRID_TAB-FIELDNAME = 'BUDAT'.
    GRID_TAB-KEY = 'X'.
    GRID_TAB-NO_ZERO = 'X'.
      GRID_TAB-TABNAME = 'T_FINAL'.
      APPEND GRID_TAB.
      CLEAR GRID_TAB.
      CNT1 = CNT1 + 1.
      GRID_TAB-COL_POS = CNT1.
      GRID_TAB-SELTEXT_L = 'Quantity'.
      GRID_TAB-FIELDNAME = 'MENGE'.
    GRID_TAB-KEY = 'X'.
    GRID_TAB-NO_ZERO = 'X'.
      GRID_TAB-TABNAME = 'T_FINAL'.
      APPEND GRID_TAB.
      CLEAR GRID_TAB.
      CNT1 = CNT1 + 1.
      GRID_TAB-COL_POS = CNT1.
      GRID_TAB-SELTEXT_L = 'Pending Days'.
      GRID_TAB-FIELDNAME = 'PDAYS'.
    GRID_TAB-KEY = 'X'.
    GRID_TAB-NO_ZERO = 'X'.
      GRID_TAB-TABNAME = 'T_FINAL'.
      APPEND GRID_TAB.
      CLEAR GRID_TAB.
      CNT1 = CNT1 + 1.
      GRID_TAB-COL_POS = CNT1.
      GRID_TAB-SELTEXT_L = 'Value'.
      GRID_TAB-FIELDNAME = 'PVAL'.
    GRID_TAB-KEY = 'X'.
    GRID_TAB-NO_ZERO = 'X'.
      GRID_TAB-TABNAME = 'T_FINAL'.
      APPEND GRID_TAB.
      CLEAR GRID_TAB.
      CNT1 = CNT1 + 1.
      GRID_TAB-COL_POS = CNT1.
      GRID_TAB-SELTEXT_L = 'Cumulative Quantity'.
      GRID_TAB-FIELDNAME = 'CQTY'.
    GRID_TAB-KEY = 'X'.
    GRID_TAB-NO_ZERO = 'X'.
      GRID_TAB-TABNAME = 'T_FINAL'.
      APPEND GRID_TAB.
      CLEAR GRID_TAB.
      CNT1 = CNT1 + 1.
      GRID_TAB-COL_POS = CNT1.
      GRID_TAB-SELTEXT_L = 'Value of Cumulative Quantity'.
      GRID_TAB-OUTPUTLEN = '30'.
      GRID_TAB-FIELDNAME = 'CPRC'.
    GRID_TAB-KEY = 'X'.
    GRID_TAB-NO_ZERO = 'X'.
      GRID_TAB-TABNAME = 'T_FINAL'.
      APPEND GRID_TAB.
    ENDFORM.                    " BUILD_FIELD_CATALOG

  • Closing Stock of a particular date:Function Module

    Hello Experts,
    I m developig a report in which I want Closing Stock amount of a particular date.
    Is there any funtion module for this, as in tables S031, mard I m getting Closing Stock as on date.
    Pls suggest
    Priyanka

    Hi Priyanka,
    I didnt find any function module for this purpose.
    You can create your FM for this purpose.
    You can refer following thread for the reference:
    Re: closing stock of a particular date
    Closing Stock of a Material
    Re: Stock on a particulare date
    Hope this will help.
    Regards,
    Nitin.

  • Highest stock value on particular date.

    Hi all,
    Where we can find the highest stock value for particular material for particular date .
    for the insurance purpose, we want to identify on which date highest stock value is lying with us.
    Thanks & Regards,
    Vinay Patel

    Hi Hareesha,
    You have given me transaction code for mean stock & mean value.This is not solution for my question
    total stock    total value          date
    100                   500             01.02.2007
      50                    300            02.02.2007
    200                  600             03.02.2007
    225                   580             04.02.2007
    so here 0n 03.02.2007 its showing highest value.
    Thanks & Regards,
    Vinay Patel

  • Logic to build report to get the stock on a particular date

    Dear Guru's,
    We are trying to build a report for getting the stock on a particular date. It is not possible to copy MB5B that option is ruled out. We have also tried to get the data from MBEWH but that is also  not helping as the table is not updated for all the periods.
    Please advice
    Thanks,
    Sam

    Dear Sameer,
    You can copy MB5B report and can modify as per your reuirement.
    If you want get stock a paticular date.It is hard to get, why because you have to fetch all the Material documents
    and you have to use MBEW table to get the current date stock and you have to do add/subtract from calculated stock.
    Due to this there will performance issues also.
    So try to copy MB5B and change as per your requirement.
    regards
    Subhash

  • Stock on a particulare date

    Hi,
    i am developing a STOCk-in-transit report, wherein , i need to display stock on a date entered by the user on selection screen. The stock includes all stock type (unrestricted, quality and blocked stock). How do we calculate the stock on a particular date?

    check out the logic in this program if it helps...
    TABLES : MARA,MAKT,MARD,t001w,stpo,stas.
    data : begin of t_mara occurs 0,
           matnr like mara-matnr,
           end of t_mara.
    data : begin of t_mard occurs 0,
           matnr like mara-matnr,
           werks like mard-werks,
           labst like mard-labst,
           insme like mard-insme,
           speme like mard-speme,
           end of t_mard.
    data : l_stk1 like mard-labst,
           l_stk2 like mard-insme,
           l_stk3 like mard-speme.
    ----   BOM -
    DATA : BEGIN OF it_mast OCCURS 0,
            matnr LIKE mast-matnr,
            werks LIKE mast-werks,
            stlan LIKE mast-stlan,
            stlnr LIKE mast-stlnr,
            stlal LIKE mast-stlal,
           END OF it_mast.
    DATA : BEGIN OF wa_mast OCCURS 0,
           matnr LIKE mast-matnr,
           werks LIKE mast-werks,
           stlan LIKE mast-stlan,
           stlnr LIKE mast-stlnr,
           stlal LIKE mast-stlal,
          END OF wa_mast.
    DATA : BEGIN OF it_mast1 OCCURS 0,
            matnr LIKE mast-matnr,
            werks LIKE mast-werks,
            stlan LIKE mast-stlan,
            stlnr LIKE mast-stlnr,
            stlal LIKE mast-stlal,
           END OF it_mast1.
    DATA : BEGIN OF it_stas OCCURS 0,
            stlty LIKE stas-stlty,
            stlnr LIKE stas-stlnr,
            stlal LIKE stas-stlal,
            stlkn LIKE stas-stlkn,
            stasz LIKE stas-stasz,
            datuv LIKE stas-datuv,
            stvkn LIKE stas-stvkn,
           END OF it_stas.
    DATA : BEGIN OF it_stpo OCCURS 0,
            stlty LIKE stpo-stlty,
            stlnr LIKE stpo-stlnr,
            stlkn LIKE stpo-stlkn,
            stpoz LIKE stpo-stpoz,
            idnrk LIKE stpo-idnrk,
            meins LIKE stpo-meins,
            menge LIKE stpo-menge,
           END OF it_stpo.
    DATA : BEGIN OF t_stpo OCCURS 0,
            stlty LIKE stpo-stlty,
            stlnr LIKE stpo-stlnr,
            stlkn LIKE stpo-stlkn,
            stpoz LIKE stpo-stpoz,
            idnrk LIKE stpo-idnrk,
            meins LIKE stpo-meins,
            menge LIKE stpo-menge,
           END OF t_stpo.
    DATA : BEGIN OF wa_stpo1 OCCURS 0,
            stlty LIKE stpo-stlty,
            stlnr LIKE stpo-stlnr,
            stlkn LIKE stpo-stlkn,
            stpoz LIKE stpo-stpoz,
            idnrk LIKE stpo-idnrk,
            meins LIKE stpo-meins,
            menge LIKE stpo-menge,
           END OF wa_stpo1.
    data: begin of it_final occurs 0,
          stlnr like stpo-stlnr,
          matnr like mast-matnr,
          menge like stpo-menge,
    end of it_final.
    data: begin of it_final1 occurs 0,
          stlnr like stpo-stlnr,
          matnr like mast-matnr,
          menge like stpo-menge,
    end of it_final1.
    data mult_par type c.
    -- END OF BOM--
    data: WA_TOTSTK like mard-speme.
    data G_Matno like mara-matnr.
    data bom_req_qty like mard-speme.
    data WA_AVLSTUS like mard-speme.
    select-options: S_Matno FOR mara-matnr.
    parameterS     : P_plant like t001w-werks,
                     P_BOM like mara-matnr.
    perform validation.
    perform Inputdata.
    perform Calcdata.
    form validation.
    if S_Matno is initial.
    message e001 with text-001.
    ENDIF.
    if P_plant is initial.
    message e001 with text-002.
    endif.
    if P_BOM is initial.
    message e001 with text-003.
    endif.
    select matnr from mara INTO table t_mara
                      where matnr in S_Matno.
    if sy-subrc <> 0.
    message e001 with text-004.
    endif.
    select single * from t001w where werks = P_plant.
    if sy-subrc <> 0.
    message e001 with text-005.
    endif.
    select single * from mara where matnr = P_BOM.
    if sy-subrc <> 0.
    message e001 with text-004.
    endif.
    endform.
    form Inputdata.
    select matnr from mara into table t_mara
                    where matnr in S_Matno.
    if sy-subrc = 0.
    select matnr werks labst insme speme from
                          mard into table t_mard
                          for all entries in t_mara
                          where matnr = t_mara-matnr and
                                werks = P_plant.
    endif.
    endform.
    form Calcdata.
    loop at t_mara.
    select single * from makt where matnr = t_mara-matnr.
    if sy-subrc = 0.
    G_Matno = t_mara-matnr.
    *WRITE:/ SY-ULINE(164).
    WRITE:1 sy-vline.
    write:2 t_mara-matnr.
    write:19 sy-vline.
    write:20 makt-maktx.
    write:56 sy-vline.
    endif.
    loop at t_mard.
    if t_mard-matnr = t_mara-matnr.
    l_stk1 = l_stk1 + t_mard-labst.
    l_stk2 = l_stk2 + t_mard-insme.
    l_stk3 = l_stk3 + t_mard-speme.
    endif.
    endloop.
    write:57 l_stk1.
    write:74 sy-vline.
    write:75 l_stk2.
    write:92 sy-vline.
    write:93 l_stk3.
    write:110 sy-vline.
    WA_TOTSTK = l_stk1 + l_stk2 + l_stk3.
    write:111 WA_TOTSTK.
    WRITE:128 SY-VLINE.
    perform BOMDATA.
    write:129 bom_req_qty.
    write:146 sy-vline.
    if bom_req_qty >= 1.
    WA_AVLSTUS = ( ( 1 / bom_req_qty ) * WA_TOTSTK ).
    else.
    WA_AVLSTUS = '0.00'.
    ENDIF.
    write:147 WA_AVLSTUS.
    write:164 sy-vline.
    write:sy-uline(164).
    clear l_stk1.
    clear l_stk2.
    clear l_stk3.
    clear bom_req_qty.
    clear WA_TOTSTK.
    endloop.
    endform.
    FORM BOMDATA.
    select matnr werks stlan stlnr stlal from mast into
                                    table it_mast
                             where matnr = P_BOM and stlal = '01' and stlan = '1'
                                   and werks = P_plant.
    if sy-subrc = 0.
      select stlty stlnr stlal stlkn stasz datuv stvkn from stas
                                   into table it_stas
                                 for all entries in it_mast
                                 where stlnr = it_mast-stlnr and
                                       stlal = it_mast-stlal and
                                       stlty = 'M'.
      if sy-subrc = 0.
        SELECT stlty stlnr stlkn stpoz idnrk meins menge from stpo into table it_stpo
                                  for all entries in it_stas
                                  where stlty = 'M' and
                                        stlnr = it_stas-stlnr and
                                        stlkn = it_stas-stlkn.
    endif.
    endif.
    perform get_data.
    perform process_data.
    perform display_data.
    ENDFORM.
    form process_data.
      if mult_par = 'Y'.
        refresh it_stpo.
        loop at wa_mast.
          select matnr werks stlan stlnr stlal from mast into table it_mast
                                      where matnr = wa_mast-matnr
                                      and stlal = '01' and stlan = '1'.
          if sy-subrc = 0.
            loop at it_mast.
              SELECT stlty stlnr stlkn stpoz idnrk meins menge from stpo into table wa_stpo1
                                               where stlnr = it_mast-stlnr.
              if sy-subrc = 0.
              clear wa_stpo1.
                loop at wa_stpo1.
                  read table t_stpo with key idnrk = wa_mast-matnr.
                  if t_stpo-menge > 1.
                  it_stpo-stlty = wa_stpo1-stlty.
                  it_stpo-stlnr = wa_stpo1-stlnr.
                  it_stpo-stlkn = wa_stpo1-stlkn.
                  it_stpo-idnrk = wa_stpo1-idnrk.
                  it_stpo-meins = wa_stpo1-meins.
                  it_stpo-menge = wa_stpo1-menge * 2.
                  else.
                  move-corresponding wa_stpo1 to it_stpo.
                  endif.
                  append it_stpo.
                  clear wa_stpo1.
                  clear it_stpo.
                endloop.
                refresh wa_stpo1.
                clear wa_mast.
              endif.
            endloop.
          endif.
        endloop.
        refresh wa_mast.
        perform get_data.
      ELSE.
        perform display_data.
      endif.
    endform.                    "process_data
    form get_data.
      loop at it_stpo.
        select matnr werks stlan stlnr stlal from mast into
                                      table it_mast
                               where matnr = it_stpo-idnrk
                                     and stlal = '01' and stlan = '1'.
        if not it_mast[] is initial.
          loop at it_mast.
            move-corresponding it_mast to wa_mast.
            append wa_mast.
            move-corresponding it_stpo to t_stpo.
            append t_stpo.
          endloop.
          clear t_stpo.
        else.
          it_final-stlnr = it_stpo-stlnr.
          it_final-matnr = it_stpo-idnrk.
          it_final-menge = it_stpo-menge.
          append it_final.
        endif.
      endloop.
      if not wa_mast[] is initial.
        mult_par = 'Y'.
        clear it_stpo.
      else.
        mult_par = ''.
      endif.
      loop at it_final.
        move-corresponding it_final to it_final1.
        append it_final1.
      endloop.
      refresh it_final.
      refresh it_mast.
      perform process_data.
    endform.                    "get_data
    form display_data.
      sort it_final1 by matnr.
      loop at it_final1.
        if it_final1-matnr = G_Matno.
          bom_req_qty = bom_req_qty + it_final1-menge.
        endif.
      endloop.
      refresh it_stpo.
      refresh it_mast.
      clear it_final1.
      REFRESH it_final1.
    endform.                    "display_data
    TOP-OF-PAGE.
    WRITE:/ SY-ULINE(164).
    WRITE:/1 SY-VLINE,
           2 'Part Number',
           19 sy-vline,
           20 'Description',
           56 sy-vline,
           57 'Unrestricted Qty',
           74 sy-vline,
           75 'Quality Qty',
           92 sy-vline,
           93 'Blocked Qty',
           110 sy-vline,
           111 'Tot. Avl. Stk',
           128 sy-vline,
           129 '   Q/E   ',
           146 SY-VLINE,
           147 'Avl Status',
           164 sy-vline.
    WRITE:SY-ULINE(164).
    Regards,
    Bikash

  • Vendor Stock On A Particular Date

    Hi,
    How can we see the Vendor Stock on a Particular Date.
    For example, today is 04.08.2007, and actually we want to see the Stock of a Vendor as on 31.03.2007.
    Regards.

    PK Karn
    Vendor stock is dynamic report so cant get from any t.code
    Try to make use of material document and extract the data from table
    Thanks
    Bala

  • Installed Base(ibase) data for segmentation/maintaining customer marketing

    There is a need to use Installed Base(ibase) data for segmentation/maintaining customer marketing attributes e.g. whether customer on active support agreement(yes/no), product line, version no., etc.
    So if the ibase data is updated, the changes should flow back to segmentation/marketing attributes of the business partner/
    Please help with any approach which can be useful in this scenario.
    Edited by: ankitarora on May 4, 2011 12:42 PM

    Please find the reply for your query,,,,,these are the related information
    LIST OF DATA SOURCE
    CRM IBase Transaction Data
    0CRM_SRV_IBASE_TRAN
    CRM IBase Master Data  
    Technical name: 0CRM_SRV_IBASE_ATTR
    Installed Base Category - DataSource for Texts  
    Technical name: 0CRM_IBTYPE_TXT
    Characteristic for IBase or Component - DataSource for Texts   
    Technical name: 0CRM_IBFLAG_TXT
    GUID of Installed Base/Component - DataSource for Texts  
    Technical name: 0CRM_IBAKEY_TXT
    IBase Text Component - DataSource for Texts  
    Technical name: 0CRM_IBTEXT_TXT
    DSO:
    CRM Service - Installed Bases and Components  
    Technical name: 0CRM_IBCO
    QUERYS
    Installed Base Analysis by Location  
    Technical name: 0CRM_IBCO_Q0101
    Installed Base Analysis by Business Partner  
    Technical name: 0CRM_IBCO_Q0104
    Analysis of Products in Installed Bases  
    Technical name: 0CRM_IBCO_Q0102
    Analysis of Individual Objects in IBase Components  
    Technical name: 0CRM_IBCO_Q0103
    More information
    http://help.sap.com/saphelp_nw70/helpdata/EN/ef/c4e1edcb84fa4abd6ddd00130de600/frameset.htm
    For more information, see the CRM documentation under mySAP Business Suite à mySAP Customer Relationship Management à CRM Enterprise à Analytics à Service Analytics.
    Regards
    Srini

  • If there is no data for a specific row, please don't show the row at all.

    Hi,
    If there is no data for a specific row, please don't show the row at all.
    how can this be done??
    Thanks in advance.

    Not clear no data for row?
    Did you try with Pivot table? that should take care of it.
    Let us know updates

  • Partner functions for a specific customer not seen in XD03 but appears in XD02

    Hello SAP Gurus,
    I have a situation where a partner functions for a specific customer not seen in XD03 but appears in XD02, In XD03 only one partner function (Ship to) appears but in XD02 (Sold to, Ship to, Bill to and payer appears), from the customer master I can see that account group for this customer has been changes to Sold to (Z001) from Ship to (Z002).
    I checked in settings for OB20 transaction for display customer centrally, it is in Display mode as required and not suprresed would like your inputs as to why this is happening and what can be done to fix this.
    Thanks and Regards
    Mohammed Roshan

    Hi ROshan,
      Open customer master in XD02  sales view and save it then check in XD03 it should display the partner functions.
    As you said the account group has been changed I think the records needs to be saved again.

  • US Unit of Measure (UOM) conversion to British UOM for a specific customer

    Hi SAP Guru’s,
    How can I convert the US Unit of Measure (UOM) for materials to British UOM for a specific customer? I want to keep the US UOM for all the other customers.
    Thanks,
    Best regards,
    Ketan

    Hi
    It should be available check for the field in customer info record for UOM & key in for requried UOM.
    If you get in touch with SD person they will help you to resolve this issue.
    Regards

  • Stock on a particular date

    Dear All,
    I am creating a customised report for showing all the importatnt data (like stock, consumption, production, sale in one report) at client level.
    In this report I am required to show the stock of material on a particular date, entered by the user in the selection screen.
    (In stanard SAP, report MB5B servers the purpose.)
    Can you please suggest how can I get the same information in the customised report.?
    (I do not prefer using method: month opening stock + total receipts - total consumption)
    Is there any alternative way?
    Thanks and regards
    Sarang

    Hi
    The MB5B report gives you all the data, if you donot want some of the data, copy the Report, & from the Output Parameters remove the Fields which you dont want.
    if you want the ALV functionality add the same to that.
    Thanks & Regards
    Kishore

  • Valuated stock as on particular date such as end of the  month

    Dear Guru,
    Can anyone help me out by telling me about  "How to get periodic valuated stock quantity i.e. stock for particular plant , storage location as on end of particular month or as on particular date?"
    Thanks in advance.
    regards,
    Manerkar Sameer
    Moderator message: please do more research before posting, e.g. ask your functional contact person.
    Edited by: Thomas Zloch on Nov 18, 2011 1:18 PM

    Hi,
    Material is valuated or not depends on Material Type. So, in your case you need to know which material types are valuated. In standard SAP system Material Type UNBW and NLAG are not valuated in term of price, generally others are!
    For a particular material: MMBE(Standard report) or MM02 (Accounting view).
    Hope helped
    Reetesh

  • Stock as on particular date

    Hi guys,
    Can we get stock of any material as on a specified date without using mb5b?  Which table will store this data?
    Please help me out on this
    thanks in advance
    sai

    Hello Chintu,
    MB5B is the best report to get material stock on specific date.
    There is no direct table which stores stock on particular date, but SAP system calculates strategically with GR, GI and material transfers to get this data. If you want report on that then I think need to develop it.
    Does MB5B not meet your requirement? Pl. explain the requirement so we can suggest accordingly.
    Regards
    Arif Mansuri

  • Query for onhand  qunatity  with particular date  for eam

    hi all ,
    following query are showing wrong value for on hand quantity with particular date mean work order issue date for quantity .
    can u show me where is problem in this query.
    SELECT   ood.organization_name, wrov.concatenated_segments item_number,
             wrov.item_description description, wrov.item_primary_uom_code uom,
            -- SUM (on_hand.on_hand) quantity_in_stock,
              SUM (on_hand.on_hand) + wrov.quantity_issued quantity_in_stock,
             we.wip_entity_name work_order_number,
             TRUNC (we.creation_date) work_order_date,
             fu.user_name work_order_made_by, wrov.quantity_issued,
             trunc(cic.material_cost,2) issue_rate_per_qty,
             wrov.quantity_issued * trunc(cic.material_cost,2) quantity_value,
             --SUM (on_hand.on_hand) - wrov.quantity_issued balace_qty,
             SUM (on_hand.on_hand)  balace_qty,
               SUM (on_hand.on_hand)
             * trunc(cic.material_cost,2) COST,
             eam.ATTRIBUTE1 EQUIPEMENT_NO
            --  gcc.SEGMENT6 equipement_no
        FROM wip_entities we,
             wip_requirement_operations_v wrov,
             org_organization_definitions ood,
             mtl_onhand_total_mwb_v on_hand,
             fnd_user fu,
             cst_item_costs cic,
             eam_work_orders_v eam
    --                    gl_code_combinations gcc,
    --                    WIP_TRANSACTION_ACCOUNTS  wta ,
    --                    WIP_TRANSACTIONS wt
       WHERE wrov.wip_entity_id = we.wip_entity_id
         AND ood.organization_id = wrov.organization_id
         AND wrov.inventory_item_id = on_hand.inventory_item_id
         AND on_hand.organization_id = ood.organization_id
         AND we.created_by = fu.user_id(+)
         AND cic.inventory_item_id = wrov.inventory_item_id
         AND cic.organization_id = wrov.organization_id
         --AND we.wip_entity_name = '179542'
         AND wrov.organization_id = nvl(:organization_id,wrov.organization_id)
                AND (we.wip_entity_name = :job_order_No OR :job_order_No IS NULL)
                and trunc(we.creation_date) between  nvl(:from_date ,trunc(we.creation_date)) and nvl(:too_date ,trunc(we.creation_date))
               and eam.WIP_ENTITY_NAME=we.wip_entity_name
               and eam.WORK_ORDER_STATUS in('Complete','Complete - No Charges' ,'Released')
    --                 and gcc.CODE_COMBINATION_ID  =wta.REFERENCE_ACCOUNT
    --                 and wta.TRANSACTION_ID =wt.TRANSACTION_ID
    --                 and we.wip_entity_id  =wta.WIP_ENTITY_ID
    GROUP BY ood.organization_name,
             wrov.concatenated_segments,
             wrov.item_description,
             wrov.item_primary_uom_code,
             we.wip_entity_name,
             we.creation_date,
             fu.user_name,
             wrov.quantity_issued,
             cic.material_cost,
              eam.ATTRIBUTE1
           --  gcc.SEGMENT6
           order by we.wip_entity_name

    I don't think there is any special predicate to do that, Code is simply getting all children of given asset and returning them (Offcource there is some ordering logic). If You want exact informaiton I would suggest to use json call that DAM is making i.e.
    HOST:POST/<PATH OF DAM>.assets.json
    Or decompile AssetListServlet.java ans see how it is implemeted
    Yogesh
    www.wemblog.com

Maybe you are looking for

  • Read an excel file using java code

    Hi, I want to create an excel file on the client machine based on the personal details entered on the web page. And I want to save the file on the client machine in the form of CSV. Then I want to read the contents of the spreadsheet using Java Code

  • Date Issue very urgent

    Hi Experts, I am having SY-DATUM. Based on SY-DATUM i required next month first date and after three month end date of the month.

  • There are flickering in my flex website?

    i've developed a personal portfolio in http://abhilash.co.nr , i just created it to learn flex!! whenever i navigate through different states, i get images flickering? like i've embedded an swf which has a book functionality, all images have been use

  • Can an object know it's creator?

    Can an object determine which object created it? That is, which object called the constructor that brought it into existence? (without passing this in as a parameter to the constructor).

  • Jdeveloper install on os x lion (10.7.5)

    Hi, I'm trying to install jdeveloper 11.2.3 on os x lion (10.7.5).. I followed the directions "Installing JDeveloper on Mac OS X Lion" by Shay Shmeltzer and I was not able to go pass the JDK selection. I also followed Chris Muir thread on this topic