GL balance reupload as of a particular date

Hi.
We need to zero all GL balances upto a certain date (31.03.2007). A certain number of entries have been done before this date but they are not complete. Hence the account balances are not correct. It is a lot of effort to do all those entries. Similarly it is not possible to pass reverse entries to make the balances zero.
Initialize the records so that we can do a fresh upload of balances on a particular date and do entries after that date.
Can anyone help with this? What would be a good way of doing this?
nms

HI,
    I am working on FI report, where i need to calculate the G/L account closing balance on a daily basis, which will be used as the opening balance for the next day, please help me out with some sample report or logic to claculate the closing balance day wise.
u can mail me to :[email protected]
Regards
Soyunee.

Similar Messages

  • How to see the customer balance as on particular date wise

    hello expert,
    i want to see the customer balance as on particular date wise.  i have already search the given standard t code. is there any option to see the report. please advice me.
    Thanks and regards
    konishko
    Moderator: Search SDN

    Hi,
    Please try reports S_ALR_87012168/S_ALR_87012174.
    Regards,
    SAPFICO

  • GL Account balance as of a particular date

    Hi,
    Is there a report in SAP that gives GL account balances as of a particular date.
    Thanks,
    Ram

    HI,
        I am working on FI report, where i need to calculate the G/L account closing balance on a daily basis, which will be used as the opening balance for the next day, please help me out with some sample report or logic to claculate the closing balance day wise.
    u can mail me to :[email protected]
    Regards
    Soyunee.

  • Trial Balance as on particular Date

    Hi
    Please tell me the T.Code For Trial Balance as on particular Date.
    Moderator: Please, search SDN

    As per your message it seems your client gone live production on 01.01.2009.  The legacy balances might have uploaded with posting date 01.01.2009 with document type US. After uploading you are trying to see the opening trial balance.
    In SAP date wise trial balance concept is not there.  We have so many reports for trial balance for periodical basis not date specific.  I have checked the dynamic selections option, for document type.  Even if we found the document type option in dynamic selections, there we can give document type US and period 01/2009.

  • Closing stock as off a particular date

    How to write a query for closing stock (in quantity) for all items by group by warehouse for a particular date?
    Thank you.

    the standard stock count in SAP B1 (Inventory>> Inventory Transaction >> Initital Quantity, Inventory Tracking, Stock Posting) is "real time" and not back-dated and the screen will display all items irrespective whether there is stock balance in the system.   Anyone has a query where able to have the stock balance generated at any cut-off date, i.e. the stock count can be back-dated and only display those items with quantity (in the system) as at that cut-off date .
    Thank you.

  • Balance sheet view on a specific date

    Hi
    Can anyone tell me, how to see balance sheet on a particular date.....
    Thanks
    Radha

    Hi
    Follow the steps below to see balance sheet by date
    T.Code: F.01-Balance Sheet/P&L Statement:
    Under the tab:Special Evaluations->Alternate Period Selection->Calendar Reporting Period->Select the Date Range.

  • Item Cost of Items on a particular date

    HI All,
    We need to get the item cost of items on a particular date.
    I have tested the following but it gives multiple results:
    SELECT T0.ItemCode, Max(T0.Dscription) 'Item Name',T0.CalcPrice
    FROM OINM T0
    WHERE T0.DocDate = [%0]
    GROUP BY T0.ItemCode, T0.Calcprice
    I have checked the audit report too but it shows the current item cost.
    is there a way to get the desired data?
    Thanks,
    Joseph

    Hi Joseph,
    Try this. I've been using this and giving me correct details.
    SELECT
    T3.WhsCode 'Whse Code', T3.WhsName 'Whse Name', T0.[ItemCode], T1.[ItemName],
    sum(T0.[InQty] - T0.[OutQty]) 'OnHand', O2.CalcPrice/sum(T0.[InQty] - T0.[OutQty]) 'Cost'
    FROM OINM T0 
    INNER JOIN OITM T1 ON T0.ItemCode = T1.ItemCode
    INNER JOIN OITB T2 ON T1.ItmsGrpCod = T2.ItmsGrpCod
    INNER JOIN OWHS T3 ON T0.[Warehouse] = T3.WhsCode
    INNER JOIN
    SELECT DISTINCT o.Warehouse, o.ItemCode, o.Balance CalcPrice
    FROM OINM O  INNER JOIN
      SELECT T0.[Warehouse] 'Whse', T0.[ItemCode] 'Code', MAX(T0.[CreateDate]) 'cDate' , MAX(T0.TransNum) '#'
      FROM OINM T0 WHERE T0.[CreateDate] <= '[%1]'
      GROUP BY T0.[Warehouse], T0.[ItemCode]
    ) O1 ON O.Warehouse = O1.Whse and O.ItemCode = O1.Code and O.CreateDate = O1.cDate and O.TransNum=O1.#
    ) O2 ON T0.Warehouse = O2.Warehouse and T0.[ItemCode] = O2.ItemCode
    WHERE
    T0.[CreateDate] <= '[%1]'
    and T1.[ItemName] = '[%2]'
    GROUP BY T3.WhsCode, T3.WhsName, T0.[ItemCode], T1.[ItemName], O2.CalcPrice
    HAVING (sum(T0.[InQty] - T0.[OutQty]) <> 0)
    ORDER BY T3.WhsCode, T0.[ItemCode]
    you can also modify it to fit your needs.
    Regards,

  • Closing Stock on Particular Date(MB5B Tcode)

    Hi Experts,
    I need closing stock as on some particular date. For e.g. closing stock as on 28.02.2014.
    In my requirement i have to use that closing stock value for further calculations in a new customized report.I can see closing stock value by using MB5B tcode.
    Please suggest some way to get closing stock as on some date so that i can use that in my Report.
    Can i directly call MB5B transaction in my Report and get closing stock value?
    Thanks & Regards,
    Pankaj

    Hello Pankaj,
    In your Customised Report use MKPF and MSEG table
    MKPF ----->  Material and date range as the input
    Then Pass Material document number from MKPF to MSEG table
    MSEG ----->  based on material document number from mkpf
    Create Temporary  variable
    values comes from the mseg where have credit and debit entries
    if debit entry "S" then subtract the values of the Mseg table from the temporary variable1
    if credit entry "H" then Add the values of the mseg table to the temporary variable2
    finally Add the temporary variable1 and temporary variable 2 and get the total stock.

  • Functional Specification For Opening And closing stock On Particular Date

    Dear Gurus,
    I am creating report for opening and closing stock on particular date in which batch and storage location should also be included. I want to know the tables and fields for the same.I have searched the forum and got report on month basis but I want this report on posting day basis.kindly suggest tables and fields. Thanks in Advance

    Dear sir,
    There are many other colums that client wants to add which are not present in MB5B transaction.columns which client wants to add are as follows...
    Material Number                                                   
    Material Description                                       
    Material Type                                                                        
    Material Group                                                                     
    External material Group                                                            
    Movement Type     
    Plant     
    Storage Location     
    Customer Number     
    Customer Name     
    Vendor Number     
    Vendor Name     
    Posting Date     Receipt Doc. Number
    Issue Doc. Number     
    Reference Issue Document Number     
    Opening Stock Quanity     
    Material Receipt Quantity     
    Material Issue Quantity     
    Material Closing Stock Quantity      
    Value Of Closing Stock
    And for this I want  tables and logic for the same. kindly provide the solution for the same.

  • 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

  • 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

  • Stock on particular date (performance issue)

    Hi Folks,
    I m calculating stock at all vendor on a particular date.
    But it takes very long and time_out occurs.
    I m calculating opening closing provided return and rejection based on movement types.
    The report hangs up at following particular Join.
    SELECT MKPFBUDAT MSEGBWART MSEGMATNR MSEGLIFNR SUM( MSEG~MENGE )
                  AS MENGE
                      INTO CORRESPONDING FIELDS OF TABLE IT_OPEN
                      FROM
                         MKPF INNER JOIN MSEG ON
                               MKPFMBLNR = MSEGMBLNR AND
                               MKPFMJAHR = MSEGMJAHR
                       WHERE MKPF~MJAHR = D_YEAR AND
                             MKPF~BUDAT GE D_DATE AND
                             MKPF~BUDAT LT S_BUDAT-LOW AND
                    MSEG~BWART IN ('541','542','543','544','551','702') AND
                             MSEG~XAUTO NE 'X' AND
                             MSEG~MATNR IN S_MATNR AND
                             MSEG~WERKS IN P_WERKS AND
                             MSEG~LIFNR IN P_LIFNR
                  GROUP BY LIFNR MATNR BUDAT BWART.
    Is there any way to increase performance by breaking this inner join into select statements or anyhow.
    Regards
    Sachin

    HI,
    On seeing your code, it seems like,
    SELECT MKPFBUDAT MSEGBWART MSEGMATNR MSEGLIFNR SUM( MSEG~MENGE )
    AS MENGE
    INTO CORRESPONDING FIELDS OF TABLE IT_OPEN
    FROM
    MKPF INNER JOIN MSEG ON
    MKPFMBLNR = MSEGMBLNR AND
    MKPFMJAHR = MSEGMJAHR
    WHERE MKPF~MJAHR = D_YEAR AND
    MKPF~BUDAT GE D_DATE AND
    MKPF~BUDAT LT S_BUDAT-LOW AND
    MSEG~BWART IN ('541','542','543','544','551','702') AND
    MSEG~XAUTO NE 'X' AND
    MSEG~MATNR IN S_MATNR AND
    <b>MSEG~WERKS EQ P_WERKS</b> AND
    <b>MSEG~LIFNR EQ P_LIFNR</b>
    GROUP BY LIFNR MATNR BUDAT BWART.
    Please see the code marked with bold as parameter passing in the select statement must be EQ and not IN.
    Secondly, remove the aggregate function SUM from the select. First select all the records into an internal table and either use control break statements or Collect to sum up the entries.
    Next, while selecting from the database use INTO TABLE IT_OPEN rather than into corresponding fields of table.
    Also remove the movement types from the select and restrict it inside the Loop and Endloop.
    Lakshminarayanan
    Please mark all helpful answers for points

  • Report for PO wise balance order quantity with delivery due date

    Dear Sir,
    How can we get a Report for all POs ,showing Vendor wise / PO wise  / Item wise balance item quantity along with the Delivery Due Date
    With Thanks and Regards
    B Mittal

    Dear Mr Charlie
    ME2L with Parameter WE101 and Scope EINT , do not give balance PO item quantity .We look for areport which can give PO wise balance item quantity and delivery schedule date .
    Rgds
    B Mittal

  • Particular data in a report, on the basis of the values (0, 1) of a dashboa

    hi
    User should be able to see the particular data in a report, on the basis of the values (0, 1) of a dashboard prompt.
    For e.g. if the user selects 0 then current years data should be filtered out
    and if the user selects 1 then rest all years data should be displayed in a request.
    give me hint regarding this question

    Hi,
    I hope this will help you
    http://oraclebizint.wordpress.com/2008/01/17/oracle-bi-101332-selecting-reports-from-dashboard-prompts-and-guided-navigation-sections/
    In this example he used prompt for selecting Region sales and Brand sales which you can replace with 0 and 1
    Phani.

  • OPEN PO QTY IN PARTICULAR DATE

    Hi Experts
    I need to check the open qty of purchase order bcoz i have to upload the PO from old system to new system.
    so i want to get the Open Purchase order qty from particular date say 1st april .
    so that i can upload the same into new System with upload programme.
    Thanks
    Pankaj Agarwal

    Hi
    check following link
    [Report including open purchase order quantity for one storage location;
    [http://wiki.sdn.sap.com/wiki/display/sandbox/OPENPOQTYREPORT-CODE]
    Regards
    Kailas Ugale

Maybe you are looking for

  • Recent Windows 7 Update has killed windows

    Help, I run Windows 7 in Bootcamp, recent windows 7 update has killed windows, this is what happens. Choose to boot to windows - OK Hit logon screen - OK Logon - OK Windows loads, the desktop shows for about 5 seconds and then the screen goes blank.

  • Receiving Notifications via email

    I have a user who is not receiving an email notification when a requisition is forwarded to her for approval. Can anyone tell me what could be wrong?

  • Binary form of string

    Hi All, I have written a small program which prints the addresses of the line. But, I don't know how to get the binary form of the string. How the binary form of a string? Will it be 0s and 1s or someother format? How to get the binary form of a stri

  • Yaourt and packages that have been moved from AUR to community

    Well first off, why does yaourt even wanna build the package if it has been removed? I did a search in the AUR and all I see is stress 1.0.0-1. I thought I read somewhere that yaourt is a wrapper for pacman and therefor would search the repositories

  • Adobe Creative Install problems of language.

    Hi, I bought Creative Cloud and then I installed Photoshop CC. I wanted to intall English Photoshop CC, but the Creative Cloud automatically intalled Korean Photoshop CC. My computer is used Korean Windows7. How to change from Korean Photoshop to Eng