Closing Balance needed

Dear All,
I have an requirement for getting the closing balance as running total. Means I have the following fields as
Debit      Credit   Balance ( Not there but want a calculation or formula from crystal reports )
100        0          100
200        0          300
0            50        250
0            100      150
500        0          650
Basically I want a closing Balance field. How to achieve please advise
Regards,
Depika

Are you using a running total, or a sum?  Are the options for the running total set correctly (in particular when it is reset to zero)?
Anyway, you can do this with global variables as well (basic syntax):
global balance as number
if PreviousValue({group field}) <> {group field} then
  balance = 0
end if
balance = balance + {debit} - {credit}
formula = balance
Where {group field} is whatever field you need to trigger a reset of the balance.  Put this field where you ant the balance displayed.
HTH,
Carl

Similar Messages

  • Opening balance and closing balances for discounts?

    Hi all,
    I have a typical sceanario where in
    opening balance for discounts 10,000 (balance of last month)
    actual discounts  from the sales order 5,000
    manual upload is   from flat file            2,000
    closing balance is 7,000 (which is opening balance + manual upload - actual discounts)
    opening and closing balance needs to be calculated, how to calculate nor handle this on every month?
    level of granularity of the data is
    sku, month, rebate category and rebate amount?
    Thanks

    Hi Pooja,
    can you please let us know few things about your report requirements
    What is the extractor you are using?
    What are the KFs ?
    what are the selection parameters that you want to enter at the reporting level?
    is it the report related to FI AR. do you want to display the values based on the customer -->profitcenter?
    Bcoz we had a same requirement where our requirement was global recievables aging report in which the report need to display opening bal, sales,adjustment,colelction and closing balance and the aging values.
    here what we did is changed the modeling of the DSO and infocube.
    we had used non-cumulative KF in order to calculate closing balance and from that derived opening balance and again create a new formula to get the closing balance.
    if you can be specific with your requirement hope can help you with your report.

  • I need Opening & Closing Balance

    Hi Experts,
    In this report i need the opening and Closing Balance,
    single material it is working fine,
    but i gave multiple materials it is not working.
    TABLES: MKPF,LFA1,MSEG,EKET,T001L,MAKT,S031,S032,MARA,LIPS,LIKP,T001W.
    DATA  FLAG TYPE I.
    DATA : MENGE_RE LIKE MSEG-MENGE,
           MENGE_IS LIKE MSEG-MENGE,
           MENGE_O LIKE MSEG-MENGE,
           MENGE_BAL LIKE MSEG-MENGE.
    DATA  MAGBB LIKE S031-MAGBB.
    DATA  MZUBB LIKE S031-MZUBB.
    DATA  V_MONTH LIKE S031-SPMON.
    DATA  XBLNR LIKE MKPF-XBLNR.
    DATA : BEGIN OF ITAB1 OCCURS 100,
           MATNR LIKE MAKT-MATNR,
           END OF ITAB1.
    DATA : BEGIN OF ITAB2 OCCURS 100,
    MATNR LIKE MAKT-MATNR,
    WERKS LIKE MARD-WERKS,
    LGORT LIKE MARD-LGORT,
    BUSTW LIKE MSEG-BUSTW,
    BWART LIKE MSEG-BWART,
    SHKZG LIKE MSEG-SHKZG,
    MENGE LIKE MSEG-MENGE,
    END OF ITAB2.
    DATA: PAGNO(5) TYPE C.
    DATA : PAGENO LIKE SY-PAGNO.
    DATA : V_PAGENO LIKE SY-PAGNO.
    DATA  V_STOCK LIKE MSEG-MENGE.
    DATA  V_STOCK1 LIKE MSEG-MENGE.
    DATA: V_MONTH1 LIKE S031-SPMON.
    DATA: OSTOCK LIKE MSEG-MENGE.
    DATA: FLD(15).
    DATA: TXT(50).
    DATA: STR1 TYPE DATS,
          STR2(14) TYPE C,
          STR3(10) TYPE C.
    DATA: P_DATE(20),
          PR_DATE(12),               " Previous statement period (FM)
          PR_DATE1(6),               " Previous statement period
          SDATE LIKE SY-DATUM,            " First date of the month
          EDATE LIKE SY-DATUM,            " Last date of the current month
          RDATE LIKE SY-DATUM.            " Last date of the Previous month
    I N I T I A L I Z A T I O N
    PAGNO = SY-PAGNO.
    A T  S E L E C T I O N  S C R E E N
    AT SELECTION-SCREEN.
    S T A R T O F S E L E C T I O N
    START-OF-SELECTION.
    SET MARGIN 5.
    PERFORM FETCH_DATA.
    PERFORM WRITE_REPORT.
    PERFORM STOCK.
    E N D O F S E L E C T I O N
    END-OF-SELECTION.
    Report Selections
      DATA: BEGIN OF IT_HEADER OCCURS 10,
            WERKS LIKE MSEG-WERKS,
            NAME1 LIKE T001W-NAME1,
            MAKTX LIKE MAKT-MAKTX,
            MATNR LIKE MSEG-MATNR,
            MENGE_O LIKE MSEG-MENGE,
            END OF IT_HEADER.
      DATA: BEGIN OF ITAB OCCURS 50,
            WERKS LIKE MSEG-WERKS,
            MATNR LIKE MSEG-MATNR,
            BWART LIKE MSEG-BWART,
            LGORT LIKE MSEG-LGORT,
            EBELN LIKE MSEG-EBELN,
            XBLNR LIKE MKPF-XBLNR,
            BUDAT LIKE MKPF-BUDAT,
            MBLNR LIKE MSEG-MBLNR,
            MENGE LIKE MSEG-MENGE,
            MAKTX LIKE MAKT-MAKTX,
            XAUTO LIKE MSEG-XAUTO,
            NAME1 LIKE T001W-NAME1,
            MENGE_O LIKE MSEG-MENGE,
            SHKZG LIKE MSEG-SHKZG,
            MENGE_IS LIKE MSEG-MENGE,
            MENGE_RE LIKE MSEG-MENGE,
            END OF ITAB.
      DATA: BEGIN OF INT_DATA OCCURS 50,
            WERKS LIKE MSEG-WERKS,
            MATNR LIKE MSEG-MATNR,
            BWART LIKE MSEG-BWART,
            XBLNR LIKE MKPF-XBLNR,
            MBLNR LIKE MSEG-MBLNR,
            BUDAT LIKE MKPF-BUDAT,
            MAKTX LIKE MAKT-MAKTX,
            MENGE_O LIKE MSEG-MENGE,
            MENGE_R LIKE MSEG-MENGE,
            MENGE_TO LIKE MSEG-MENGE,
            MENGE_TI LIKE MSEG-MENGE,
            MENGE_S LIKE MSEG-MENGE,
            MENGE_ST LIKE MSEG-MENGE,
            MENGE_AD LIKE MSEG-MENGE,
            MENGE_RT LIKE MSEG-MENGE,
            MENGE_C LIKE MSEG-MENGE,
            MENGE_CL LIKE MSEG-MENGE,
            MENGE_BAL LIKE MSEG-MENGE,
            MENGE_CR LIKE MSEG-MENGE,
            NAME1 LIKE T001W-NAME1,
            MENGE_RE LIKE MSEG-MENGE,
            MENGE_IS LIKE MSEG-MENGE,
            MENGE_BAL1 LIKE MSEG-MENGE,
            MENGE_ADD LIKE MSEG-MENGE,
            SHKZG LIKE MSEG-SHKZG,
            MENGE LIKE MSEG-MENGE,
            LGORT LIKE MSEG-LGORT,
             DATE(12),
           CDATE(8),
            END OF INT_DATA.
      DATA: BEGIN OF INT_DATA1 OCCURS 50,
            WERKS LIKE MSEG-WERKS,
            MATNR LIKE MSEG-MATNR,
            BWART LIKE MSEG-BWART,
            MENGE_ST LIKE MSEG-MENGE,
            MENGE_O LIKE MSEG-MENGE,
            WAMNG LIKE EKET-WAMNG,
            WEMNG LIKE EKET-WEMNG,
            MENGE LIKE MSEG-MENGE,
            RETPO LIKE EKPO-RETPO,
            UMREN LIKE EKPO-UMREN,
            UMREZ LIKE EKPO-UMREZ,
            BSTMG LIKE EKPO-MENGE,
            XBLNR LIKE MKPF-XBLNR,
            END OF INT_DATA1.
      DATA:  BEGIN OF INT_DATA2 OCCURS 50,
             WERKS LIKE MSEG-WERKS,
             LGORT LIKE S031-LGORT,
             MATNR LIKE MSEG-MATNR,
             BWART LIKE MSEG-BWART,
             MENGE_IS LIKE MSEG-MENGE,
             MBWBEST LIKE S032-MBWBEST,
             MAKTX LIKE MAKT-MAKTX,
             END OF INT_DATA2.
    DATA:V_GJAHR LIKE MKPF-BUDAT.
      SELECTION-SCREEN BEGIN OF BLOCK 0 WITH FRAME TITLE TEXT-064.
      SELECT-OPTIONS:
      MATNR FOR MSEG-MATNR,
      MATKL FOR MARA-MATKL OBLIGATORY,
      WERKS FOR MSEG-WERKS OBLIGATORY,
      LGORT FOR MSEG-LGORT,
      BWART FOR MSEG-BWART,
      S_DATE FOR MKPF-BUDAT.
      SELECTION-SCREEN END OF BLOCK 0.
    TOP-OF-PAGE.
    PERFORM HEADER_WRITE.
    *&      Form  Fetch_data
          text
    FORM FETCH_DATA .
      SELECT * FROM MARA INTO CORRESPONDING FIELDS OF TABLE ITAB1
                         WHERE MATNR IN MATNR AND
                         MATKL IN MATKL.
      SELECT MATNR WERKS LGORT
                         INTO TABLE ITAB2
                         FROM MARD FOR ALL ENTRIES IN ITAB1
                         WHERE WERKS IN WERKS AND
                               LGORT IN LGORT AND
                               MATNR = ITAB1-MATNR.
      LOOP AT ITAB2.
        SELECT M~MATNR M~WERKS M~LGORT M~BWART M~MENGE M~MBLNR  M~MJAHR M~XAUTO M~SHKZG
                        M~EBELN N~BUDAT N~XBLNR S~NAME1
                       INTO CORRESPONDING FIELDS OF ITAB
                       FROM   MSEG AS M INNER JOIN MKPF AS N ON
                              M~MBLNR = N~MBLNR
                              AND M~MJAHR = N~MJAHR
                            INNER JOIN T001W AS S ON
                              M~WERKS = S~WERKS
                          WHERE N~BUDAT IN S_DATE AND
                             M~WERKS = ITAB2-WERKS AND
                             M~LGORT = ITAB2-LGORT AND
                             M~MATNR = ITAB2-MATNR AND
                              M~BWART IN ('101','601','641','602','651','642','652','551','102','552').
          APPEND ITAB.
          CLEAR ITAB.
        ENDSELECT.
        IF SY-SUBRC NE 0.
          ITAB-MATNR = ITAB2-MATNR.
          ITAB-WERKS = ITAB2-WERKS.
          ITAB-LGORT = ITAB2-LGORT.
          ITAB-BWART = ITAB2-BWART.
          APPEND ITAB.
        ENDIF.
        CLEAR: ITAB2,ITAB.
      ENDLOOP.
      DELETE ADJACENT DUPLICATES FROM ITAB2 COMPARING MATNR WERKS .
      V_MONTH = S_DATE-LOW+0(6).
      SELECT * INTO CORRESPONDING FIELDS OF TABLE INT_DATA2
               FROM S032 FOR ALL ENTRIES IN ITAB2
               WHERE MATNR = ITAB2-MATNR
                     AND WERKS   = ITAB2-WERKS
                     AND LGORT   = SPACE
                     AND   MBWBEST <> SPACE.
      LOOP AT INT_DATA2 .
        SELECT SINGLE *  FROM S031
                         WHERE MATNR = INT_DATA2-MATNR AND
                               WERKS = INT_DATA2-WERKS AND
                               LGORT = SPACE AND
                               SPMON GT V_MONTH.
        MODIFY INT_DATA2.
        CLEAR: INT_DATA2, S031.
      ENDLOOP.
      DELETE INT_DATA WHERE MENGE_O IS INITIAL .
      DELETE ADJACENT DUPLICATES FROM INT_DATA COMPARING XBLNR MATNR MAKTX.
      V_MONTH1 = S_DATE-LOW+0(6).
      SORT ITAB BY  MATNR  WERKS  XBLNR .
      LOOP AT ITAB.
        XBLNR = ITAB-XBLNR.
        INT_DATA-MENGE = ITAB-MENGE.
        INT_DATA-BWART = ITAB-BWART.
        INT_DATA-XBLNR = ITAB-XBLNR.
        INT_DATA-BUDAT = ITAB-BUDAT.
        INT_DATA-MATNR = ITAB-MATNR.
        INT_DATA-MBLNR = ITAB-MBLNR.
        INT_DATA-MENGE = ITAB-MENGE.
        INT_DATA-SHKZG = ITAB-SHKZG.
        INT_DATA-MENGE_IS = ITAB-MENGE_IS.
        INT_DATA-MENGE_RE = ITAB-MENGE_RE.
        INT_DATA-MENGE_O = ITAB-MENGE_O.
        INT_DATA-NAME1 = ITAB-NAME1.
        AT NEW MATNR.
          FLAG = 1.
          IT_HEADER-MATNR = INT_DATA-MATNR.
          SELECT SINGLE MAKTX FROM MAKT INTO IT_HEADER-MAKTX WHERE
          MATNR = INT_DATA-MATNR.
          APPEND IT_HEADER.
          CLEAR IT_HEADER.
       endat.
        IF FLAG = 1.
          PERFORM GET_OPENING_STOCK.
        ENDIF.
        INT_DATA-MENGE_O = OSTOCK.
        CASE ITAB-BWART.
          WHEN '101'.
            IF INT_DATA-SHKZG = 'S'.
              INT_DATA-MENGE_R = INT_DATA-MENGE_R + ITAB-MENGE.
            ENDIF.
          WHEN  '651'.
            IF INT_DATA-SHKZG = 'S'.
             IF ITAB-XAUTO = 'X'.
                INT_DATA-MENGE_RT = INT_DATA-MENGE_RT + ITAB-MENGE.
              ENDIF.
           ENDIF.
           WHEN '351' OR '641'.
             IF INT_DATA-SHKZG = 'H'.
            IF ITAB-LGORT = 0.
              INT_DATA-MENGE_R = INT_DATA-MENGE_R + ITAB-MENGE.
            ELSE.
              INT_DATA-MENGE_TO = INT_DATA-MENGE_TO + ITAB-MENGE.
            ENDIF.
            ENDIF.
          WHEN '602' OR '642'.
            IF INT_DATA-SHKZG = 'S'.
             IF ITAB-LGORT = 0.
              INT_DATA-MENGE_S = INT_DATA-MENGE_S - ITAB-MENGE.
            ELSE.
              INT_DATA-MENGE_CL = INT_DATA-MENGE_CL + ITAB-MENGE.
            ENDIF.
              ENDIF.
          WHEN '552'.
            IF INT_DATA-SHKZG = 'S'.
              IF ITAB-LGORT = 0.
            INT_DATA-MENGE_AD = INT_DATA-MENGE_AD - ITAB-MENGE.
            ELSE.
              INT_DATA-MENGE_ADD = INT_DATA-MENGE_ADD + ITAB-MENGE.
            ENDIF.
            ENDIF.
          WHEN '601'.
            IF INT_DATA-SHKZG = 'H'.
              INT_DATA-MENGE_S = INT_DATA-MENGE_S + ITAB-MENGE.
            ENDIF.
          WHEN  '641' .
            IF INT_DATA-SHKZG = 'H'.
              IF ITAB-LGORT = 0.
                INT_DATA-MENGE_TO = INT_DATA-MENGE_TO + ITAB-MENGE.
              ENDIF.
            ENDIF.
          WHEN  '652' OR '102'.
            IF INT_DATA-SHKZG = 'H'.
             IF ITAB-XAUTO = 'X'.
                INT_DATA-MENGE_CR = INT_DATA-MENGE_CR + ITAB-MENGE.
             ENDIF.
            ENDIF.
          WHEN '551'.
            IF INT_DATA-SHKZG = 'H'.
              INT_DATA-MENGE_AD = INT_DATA-MENGE_AD + ITAB-MENGE.
            ENDIF.
    ENDCASE.
    COLLECT INT_DATA.
        CLEAR: INT_DATA,XBLNR, FLAG, OSTOCK.
    IF INT_DATA-SHKZG = 'S'.
          MENGE_RE = INT_DATA-MENGE_R + INT_DATA-MENGE_RT + INT_DATA-MENGE_CL
          + INT_DATA-MENGE_ADD.
        ENDIF.
        IF INT_DATA-SHKZG = 'H'.
          MENGE_IS =  INT_DATA-MENGE_S + INT_DATA-MENGE_TO +
                        INT_DATA-MENGE_CR + INT_DATA-MENGE_AD.
        ENDIF.
      ENDLOOP.
      SORT INT_DATA BY  BUDAT XBLNR BWART  WERKS MATNR.
      LOOP AT INT_DATA WHERE  MENGE_O = 0 AND MENGE_RT = 0 AND
                            MENGE_CL = 0 AND MENGE_AD = 0 AND
                            MENGE_S = 0 AND MENGE_TO = 0 AND
                            MENGE_CR = 0 AND MENGE_R = 0 AND MENGE_BAL = 0.
        DELETE IT_HEADER WHERE MATNR = INT_DATA-MATNR.
      ENDLOOP.
      DELETE INT_DATA WHERE MENGE_O = 0 AND MENGE_RT = 0 AND
                            MENGE_CL = 0 AND MENGE_AD = 0 AND
                            MENGE_S = 0 AND MENGE_TO = 0 AND
                            MENGE_CR = 0 AND MENGE_R = 0 AND MENGE_BAL = 0.
    FORMAT RESET.
    LOOP AT INT_DATA.
       PERFORM BALANCE.
       MODIFY INT_DATA.
       ENDLOOP.
    PERFORM WRITE_REPORT.
    INT_DATA-MENGE_O = OSTOCK.
    FORMAT RESET.
    WRITE:/1(156) SY-ULINE.
    ENDFORM.
    *&      Form  Write_Report
          text
    FORM WRITE_REPORT.
      SORT IT_HEADER BY MATNR.
      LOOP AT IT_HEADER.
       SKIP .
        AT NEW MATNR.
         WRITE:/1(60) SY-ULINE.
          READ TABLE IT_HEADER INDEX SY-TABIX.
          WRITE:/1 SY-VLINE,
             2 'Material  :'(006),14(7) IT_HEADER-MATNR NO-GAP,'-',
                   IT_HEADER-MAKTX,
                     60 SY-VLINE.
          WRITE:/1(60) SY-ULINE.
    *READ TABLE INT_DATA WITH KEY MATNR = IT_HEADER-MATNR.
         IF SY-SUBRC NE 0 AND OSTOCK = 0.
           CONTINUE.
         ENDIF.
          SKIP.
          SET LEFT SCROLL-BOUNDARY COLUMN 50.
          WRITE:/1(156) SY-ULINE.
           FORMAT COLOR 1 INTENSIFIED OFF.
           WRITE:/1 SY-VLINE,
                    2 'Doc. No' CENTERED,
                   14 SY-VLINE,
                   15(14) 'Doc.Date' CENTERED,
                   27 SY-VLINE,
                  28(10) 'MVT' CENTERED,
                   40 SY-VLINE.
           WRITE:41(57) 'Receipts' CENTERED,
                 89 SY-VLINE, 90(47) 'Issues' CENTERED,130 SY-VLINE,131(12) 'C.Balance' CENTERED,144 SY-VLINE,
                 145 'MAT.DOC NO' CENTERED,156 SY-VLINE,
                /40 SY-VLINE,1 SY-VLINE,14 SY-VLINE,27 SY-VLINE,40 SY-VLINE,
                 41(130) SY-ULINE,
                 /40 SY-VLINE, 43 'STO-In' CENTERED , 51 SY-VLINE,
                 52 'Sales Returns' CENTERED , 65 SY-VLINE,
                 66 'Canc of Invoice' CENTERED, 82 SY-VLINE,
                 83 'Adj' CENTERED, 89 SY-VLINE,
                 90 'Sales' CENTERED, 97 SY-VLINE,
                 98 'STO-Out' CENTERED, 106 SY-VLINE,
                 107 'Canc of Sales' CENTERED, 120 SY-VLINE,
                 121 'Adj' CENTERED, 130 SY-VLINE,144 SY-VLINE,156 SY-VLINE,
                 1 SY-VLINE,14 SY-VLINE,27 SY-VLINE,40 SY-VLINE.
    WRITE:/1(156) SY-ULINE.
    FORMAT RESET.
        PERFORM GET_OPENING_STOCK.
    FORMAT COLOR 4 INTENSIFIED OFF.
           WRITE:/1 SY-VLINE,
                 106 'Opening Balance' CENTERED,
                 130 SY-VLINE,
                 156 SY-VLINE.
    WRITE: 130(8) OSTOCK.
    WRITE:/1(156) SY-ULINE.
    LOOP AT INT_DATA WHERE MATNR = IT_HEADER-MATNR.
    FORMAT COLOR 2 INTENSIFIED OFF.
    *WRITE:/1(156) SY-ULINE.
    WRITE:/1 SY-VLINE,
                 2 INT_DATA-XBLNR,
                 14 SY-VLINE,
                 15 INT_DATA-BUDAT,
                 27 SY-VLINE,
                 28 INT_DATA-BWART,
                 40 SY-VLINE,
                 43(9) INT_DATA-MENGE_R,
                 51 SY-VLINE,
                 52(9) INT_DATA-MENGE_RT,
                 65 SY-VLINE,
                 66(9) INT_DATA-MENGE_CL,
                 82 SY-VLINE,
                 83(7) INT_DATA-MENGE_ADD,
                 89 SY-VLINE,
                 90(9) INT_DATA-MENGE_S,
                 97 SY-VLINE,
                 98(9) INT_DATA-MENGE_TO,
                 106 SY-VLINE,
                 107(9) INT_DATA-MENGE_CR,
                 120 SY-VLINE,
                 121(9) INT_DATA-MENGE_AD,
                 130 SY-VLINE,
                 131(9) INT_DATA-MENGE_BAL,
                 144 SY-VLINE,
                 145 INT_DATA-MBLNR,
                 156 SY-VLINE.
    *WRITE:/1(156) SY-ULINE.
    FORMAT RESET.
      ENDLOOP.
    WRITE:/1(156) SY-ULINE.
    ENDAT.
    ENDLOOP.
    ENDFORM.
    *&      Form  BALANCE
          text
    -->  p1        text
    <--  p2        text
    FORM BALANCE.
      IF INT_DATA-SHKZG = 'S'.
        MENGE_RE = MENGE_RE + INT_DATA-MENGE.
        INT_DATA-MENGE_BAL = MENGE_RE.
        INT_DATA-MENGE_RE = INT_DATA-MENGE.
         MODIFY INT_DATA TRANSPORTING MENGE_RE MENGE_BAL.
      ELSEIF INT_DATA-SHKZG = 'H'.
        MENGE_RE =  MENGE_RE - INT_DATA-MENGE.
        INT_DATA-MENGE_BAL = MENGE_RE.
        INT_DATA-MENGE_IS = INT_DATA-MENGE.
         MODIFY INT_DATA TRANSPORTING MENGE_IS MENGE_BAL.
      ENDIF.
    ENDFORM.                    " BALANCE
    *&      Form HEADER_WRITE.
          text
    FORM HEADER_WRITE.
    SKIP.
      WRITE: /1(156) SY-ULINE.
      WRITE: /1 SY-VLINE,
              2(144) 'xxxxxxxxxxxxxxxxxxxx'
                  INTENSIFIED CENTERED," INVERSE ON
              156 SY-VLINE.
      WRITE: /1(156) SY-ULINE.
      WRITE: /1 SY-VLINE,
              2(144) 'STOCK LEDGER' INTENSIFIED CENTERED,
               "INVERSE ON,
              156 SY-VLINE.
      WRITE: /1(156) SY-ULINE.
    SELECT SINGLE * FROM T001W WHERE
                      WERKS IN WERKS.
    IF WERKS-HIGH EQ SPACE.
        CONCATENATE 'Plant :  ' WERKS-LOW INTO TXT.
      ELSE.
        CONCATENATE 'FROM PLANT : ' WERKS-LOW 'TO PLANT : ' WERKS-HIGH INTO TXT SEPARATED  BY SPACE.
      ENDIF.
    WRITE:/ 'Plant :', WERKS-LOW,SPACE ,'-', T001W-NAME1,
    82 'As Of Date :', 95 sy-datum.
    IF NOT S_DATE IS INITIAL.
        WRITE: / 'From:'(004), S_DATE-LOW, SPACE, 'To:'(006), S_DATE-HIGH,82 'PAGE No:', 91 SY-PAGNO..
      ENDIF.
    FORMAT RESET.
    ENDFORM.
    *&      Form  GET_OPENING_STOCK
          text
    FORM GET_OPENING_STOCK.
      SELECT SUM( MZUBB ) SUM( MAGBB )  INTO (V_STOCK, V_STOCK1)
                    FROM S031 WHERE MATNR = ITAB-MATNR AND
                                    WERKS = ITAB-WERKS AND
                                    SPMON LT V_MONTH1 AND LGORT = ITAB-LGORT.
      OSTOCK = V_STOCK1 - V_STOCK.
      IF OSTOCK < 0.
        OSTOCK = OSTOCK * -1.
        MENGE_RE = OSTOCK.
      ENDIF.
    ENDFORM.                               " GET_OPENING_STOCK
    Thanks & Regards,
    Sreedhar.

    A couple of things to start with:
    select * into corresponding fields of table int_data2
      from s032 for all entries in itab2
      where matnr = itab2-matnr
      and werks = itab2-werks
      and lgort = space
      and mbwbest <> space.
    mbwbest is a quantity and will never be space. Check it against 0 instead.
    IF itab-lgort = 0.
    LGORT is a character field and if you try to compare it with 0, it will dump.
    Rob

  • Opening & Closing balances of Vendor

    Hi Experts,
    I am doing a report where in i need to get the opening & closing balances for Vendor(s). I am using BSIK & BSAK tables. Are there any more tables involved and how do i carry out the calculations?
    Please help.
    Thanks
    Dany

    hi Dn,
    That would suffice for your requirement .
    Regards,
    Santosh

  • Opening & closing balances for Vendor

    Hi Experts,
    I am doing a report where in i need to get the opening & closing balances for Vendor(s). I am using BSIK & BSAK tables. Are there any more tables involved and how do i carry out the calculations?
    Please help.
    Thanks
    Dany

    Hi,
    There are various t. code to check line items for vendor like: S_ALR_87012103 but Any table is not helping to check opening/closeing balance for vendor.
    Table BSIK and BSAK are having are records for open items and close items for vendor and system calculate the balance by using these tables.
    Regards,
    Vinod

  • Opening and closing balances

    Hi sapgurus
    I need a report with similar to MB5B at particular posting date with opening and closing balances but I am unable to download the report to excel the data with MB5B tranasaction.Is there any similar transaction with same output values which can be easily transported to excel from Sap.
    Thanx

    Hi,
    I tested in ECC6.0 and i could able to do so, you try as mentioned below.
    In the output screen of MB5B, goto menu details > click on list > select save > select file > select spreadsheet. Here you can save tthe output in excel format.
    Regards,
    Prabu

  • Vendor Line item with Opening and Closing Balances report regarding

    Dear All,
    I need a report for vendor line items with Opening and Closing balances.
    Thanks in advance
    Sateesh

    Hi
    Try S_ALR_87012082 - Vendor Balances in Local Currency
    Regards
    Sanil Bhandari

  • Calculate closing balance

    Hi everyone,
    I've got a problem with writting a formula wich will calculate a closing balance for each account side, I mean debet and credit. In my SQL database I've got columns with: OpeningBalanceDt, OpeningBalanceCt , DtTurnover, CtTurnover, IDaccount and TIMEID.
    When I create a Calculated Field:
    BalanceDt:=IF(([OBDt+Dt]-[ObCt+Ct])>0;[OBDt+Dt]-[ObCt+Ct];0)
    BalanceCt:=IF(([ObCt+Ct]-[OBDt+Dt])>0;[ObCt+Ct]-[OBDt+Dt];0)
    it works for particular account eg:11575, but it doesn't when I remove filter and check global account nr 111 (then I have per account result).
    Do you have any idea what formula I need to write to have a proper view it pivot table for both account side ? Meaby I need to create a calculate column not filed...
    The problem concerns the fact that pp check columns globally and then compare calculeted sum. In this case global sum of BalanceDt has a higher value than BalanceCt so the final balance is Dt.
    In excel I can calculate 2 columns:
    =if((OBDt+Dt-(ObCt+Ct))<=0;0;OBDt+Dt-(ObCt+Ct))
    =if((OBCt+Ct-(ObDt+Dt))<=0;0;OBCt+Ct-(ObDt+CDt))
    and when I create a sum I've got a proper result. Maybe the solution will be in grouping the accounts and then conduct a comparision.
    Thanks in advice,
    Paul

    Hi,
    I will change a subject a little bit. Now I have the following columns:
    ObrotyKontID, WN, MA, BO_WN, BO_MA, KontoFinansoweID, KontoSyntetyczneID and TIMEID. Guy from ERP wrote two formulas which works perfect in system and calculate closing balance for each account side:
    Debit
    Sum(Filter(existing[KontoAnalityczne],[Measures].[ObrotyWNNar]>[Measures].[ObrotyMANar]),[Measures].[ObrotyWNNar]-[Measures].[ObrotyMANar])
    Credit
    Sum(Filter(existing[KontoAnalityczne],[Measures].[ObrotyWNNar]<[Measures].[ObrotyMANar]),[Measures].[ObrotyMANar]-[Measures].[ObrotyWNNar])
    and 2 more formulas to calculate Debit and Credit
    ObrotyWNNar
    Sum(StrToMember("[Czas].[Miesiąc].&["+left(Tail(existing [SET_Data]).Item(0).Properties("KEY"),4)+"01]"
    ):StrToMember("[Czas].[Miesiąc].&["+left(Tail(existing [SET_Data]).Item(0).Properties("KEY"),6)+"]"
    ),[Measures].[ObrotyWN]+[Measures].[BO WN])
    ObrotyMANar
    Sum(StrToMember("[Czas].[Miesiąc].&["+left(Tail(existing [SET_Data]).Item(0).Properties("KEY"),4)+"01]"
    ):StrToMember("[Czas].[Miesiąc].&["+left(Tail(existing [SET_Data]).Item(0).Properties("KEY"),6)+"]"
    ),[Measures].[ObrotyMA]+[Measures].[BO MA])
    I have got the same sum in ObrotyWNNar by forumla
    =[WN]+[BO_WN]
    and ObrotyMANar by
    =[MA]+[BO_MA]
    However I can't create proper formulas in powerpiwot which calculate Debit and Credit.  I suppose that I need to use some agregate formulas like SUMX.
    If anyone have any idea ?
    Thanks in advice,
    Paul

  • Debit,credit ,opening balance,closing balance..doubt.

    Dear friends,
                   I am working in FI report (vendor balance for date ranges) .Its a ALV report. I want to fetch the datas for debit ,
    credit,opening balance,closing balance,for the paticular vendor or all vendors for date ranges.the table for this iam using is BSIK AND LFC1.
    all the datas stored in the table is for month wise,but my programe (my user needs even for day wise) how to calculate this,
    or is there any function modules avaliable  or can u konw any other table storing day wise balances...this report is urgent ..
    any one pls suggest me .advance thanks..
    regards
    veera

    if user wants day wise then make use of BSAK+BSIK, here u will get all line items daywise , i mean to say Posting daywise.
    BUDAT        31.03.2003---->posting date
    BLDAT        31.03.2003
    CPUDT        31.03.2003
    WAERS        INR
    XBLNR        T&E-29-30.3-PNPT
    BLART        PA
    MONAT        3
    BSCHL        31
    ZUMSK
    SHKZG        H------------>D/C
    GSBER--------------------->Business Area
    MWSKZ-------------------->tax Code.
    DMBTR        1,507.00
    WRBTR        1,507.00
    regards
    Prabhu

  • GL_DAILY_BALANCES table for daily opening/closing balance

    Hi All,
    I need to know something about the GL_Daily_Balances table. In eTRM, it says that the table gives the balances for a particular day. My requirement is to show the opening and closing balances on daily basis. But, I found that all the END_OF_DAY columns (END_OF_DAY1...END_OF_DAY35) are NULL.
    Can anyone tell me why these columns are NULL ? Under what conditions, they are null ? How can I get the opening /closing balance then?
    Thanks!
    Yogini

    Hi Yogini,
    This table is populated when balance processing is enabled in the definition of each set of books, do you have it?
    You can read about in the metalink note # 1072012.6
    Bye

  • Closing Balance of GL is not match with opeaning Balance

    Hi Experts
    We are yet go for Closing activities, but i am seeing that some of the GL's are showing incorrect balances between opening and closing balances
    For Ex: Bank GL showing 563576 as closing balance in 2008 and the same GL is showing 459875 as opening balance in 2009
    I heard that, this is because of not executing Closing Activities, i would like to know why SAP system is showing such way
    Regards
    Sreenivasulu

    Hi,
    This is because you would have posted transactions in the previous fiscal year after carrying out the carry forward of balances in FAGLGVTR.
    You would need to execute FAGLGVTR again.
    Trust this helps.

  • Cash Flow Statement - Opening and Closing balances!

    Dear Friends,
    I have created cash flow statement (Indirect Method) using T code FSI1 and FSI4 (Form)..........but i am not able
    Why wouldnu2019t Cash and Cash Equivalents at the End of the Year (Fiscal 2008) be EXACTLY equal to Cash and Cash Equivalents at the Beginning of Year (Fiscal 2009)...?
    How do we need to set up for Cash for Current year closing balances and Next year's opening balances....?
    Thanks,
    Elan N.

    Hi,
    I tested in ECC6.0 and i could able to do so, you try as mentioned below.
    In the output screen of MB5B, goto menu details > click on list > select save > select file > select spreadsheet. Here you can save tthe output in excel format.
    Regards,
    Prabu

  • Opening and Closing balances in RG1 register

    Hi,
    We are facing one issue in RG1 register. When we update and extract the RG1 register from system, its showing Sales Qty and Excise duties properly. But opening and closing balances are not coming, its showing zero there. I checked J_2IRG1BAL table and found that it is also not getting updated. Material comes into stock with 561(initial stock) and 101(from production) movement types but opening/closing balances not coming in either case. Both movement types are activated for RG1 also.
    Seeking your help in this regard.....
    Regards,
    Satyendra Soni

    Hi Satyendra ,
    For initial  upload in RG1 there are 2 tables you need to manually update. J_2IRG1BAL  from CIN or SD side. And Accounts to be updated for Balance in J_2IACCBAL.
    There are 2 ways for updating balance tables
    On last day of month enter Balance in Closing balance field.
    OR enter opening balance on 1 st day of month.
    Also check Material form P ,can be maintained in user exit for permanent effect.
    After  updating balances ,
    perform any one transaction on system.
    and then  Extract  the Rg1 table .
    Ask FI consultant to put in  FI JV after balance upload in ACCBAL table.
    If you have not done table entries before performing transaction and extraction of RG1  then balances will not appear .
    Check with your senior there and use table edit in such case (I hope you are not on production server  at the moment) .Then again perform Extraction and check once.
    SD FI and ABAP to be present and take decision accordingly.

  • General Ledger report with Op Bal , Trans Line Items and Closing Balance

    Hi Experts,
    My clients needs a General Ledger report which should show Opening balance and all transactions line items with closing figure in a single report for a fiscal year in the given date range wise. Can I get a report in standard sap. Waiting for your reply.
    Thanks in Advance,
    Arabinda Parida

    Hi Parida,
    There is no such report in SAP. Basically all standard report gives line items not with opening and closing balances. Anyway check mentioned transaction which may help to you.
    S_ALR_87012309....It is cash journal report. Anyway you can enter GL account get opening and closing balances with all relavent transactions.
    Regards
    Suma

  • Opening and closing balance mismatch for - RG23A Part II

    Dear SAP Gurus,
    RG23A-Part-II for the month of May 2010 and have noticed the following problems
    1. The closing balance of last month is not tallying with the opening balance of current month. The balances printed in the register for BED, EDUCESS And HSEC are wrong.
    2. We have utilized the CENVAT balance for the payment of duty for the month of May 2010 - J2IUN.
    3.It is observed that even though we have debited duty under three headings, i.e. BED, EDUCESS and HSEC the register shows all the three debits under BED, which is incorrect
    Note : The Table entry of J_1IPart2 for Accounting Document ex 200033141 does not show breakup for Education Cess and H&SEcess.
    Kindly help what and where do we need to check for the setting?
    Regards,
    Prashanth

    Its possible that some transactions are posted after you extract the report.  Extract the report again (J2I5) and print them. 
    Have you configured different GL accounts for posting BED, ECS & HCS.  From your description, it seems same GL is assigned for all three components.
    Ravi.

Maybe you are looking for

  • SAP R/3 issue- Please Help

    Hi All, Please help in making suggestions on an R/3 issue. The Problem is  we have a standard cube 0PUR_C08 (Purchase Order Item Service Level). Could you please suggest the appropriate ODS and Standard Datasources required to load data into the targ

  • Reconcellaition account change

    Hi,        in the vendor master record after posting the transctions user changed the recon account how to transfer the balances of old recon to NEW Recon. Regards, Srini

  • Account Group creation

    Hi guru's i need a small favour from you Who will create Customer Account group in project i mean FI consultant or SD consultant and General Tab data who takes care plz dont give definition and purpose thanks and regards srinivas

  • Localhost site is not opening on mobile

    I have downloaded both Adobe Edge Insepct and chrome extension but do not understand how to test my websites locally.why it is not working locally. I've started up WAMP, start all its services, put it online connected my moblie. My site is in localho

  • Ideacentre k330 powerdial

    Does anyone know what the powerdial is for?  Where I can dowload the software so that it can be reinstalled?  It is creating SideBySide administrative error messages and will not open - Activation context generation failed for "C:\Program Files\Lenov