Consumption report to be tallied with GL

Hi,
I need consumption report value to be tallied with GL account. Which report is suitable for my requirement? can any one give the report tcode?
govind.

Hello,
Currently I am not infront of the system. I could not tell you the exact transaction code.
However, go to
SE16
Put the table name TSTCT (Language you select EN)
In Transaction Code field you put M* (It gives you all the transaction codes of MM)
and Number of entries you put 99999999
Now press Ctrl+F and find consumption
Compare this with FS10N.
Hope this solves your problem.
Regards,
Ravi

Similar Messages

  • AR01 REPORT IS NOT TALLYING WITH GL BALANCE

    Dear SAP Guru's
    AR01 report is not tallying with CWIP gl. during our observation, we found that out of four CWIP assets two of them showing over balance and two of them showing under balance. but when i tried for settling these assets to actual assets, system shows no value for settlement. But when i try for Scrapping, system is allowing for scrapping from these CWIP assets. In General, when ever value is lying in the CWIP, system will allow for settlement, but why in these case it is not allowing. What could be the reason ..for .CWIP assets shows Under/Over value. 
    Please advice.
    regds

    Dear Ravi..
    Thanks for your early reply...
    01. As per the Program documentation, it shows that these report should be executed only before year end closing.
          Is there any effect if i execute now.
    02. For Your information, i know the exact difference of balance which both AR01 and CWIP GL shows, so to what extent this program ABST2)will help.
    03.It would be helpful to me  if you have any solution to resolve it.
    04. Actually this problem was existing from more than 3 fiscal years...our auditors did not recognize it..now management recognised and want to rectify. If i reverse any entries it will effect previous Statutory reports, so without effecting the previous statements i have resolve it.
    Regds,

  • Sub: nbv in dep report is not tally with financial report

    Hi Experts,
    I am facing a problem that is when I see the balance in S_ALR_87012026 the end book balance is showing 100,642.60 but where as if I run s_alr_87012277 the balance is showing 100,681.23 which means the difference of 38.63 the difference which i found is in april after run the depreciation.
    so if anybody face the same problem give me your inputs.
    thanks in advance,
    kk.

    Hi,
    execute the asset history sheet (RAGITT_ALV01) with the option "posted depreciation". Compare the result of this report with the G/L report.
    Regards,
    Markus

  • Reg:F.19 report figures are not tallying with gl account 208030. Why?

    hi boss
    F.19 report figures are not tallying with gl account 208030. Why?
    pls urgent
    amk

    Hi,
    We have had GO-LIVE on 2008 April. They have executed balances carry forwrad for 2008 only. Do they need to carry forward balances for 2007 also?
    Is this the reason, that the system is showing differances in F.08 report.
    Kindly help me
    Thanks
    Kishore
    Edited by: Emergys Corp on Nov 24, 2009 8:56 AM

  • Assets balance Report(T Cd s_alr_87011964) Not Tally with GL Code in FBL3N

    Hi Friends
    SAP Standard Assets balance Report(T Code s_alr_87011964 and s_alr_87011963 ) Not Tally with GL Code in FBL3N.
    In SAP report coming with Report Date but FBL3N coming with Posting Date
    So How I add Posting Date input parameter in Sap Standard Report. Please help me
    Thanks & Regards,
    Hemant Kumar

    Hi Vinod,
    I hoe that you are doing reconcilation between Asset ledger & FI ledgers. Before that just run ABST ,there u can findout whatever the documents not assigned to FI.
    Asset is subledger to GL.It is automatically updated through determination,while post GRN to capital goods.In somecases bsuiness remove the reconcilation acount and do some adjustments that time that report not match with FBL3N.
    You can run ABST then u can get details
    Best rgds
    Mani

  • WIP report to tally with WIP GL accounts

    Hi Experts,
    Could you please let me know a WIP report which could be tallied with the WIP GL accounts? (WIP P/L & B/S accounts)
    Thanks & Regards
    Dasuni

    Hi Dasuni ,
    As you might be aware , whatever results the system computes for Work in Process for partially delivered orders and for Variances for fully delivered orders are posted to Financial Accounting using Settlement. If you look at the Production order settlement rule , you will have PER and FUL settlement rules described wherein if in one specific period , you do not settle the order , the same may be settled in the next period by virtue of the FUL indicator. So, in your case , it is a clear indication that one such orders was not settled during May but was settled during June. That is what apparently I can make out of this.
    Regards,
    Venkat.

  • Excess Material Consumption Report - For a Particular Period

    Hi,
    For a particular Time Period, say 30 days, I require excess material consumption report. This report is for the materials ( say ROH, or HALB) that are confirmed through co11n. Taking MTS into consideration with Strategy Group 40, please suggest a standard report (if there is any).
    Regards,
    Pavan

    The T code for viewing the standard report for
    Material Analysis - MCP5.
    Production Order - MCP3.
    Material Usage Analysis - MCRE.
    Please try it.
    Regards
    R.Brahmankar

  • Material yearly consumption report

    Hi,
    I have gone through many topics on getting the yearly consumption report of material but still could not get it.
    We have just implemented SAP in our company and all transactions are being done from 1st Jan 2011. In Material Master we have added the consumption (under Forecast tab) month wise for the last four years.
    Is there a way to see a report based on that, as I would like to accumulate the data year wise and see the last four years consumption.

    Hi ,
    I would give you suggestion based on your question "Is there a way to see a report based on that, as I would like to accumulate the data year wise and see the last four years consumption."
    1st , are you using any PP related Production order ?
    This is very simple issue with movement type 261 if you are using PP.
    Since you would like to see accumulate the date year wise for last four years consumption , my suggest is based on the plan date from the last 4 years with 261 movement type for the raw material / semi finished in those order.
    Standard report
    COOIS Report - with movement type 261 based on order also possible to view.
    or
    MCRP- exact material consumption datewise or order wise.
    MC45 ,MCRE alternative report.
    For customize solution with abap,
    Please check with Table MVER -  Material Consumption , MSEG (MENGE) and S026 (ENMNG)
    Pls restrict the selection condition for material with movement type 261 in table MSEG.
    If you using MRP area, perhaps you need check in table DVER - Material Consumption for MRP Area.
    Hope is clear and can help you.
    TQ

  • FAGLB03 peroid balance not tallying with line items within

    Hi,
    When i go to FAGLB03 and tally  the balance of a recon account for a particular month with the line items in it, it does not tally
    This is happening for one period within the fiscal year, others period balance tally with the line items
    What can be the solution for this?
    Regards,
    Parin

    Hi Parin,
    You did not confirm still whether the account in FAGLF03 is the same account that you  are trying to view.
    This issue will require careful analysis in the system as there could be more than one reasons.One of the likely possibilities is missing BSIS line items. As it is a technical reconciliation issue, please create a message for processing.
    FBL3N report that you executed also points towards that. I hope that  you ran the report for all items posted in that period.
    If you ran it only for open items, then there is also a possibility of a possible clearing issue.
    Anyway , the best route will be to open a message in FI inconsistencies component and let SAP investigate further.,
    Best Regards,
    Shrikant

  • Reciept & consumption report

    hi expert ,
                  I create the receipt & consumption report but my output comes not correct as per requirement so please help me to resolve this problem..
    i post my code
    FORM GET_DATA .
    SELECT
      A~MATNR
      A~MBLNR
      A~ERFMG
      A~BWART
      A~MENGE
      A~WERKS
      B~BUDAT
      FROM MSEG AS A
      INNER JOIN
      MKPF AS B
      ON  A~MBLNR = B~MBLNR
      AND A~MJAHR = B~MJAHR
      INTO CORRESPONDING FIELDS OF TABLE IT_MAIN
      WHERE A~MATNR IN S_MATNR
      AND  A~BWART IN ('101' ,'102','ZI1' ,'ZI2','ZC1' ,'ZC2','261' ,'262') .
      IF  SY-SUBRC = 0.
        SELECT
        MATNR
        MAKTX
        FROM MAKT
        INTO TABLE IT_MAKT
        FOR ALL ENTRIES IN IT_MAIN
        WHERE MATNR = IT_MAIN-MATNR .
        SORT IT_MAIN BY MATNR BUDAT BWART.
        LOOP AT IT_MAIN WHERE BWART = '101'
                          OR BWART = 'ZI1'
                          OR BWART = 'ZC1'.
          V_TABIX = SY-TABIX - 1.
          AT FIRST.
            IT_MAIN-QTY1 = IT_MAIN-MENGE.
            IT_MAIN-DATE1 = IT_MAIN-BUDAT.
            IT_MAIN-FLAG = 'X'.
            MODIFY IT_MAIN TRANSPORTING QTY1 DATE1 FLAG.
          ENDAT.
          ON CHANGE OF IT_MAIN-MATNR.
          IF SY-TABIX <> 1.
            IT_MAIN-QTY2 = QTY2.
            IT_MAIN-DATE2 = DATE2.
            IT_MAIN-FLAG = 'X'.
            MODIFY IT_MAIN INDEX V_TABIX TRANSPORTING QTY2 DATE2 FLAG.
            CLEAR QTY2.
            CLEAR DATE2.
            IT_MAIN-QTY1 = IT_MAIN-MENGE.
            IT_MAIN-DATE1 = IT_MAIN-BUDAT.
            IT_MAIN-FLAG = 'X'.
            MODIFY IT_MAIN TRANSPORTING QTY1 DATE1 FLAG.
          ENDIF.
          ENDON.
          AT LAST.
            IT_MAIN-QTY2 = IT_MAIN-MENGE.
            IT_MAIN-DATE2 = IT_MAIN-BUDAT.
            IT_MAIN-FLAG = 'X'.
            MODIFY IT_MAIN INDEX V_TABIX TRANSPORTING QTY2 DATE2 FLAG.
          ENDAT.
          QTY2 = IT_MAIN-MENGE.
          DATE2 = IT_MAIN-BUDAT.
        ENDLOOP.
        DELETE IT_MAIN WHERE FLAG <> 'X'.        " 1ST & LAST RECIEPT ........
    ************** ON CUNSUMPTION FIELD LOOP  *****************
        LOOP AT IT_MAIN WHERE BWART = '261' .
          V_TABIX = SY-TABIX - 1.
          AT FIRST.
            IT_MAIN-CMPQTY1 = IT_MAIN-MENGE.
            IT_MAIN-CMPDATE1 = IT_MAIN-BUDAT.
            IT_MAIN-FLAG = 'X'.
            MODIFY IT_MAIN TRANSPORTING CMPQTY1 CMPDATE1 FLAG.
          ENDAT.
          ON CHANGE OF IT_MAIN-MATNR.
          IF SY-TABIX <> 1.
            IT_MAIN-CMPQTY2 = CMPQTY2.
            IT_MAIN-CMPDATE2 = CMPDATE2.
            IT_MAIN-FLAG = 'X'.
            MODIFY IT_MAIN INDEX V_TABIX TRANSPORTING CMPQTY2 CMPDATE2 FLAG.
            CLEAR CMPQTY2.
            CLEAR CMPDATE2.
            IT_MAIN-CMPQTY1 = IT_MAIN-MENGE.
            IT_MAIN-CMPDATE1 = IT_MAIN-BUDAT.
            IT_MAIN-FLAG = 'X'.
            MODIFY IT_MAIN TRANSPORTING CMPQTY1 CMPDATE1 FLAG.
          ENDIF.
          ENDON.
          AT LAST.
            IT_MAIN-CMPQTY2 = IT_MAIN-MENGE.
            IT_MAIN-CMPDATE2 = IT_MAIN-BUDAT.
            IT_MAIN-FLAG = 'X'.
            MODIFY IT_MAIN INDEX V_TABIX TRANSPORTING CMPQTY2 CMPDATE2 FLAG.
          ENDAT.
          CMPQTY2 = IT_MAIN-MENGE.
          CMPDATE2 = IT_MAIN-BUDAT.
        ENDLOOP.
        DELETE IT_MAIN WHERE FLAG <> 'X'.      " 1ST & LAST CONSUMPTION  ........
      ENDIF.
    **************  END OF LOOP ON CONSUMPTION FIELDS ************************
    ENDFORM.

    REPORT  ZSTORE_MAT NO STANDARD PAGE HEADING LINE-SIZE 200 LINE-COUNT 65  .
    **** TABLE USED ***
    TABLES : MSEG , MKPF , MAKT .
    ******* DATA DECLARATION *******
    DATA : BEGIN OF IT_MAIN OCCURS 0 ,
                 MATNR TYPE MSEG-MATNR,    "Material No.
                 MAKTX TYPE MAKT-MAKTX,    "Material Describtion.
                 BWART TYPE MSEG-BWART,    "Movement Type
                 BUDAT TYPE MKPF-BUDAT,    "DATE ..
                 MENGE TYPE MSEG-MENGE,    "Quantity
                 DATE1 TYPE MKPF-BUDAT,    "1st rec date.
                 QTY1  TYPE MSEG-MENGE,   "1st rec QTY.
                 DATE2 TYPE MKPF-BUDAT,   "Last rec date.
                 QTY2  TYPE MSEG-MENGE,   "LAST rec QTY.
                 CMPDATE1 TYPE MKPF-BUDAT,    "1st consumption date.
                 CMPQTY1  TYPE MSEG-MENGE,   "1st consumption QTY.
                 CMPDATE2 TYPE MKPF-BUDAT,    "Last consumption date.
                 CMPQTY2  TYPE MSEG-MENGE,   "Last consumption QTY.
                 FLAG(1) TYPE C,
    *             ERFME TYPE MSEG-ERFME,    "Unit
            END OF IT_MAIN.
    DATA:        QTY1 TYPE MSEG-MENGE,   "1st rec QTY.
                 DATE2 TYPE MKPF-BUDAT,   "Last rec date.
                 QTY2  TYPE MSEG-MENGE,   "LAST rec QTY.
                 CMPDATE1 TYPE MKPF-BUDAT,    "1st consumption date.
                 CMPQTY1  TYPE MSEG-MENGE,   "1st consumption QTY.
                 CMPDATE2 TYPE MKPF-BUDAT,    "Last consumption date.
                 CMPQTY2  TYPE MSEG-MENGE.   "Last consumption QTY.
    DATA : BEGIN OF IT_MSEG OCCURS 0 ,
              MATNR TYPE MSEG-MATNR, "Material No.
              MBLNR TYPE MSEG-MBLNR, "Material Document No.
              ERFMG TYPE MSEG-ERFMG, " CONS. QTY .
              BWART TYPE MSEG-BWART, "MVT TYP..
              MENGE TYPE MSEG-MENGE, " QTY ..
              WERKS TYPE MSEG-WERKS,
           END OF IT_MSEG .
    *       IT_MSEG LIKE STANDARD TABLE OF WA_MSEG .
    DATA : BEGIN OF IT_MAKT OCCURS 0 ,
              MATNR TYPE MAKT-MATNR,
              MAKTX TYPE MAKT-MAKTX,
    END OF IT_MAKT .
    DATA : BEGIN OF IT_MKPF OCCURS 0,
              MBLNR TYPE MKPF-MBLNR,    "Material Document No.
              BUDAT TYPE MKPF-BUDAT, " DATE  ...
           END OF IT_MKPF .
    DATA: V_TABIX TYPE SY-TABIX.
    *       IT_MKPF LIKE STANDARD TABLE OF WA_MKPF .
    *** Selection screen ***
    SELECTION-SCREEN BEGIN OF BLOCK BLOCK WITH FRAME TITLE TEXT-001.
    SELECT-OPTIONS : S_MATNR FOR MSEG-MATNR   .
    SELECTION-SCREEN END OF BLOCK BLOCK.
    *AT SELECTION-SCREEN.
    *SELECT SINGLE * FROM MSEG WHERE MATNR IN MATNR .
    START-OF-SELECTION .
    PERFORM GET_DATA.
    END-OF-SELECTION .
    PERFORM WRITE_DATA.
    TOP-OF-PAGE .
       PERFORM TOP_OF_PAGE .
    END-OF-PAGE.
    *   PERFORM END_OF_PAGE .
    FORM TOP_OF_PAGE.
      WRITE:/ 'Material', 20  'Description', 50 'frstrecdat', 70 'frstQty', 90 'Lastrecdat', 110 'lastQty',
              130 'FstCanspdate', 150'FstCnspqty',170 'Lstcanspdate',190 'Lstqty' .
    ENDFORM.
    FORM GET_DATA.
      SELECT
      A~MATNR
      A~MBLNR
      A~ERFMG
      A~BWART
      A~MENGE
      A~WERKS
      B~BUDAT
      FROM MSEG AS A
      INNER JOIN
      MKPF AS B
      ON A~MBLNR = B~MBLNR
      AND A~MJAHR = B~MJAHR
      INTO CORRESPONDING FIELDS OF TABLE IT_MAIN
      WHERE A~MATNR IN S_MATNR
      AND A~BWART IN ('101' ,'102','ZI1' ,'ZI2','ZC1' ,'ZC2','261' ,'262') .
      IF SY-SUBRC = 0.
       SELECT
       MATNR
       MAKTX
       FROM MAKT
       INTO TABLE IT_MAKT
       FOR ALL ENTRIES IN IT_MAIN
       WHERE MATNR = IT_MAIN-MATNR .
       SORT IT_MAIN BY MATNR BUDAT BWART.
       LOOP AT IT_MAIN WHERE BWART = '101'
                          OR BWART = 'ZI1'
                          OR BWART = 'ZC1'.
         V_TABIX = SY-TABIX - 1.
         AT FIRST.
           IT_MAIN-QTY1 = IT_MAIN-MENGE.
           IT_MAIN-DATE1 = IT_MAIN-BUDAT.
           IT_MAIN-FLAG = 'X'.
           MODIFY IT_MAIN TRANSPORTING QTY1 DATE1 FLAG.
         ENDAT.
         ON CHANGE OF IT_MAIN-MATNR.
         IF SY-TABIX <> 1.
           IT_MAIN-QTY2 = QTY2.
           IT_MAIN-DATE2 = DATE2.
           IT_MAIN-FLAG = 'X'.
           MODIFY IT_MAIN INDEX V_TABIX TRANSPORTING QTY2 DATE2 FLAG.
           CLEAR QTY2.
           CLEAR DATE2.
           IT_MAIN-QTY1 = IT_MAIN-MENGE.
           IT_MAIN-DATE1 = IT_MAIN-BUDAT.
           IT_MAIN-FLAG = 'X'.
           MODIFY IT_MAIN TRANSPORTING QTY1 DATE1 FLAG.
         ENDIF.
         ENDON.
         AT LAST.
           IT_MAIN-QTY2 = IT_MAIN-MENGE.
           IT_MAIN-DATE2 = IT_MAIN-BUDAT.
           IT_MAIN-FLAG = 'X'.
           MODIFY IT_MAIN INDEX V_TABIX TRANSPORTING QTY2 DATE2 FLAG.
         ENDAT.
         QTY2 = IT_MAIN-MENGE.
         DATE2 = IT_MAIN-BUDAT.
    ENDLOOP.
       DELETE IT_MAIN WHERE FLAG <> 'X'.        " 1ST & LAST RECIEPT ........
    ************** ON CUNSUMPTION FIELD LOOP  *****************
        LOOP AT IT_MAIN WHERE BWART = '261' .
         V_TABIX = SY-TABIX - 1.
         AT FIRST.
    IT_MAIN-CMPQTY1 = IT_MAIN-MENGE.
           IT_MAIN-CMPDATE1 = IT_MAIN-BUDAT.
           IT_MAIN-FLAG = 'X'.
           MODIFY IT_MAIN TRANSPORTING CMPQTY1 CMPDATE1 FLAG.
         ENDAT.
         ON CHANGE OF IT_MAIN-MATNR.
         IF SY-TABIX <> 1.
           IT_MAIN-CMPQTY2 = CMPQTY2.
           IT_MAIN-CMPDATE2 = CMPDATE2.
           IT_MAIN-FLAG = 'X'.
           MODIFY IT_MAIN INDEX V_TABIX TRANSPORTING CMPQTY2 CMPDATE2 FLAG.
           CLEAR CMPQTY2.
           CLEAR CMPDATE2.
           IT_MAIN-CMPQTY1 = IT_MAIN-MENGE.
    IT_MAIN-CMPDATE1 = IT_MAIN-BUDAT.
           IT_MAIN-FLAG = 'X'.
           MODIFY IT_MAIN TRANSPORTING CMPQTY1 CMPDATE1 FLAG.
         ENDIF.
         ENDON.
         AT LAST.
           IT_MAIN-CMPQTY2 = IT_MAIN-MENGE.
           IT_MAIN-CMPDATE2 = IT_MAIN-BUDAT.
           IT_MAIN-FLAG = 'X'.
           MODIFY IT_MAIN INDEX V_TABIX TRANSPORTING CMPQTY2 CMPDATE2 FLAG.
         ENDAT.
         CMPQTY2 = IT_MAIN-MENGE.
         CMPDATE2 = IT_MAIN-BUDAT.
       ENDLOOP.
       DELETE IT_MAIN WHERE FLAG <> 'X'.       " 1ST & LAST CONSUMPTION  ........
      ENDIF.
    **************  END OF LOOP ON CONSUMPTION FIELDS ************************
    ENDFORM.
    *&      Form WRITE_DATA
    *       text
    FORM write_data .
       LOOP AT it_main  .
         WRITE :/ it_main-matnr UNDER 'Material' , it_main-maktx UNDER 'Description' ,
                  it_main-DATE1 UNDER 'frstrecdat'  , it_main-QTY1 UNDER 'frstQty',
                  it_main-DATE2 UNDER 'Lastrecdat', it_main-QTY2 UNDER 'lastQty',
                  it_main-CMPDATE1 UNDER 'FstCanspdate', it_main-CMPQTY1 UNDER 'FstCnspqty',
                  it_main-CMPDATE2 UNDER 'Lstcanspdate', it_main-CMPQTY2 UNDER 'Lstqty'.
       ENDLOOP.
      ENDFORM .                    "WRITE_DATA

  • MM not tally with FI

    when i print report MB5S to compare with FBL3N base on a clearing account, I found you both report not tally. This is become user may key in the vendor invoice directly to through FB60 without go thorugh the MM module. How to rectify this error so that both will be tally?

    MB5S --  is only for MM transactions...where you can tally the GR & IR details.
    Comparing with FBL3N with MB5S is possible only the documents posted thru MM .You can chekc the document type ; RE , RP , RL.
    Documents posted using the document type:KR, KG can't chekc against the MB5S......
    While executing the FBL3N exclude the Document types KR, KG, SA.
    VVR

  • KE30 report is not matching with KE24

    Hi Experts,
    In our Production System erroneously, COPA documents were archived during September 2010 (01.09.2010 to 16.09.2010).
    Subsequently, these documents were re-created by SAP Standard transactionsKE4S and KE4SFI.
    Before and after restoring COPA documents, KE30 report is not tallying when we compare with KE24 - especially for September 2010 month. It isworking fine for other months - like August and October 2010.
    In view of the above, could you kindly provide us possible solution to make KE30 will work even for September 2010 - similar to other months.
    Thanks & Regards,
    Satya Srinivas

    I'm not sure whether your KE30 report accesses summarization level data or not, but if you do use summarization levels in CO-PA, follow the steps below to correct this issue. Archive/Deletion removes line items from CE1XXXX but segment table CE3XXXX is not updated at this time which will cause the inconsistency. so..
    Rebuild Segment table CE3XXXX for the complete fiscal year with program RKEREO31 (Reorganization of Segment Level - Actual) ..refer to SAP note 93051 for the complete guidelines..
    (ii) After this, rebuild summarization levels using transaction KEDU as background job.
    I have personally done these steps few times at different clients, you need to plan this properly and execute couple of times in testing system to estimate the run time and check the differences.
    Regards,
    Ganesh

  • Fuel Consumption Report Modification - 2

    Hi Experts
    I am working on fuel consumption modification. can anyone help me how to get max and min value for this program
    I am getting one row correct with equipment no is enter but when I enter the range of equipment no it is taking long time and the result is repeating for each row
    please correct my report
    Thnaks in advanced
    Piroz
    REPORT Z_FUEL2 LINE-SIZE  232 LINE-COUNT 75
             NO STANDARD PAGE HEADING.
    TABLES : equi,
             equz,
             imptt,
             imrg,
             eqkt,
             iloa.
    TYPES: BEGIN OF ty_equi," occurs 0,
           equnr type equi-equnr,
           END OF ty_equi.
    TYPES: BEGIN of ty_eqkt," occurs 0,
           equnr type eqkt-equnr,
           eqktx type eqkt-eqktx,
           END OF ty_eqkt.
    TYPES: BEGIN of ty_iloa ,"occurs 0,
           iloan type iloa-iloan,
           eqfnr type iloa-eqfnr,
           END OF ty_iloa.
    TYPES: BEGIN of ty_imptt," occurs 0,
           mpobj type imptt-mpobj,
           END of ty_imptt.
    TYPES: BEGIN of ty_imrg ,"occurs 0,
           idate type imrg-idate,
           recdv type imrg-recdv,
           recdu type imrg-recdu,
           END of ty_imrg.
    TYPES: BEGIN OF ty_data  ,
           equnr      type equnr,         " Euipment no
           eqktx      type eqkt-eqktx,    " Equipment Text
           eqfnr       type iloa-eqfnr,     " Equipment Sort field
           idate      type imrg-idate,    " Measuring Date
           recdu      type imrg-recdu,    " Unit of measuring ='KM','L','H'
           recdv      type imrg-recdv,    " Counter reading data
           END OF ty_data.
    TYPES: BEGIN OF ty_final,
           equnr           type equnr,            "  Equipment no
           eqktx           type eqkt-eqktx,       "  Equipment Text
           eqfnr           type iloa-eqfnr,       "  Equipment Sort field
           min_date        type imrg-idate,       "  Min Date
           min_km          type imrg-recdv,       "  Max Km
           max_date        type imrg-idate,       "  Max Date
           max_km          type imrg-recdv,       "  Min km
           t_max_min_km    type i,                "  Total min_km-max_km
           min_hr          type imrg-recdv,       "  Max hr
           max_hr          type imrg-recdv,       "  Min hr
           t_max_min_hr    type i,                "  Total min_hr-max_hr
           min_lit         type imrg-recdv,       "  Max lit
           max_lit         type imrg-recdv,       "  Min lit
           t_max_min_lit    type i,                "  Total min_lit-max_lit
           T_fuel_con        type p decimals 2,     "  Total_hrs / t_max_min_hr
           T_km_l            type p decimals 2,     "  km / L
           lit_per_hr      type i           ,     "  fuel comsumed / t_max_min_hr
           END OF ty_final.
    DATA: i_equi TYPE TABLE OF ty_equi,   "internal table
          wa_equi TYPE ty_equi, " work area
          i_eqkt TYPE TABLE OF ty_eqkt,   "internal table
          wa_eqkt TYPE ty_eqkt, " work area
          i_iloa TYPE TABLE of ty_iloa,   "internal table
          wa_iloa TYPE ty_iloa, " work area
          i_imptt TYPE TABLE of ty_imptt, "internal table
          wa_imptt TYPE ty_imptt,
          i_imrg  TYPE TABLE of ty_imrg,  "internal table
          wa_imrg TYPE ty_imrg,
          i_data TYPE TABLE OF ty_data,   "internal table
          wa_data TYPE ty_data, " work area
          i_final TYPE TABLE OF ty_final, " internal table
          wa_final TYPE ty_final. " work area
    DATA :  max_date type date ,
             min_date type date,
             max_km TYPE p DECIMALS 2,
             min_km TYPE p DECIMALS 2,
             max_hr TYPE p DECIMALS 2,
             min_hr TYPE p DECIMALS 2,
             max_lit TYPE p DECIMALS 2,
             min_lit TYPE p DECIMALS 2,
             t_max_min_km  TYPE p DECIMALS 2,
             t_max_min_hr TYPE p DECIMALS 2,
             t_max_min_lit TYPE p DECIMALS 2.
    SELECTION-SCREEN BEGIN OF BLOCK blk WITH FRAME.
    SELECTION-SCREEN BEGIN OF BLOCK blk1 WITH FRAME TITLE text-001.
    SELECT-OPTIONS: p_equnr FOR equi-equnr, "no-extension no intervals,
                    p_idate FOR imrg-idate.  "NO-EXTENSION NO INTERVALS OBLIGATORY,
                   " p_recdu FOR imrg-recdu." NO-EXTENSION NO INTERVALS ."default 'M3'" OBLIGATORY.
    SELECTION-SCREEN END OF BLOCK blk1.
    SELECTION-SCREEN BEGIN OF BLOCK blk2 WITH FRAME TITLE text-002.
    SELECTION-SCREEN END OF BLOCK blk2.
    SELECTION-SCREEN END OF BLOCK blk.
    TOP-OF-PAGE.
      FORMAT INTENSIFIED ON.
      WRITE:/1(40) ' INVESTMENT LIMITED  '.
      WRITE:/50(40) ' FUEL CONSUMPTION REPORT ' CENTERED   ,
              2 'Page', sy-pagno.
      FORMAT INTENSIFIED OFF.
      WRITE:/50(40) '----
    ' CENTERED .
      FORMAT INTENSIFIED ON.
      WRITE:/2 sy-datum COLOR 3, sy-uzeit .
      "WRITE:/1 S903-SPMON ."p_yearf.
      ULINE.
      "CENTERED.
      write: /2 'Date From     :'.
      write: /2 'Equipment No  :'.
      write: /2 'Unit          :'.
      SKIP.
      ULINE.
      WRITE:/1 sy-vline,
        2   'EQUIP NO',              10 sy-vline,
        11  'NAME',                  40 sy-vline,
        41  'SORT',                  60 sy-vline,
        61  'MIN DATE',              74 sy-vline,
        75  'MIN KM',                87 sy-vline,
        88  'MAX DATE',              100 sy-vline,
        101 'MAX KM' ,               113 sy-vline,
        114 'TOTAL KM',              126 sy-vline COLOR 2,
        127 'MIN HR',                139 sy-vline,
        140 'MAX HR',                152 sy-vline,
        153 'TOTAL HR' ,             167 sy-vline COLOR 2,
        168 'MIN LIT',               180 sy-vline,
        181 'MAX LIT',               193 sy-vline,
        194 'FUEL CON',              206 sy-vline  COLOR 2,
        207 'KM L',                  219 sy-vline,
        220 'LIT PER HR',            232 sy-vline.
      FORMAT COLOR 3 ON.
      ULINE.
    END-OF-PAGE.
    START-OF-SELECTION.
    select a~equnr d~eqktx f~eqfnr e~idate e~recdu e~recdv
    into corresponding fields of table i_data
    from equi AS a
    inner join equz as b
    on a~equnr = b~equnr
    inner join iloa as f
    on b~iloan = f~iloan
    inner join imptt as c
    on a~objnr = c~mpobj
    inner join eqkt as d
    on a~equnr = d~equnr
    inner join imrg as e
    on e~point = c~point
    where a~equnr in p_equnr
    and
    e~idate in p_idate and
    e~recdu in ('KM','L','H').
    "e~recdu in p_recdu.
    equi
    *select equnr from equi into table i_equi
    *for all entries in I_DATA
    **where objnr = i_equnr-mpobj.
    *where equnr = i_data-equnr.
    *endselect.
    eqkt
    *select equnr eqktx into table I_eqkt
    *from eqkt
    *FOR ALL ENTRIES IN I_DATA
    *where equnr = i_data-Equnr.
    *endselect.
    iloa
    *select eqfnr into table I_iloa
    *from equz
    *FOR ALL ENTRIES IN I_DATA
    *on equziloan = iloailoan
    *where iloan = i_data-iloan .
    *endselect.
    imrg
    *select idate recdv recdu into table I_imrg
    *from imrg
    *FOR ALL ENTRIES IN I_DATA
    *where imrg~objnr = i_date-mpobj.
    *endselect.
    loop  at i_data into wa_data.
    CLEAR: wa_final.
      READ TABLE i_final into wa_final
               with key equnr = wa_data-equnr.
        if sy-subrc EQ 0.
         PERFORM prepare_get_equi.
         PERFORM prepare_get_eqkt.
         PERFORM prepare_get_iloa.
         PERFORM prepare_get_imptt.
         PERFORM prepare_get_imrg.
          PERFORM prepare_final_rec USING'M'. " Modify Existing Record
          ElSE.
          PERFORM prepare_final_rec USING'A'. " Append New Record.
        ENDIF.
        ENDLOOP.
        LOOP AT i_final into wa_final.
         SORT i_final by equnr  descending.
          at new equnr.
            read table i_final into wa_final index sy-tabix.
                WRITE:/1 sy-vline,
    2  wa_final-equnr                                                 , 10 sy-vline,
    11 wa_final-eqktx                                                 , 40 sy-vline,
    41 wa_final-eqfnr                                                 , 60 sy-vline,
    61 wa_final-min_date                                              , 74 sy-vline,
    75 wa_final-min_km EXPONENT 0 DECIMALS 2   LEFT-JUSTIFIED           , 87 sy-vline,
    88 wa_final-max_date EXPONENT 0 DECIMALS 2   LEFT-JUSTIFIED         , 100 sy-vline,
    101 wa_final-max_km EXPONENT 0 DECIMALS 2   LEFT-JUSTIFIED          , 113 sy-vline,
    114 wa_final-t_max_min_km EXPONENT 0 DECIMALS 2 color 3 LEFT-JUSTIFIED    , 126 sy-vline COLOR 2,
    127 wa_final-min_hr EXPONENT 0 DECIMALS 2   LEFT-JUSTIFIED          , 139 sy-vline,
    140 wa_final-max_hr EXPONENT 0 DECIMALS 2 LEFT-JUSTIFIED          , 152 sy-vline,
    153 wa_final-t_max_min_hr EXPONENT 0 DECIMALS 2 color 3 LEFT-JUSTIFIED   , 167 sy-vline COLOR 2,
    168 wa_final-min_lit EXPONENT 0 DECIMALS 2  LEFT-JUSTIFIED         , 180 sy-vline,
    181 wa_final-max_lit EXPONENT 0 DECIMALS 2 LEFT-JUSTIFIED         , 193 sy-vline,
    *194 wa_final-t_max_min_lit EXPONENT 0 DECIMALS 2 color 3 LEFT-JUSTIFIED   , 206 sy-vline COLOR 2,
    194 wa_final-T_fuel_con EXPONENT 0 DECIMALS 2 LEFT-JUSTIFIED        , 206 sy-vline,
    207 wa_final-t_km_l EXPONENT 0 DECIMALS 2 LEFT-JUSTIFIED            , 219 sy-vline,
    220 wa_final-lit_per_hr EXPONENT 0 DECIMALS 2 LEFT-JUSTIFIED      , 232 sy-vline.
    *168 wa_final-min_lit EXPONENT 0 DECIMALS 2  LEFT-JUSTIFIED         , 180 sy-vline,
    *194 wa_final-t_max_min_lit EXPONENT 0 DECIMALS 2 LEFT-JUSTIFIED   , 206 sy-vline COLOR 2,
    *207 wa_final-fuel_con EXPONENT 0 DECIMALS 2 LEFT-JUSTIFIED        , 219 sy-vline,
    *220 wa_final-km_l EXPONENT 0 DECIMALS 2 LEFT-JUSTIFIED            , 232 sy-vline,
    *233 wa_final-lit_per_hr EXPONENT 0 DECIMALS 2 LEFT-JUSTIFIED      , 246 sy-vline.
    *207 wa_final-T_fuel_con EXPONENT 0 DECIMALS 2 LEFT-JUSTIFIED        , 219 sy-vline,
    *220 wa_final-t_km_l EXPONENT 0 DECIMALS 2 LEFT-JUSTIFIED            , 232 sy-vline,
    *233 wa_final-lit_per_hr EXPONENT 0 DECIMALS 2 LEFT-JUSTIFIED      , 246 sy-vline.
    uline.
        "endat.
    *at end of equnr.
           read table i_final into wa_final index sy-tabix.
              WRITE:/1 sy-vline,
    *2  wa_final-equnr                                                 , 10 sy-vline,
    *11 wa_final-eqktx                                                 , 40 sy-vline,
    *41 wa_final-eqfnr                                                 , 60 sy-vline,
    *88 wa_final-max_date EXPONENT 0 DECIMALS 2   LEFT-JUSTIFIED         , 100 sy-vline,
    *101 wa_final-max_km EXPONENT 0 DECIMALS 2   LEFT-JUSTIFIED          , 113 sy-vline,
    *140 wa_final-max_hr EXPONENT 0 DECIMALS 2 LEFT-JUSTIFIED          , 152 sy-vline.
    **181 wa_final-max_lit EXPONENT 0 DECIMALS 2 LEFT-JUSTIFIED         , 193 sy-vline.
    *114 wa_final-t_max_min_km EXPONENT 0 DECIMALS 2   LEFT-JUSTIFIED    , 126 sy-vline COLOR 2,
    *140 wa_final-max_hr EXPONENT 0 DECIMALS 2 LEFT-JUSTIFIED          , 152 sy-vline.
    *153 wa_final-t_max_min_hr EXPONENT 0 DECIMALS 2  LEFT-JUSTIFIED   , 167 sy-vline COLOR 2,
    *181 wa_final-max_lit EXPONENT 0 DECIMALS 2 LEFT-JUSTIFIED         , 193 sy-vline,
    *194 wa_final-t_max_min_lit EXPONENT 0 DECIMALS 2 LEFT-JUSTIFIED   , 206 sy-vline COLOR 2,
    *207 wa_final-fuel_con EXPONENT 0 DECIMALS 2 LEFT-JUSTIFIED        , 219 sy-vline,
    *220 wa_final-km_l EXPONENT 0 DECIMALS 2 LEFT-JUSTIFIED            , 232 sy-vline,
    *233 wa_final-lit_per_hr EXPONENT 0 DECIMALS 2 LEFT-JUSTIFIED      , 246 sy-vline.
    uline .
       WRITE:/1 sy-vline,
    *2  wa_final-equnr                                                 , 10 sy-vline,
    *11 wa_final-eqktx                                                 , 40 sy-vline,
    *41 wa_final-eqfnr                                                 , 60 sy-vline,
    *61 wa_final-min_date                                              , 74 sy-vline,
    *75 wa_final-min_km EXPONENT 0 DECIMALS 2 LEFT-JUSTIFIED           , 87 sy-vline,
    *88 wa_final-max_date EXPONENT 0 DECIMALS 2 LEFT-JUSTIFIED         , 100 sy-vline,
    *101 wa_final-max_km EXPONENT 0 DECIMALS 2 LEFT-JUSTIFIED          , 113 sy-vline,
    *114 wa_final-t_max_min_km EXPONENT 0 DECIMALS 2 LEFT-JUSTIFIED    , 126 sy-vline COLOR 2,
    *127 wa_final-min_hr EXPONENT 0 DECIMALS 2 LEFT-JUSTIFIED          , 139 sy-vline,
    *140 wa_final-max_hr EXPONENT 0 DECIMALS 2 LEFT-JUSTIFIED          , 152 sy-vline,
    *153 wa_final-t_max_min_hr EXPONENT 0 DECIMALS 2  LEFT-JUSTIFIED   , 167 sy-vline COLOR 2,
    *168 wa_final-min_lit EXPONENT 0 DECIMALS 2 LEFT-JUSTIFIED         , 180 sy-vline,
    *181 wa_final-max_lit EXPONENT 0 DECIMALS 2 LEFT-JUSTIFIED         , 193 sy-vline,
    *194 wa_final-t_max_min_lit EXPONENT 0 DECIMALS 2 LEFT-JUSTIFIED   , 206 sy-vline COLOR 2,
    *207 wa_final-fuel_con EXPONENT 0 DECIMALS 2 LEFT-JUSTIFIED        , 219 sy-vline,
    *220 wa_final-km_l EXPONENT 0 DECIMALS 2 LEFT-JUSTIFIED            , 232 sy-vline,
    *233 wa_final-lit_per_hr EXPONENT 0 DECIMALS 2 LEFT-JUSTIFIED      , 246 sy-vline.
    *ULINE.
    endloop.
    FORM prepare_final_rec  USING    p_mode TYPE char1.
    KM
    select MAX( eidate ) Min( eidate ) MAX( erecdv ) MIN( erecdv )
    into  corresponding fields of (wa_final-max_date,wa_final-min_date, wa_final-max_km , wa_final-min_km)
    from equi AS a
    inner join equz as b
    on aequnr = bequnr
    inner join iloa as f
    on biloan = filoan
    inner join imptt as c
    on aobjnr = cmpobj
    inner join eqkt as d
    on aequnr = dequnr
    inner join imrg as e
    on epoint = cpoint
    where a~equnr in p_equnr
    and
    e~idate in p_idate and
    e~recdu =  'KM' .
    "group by aequnr deqktx feqfnr eidate erecdu erecdv.
    "endselect.
    HOUR
    select MAX( eidate ) Min( eidate ) MAX( erecdv ) MIN( erecdv )
    into corresponding fields of (wa_final-max_date, wa_final-min_date, wa_final-max_hr, wa_final-min_hr)
    from equi AS a
    inner join equz as b
    on aequnr = bequnr
    inner join iloa as f
    on biloan = filoan
    inner join imptt as c
    on aobjnr = cmpobj
    inner join eqkt as d
    on aequnr = dequnr
    inner join imrg as e
    on epoint = cpoint
    where a~equnr in p_equnr
    and
    e~idate in p_idate and
    e~recdu =  'H'.
    "group by aequnr deqktx feqfnr eidate erecdu erecdv.
    "endselect.
    LIT
    select MAX( eidate ) Min( eidate ) MAX( erecdv ) MIN( erecdv ) SUM( e~recdv )
    into (wa_final-max_date,wa_final-min_date, wa_final-max_lit, wa_final-min_lit ,  wa_final-t_max_min_lit )
    from equi AS a
    inner join equz as b
    on aequnr = bequnr
    inner join iloa as f
    on biloan = filoan
    inner join imptt as c
    on aobjnr = cmpobj
    inner join eqkt as d
    on aequnr = dequnr
    inner join imrg as e
    on epoint = cpoint
    where a~equnr in p_equnr
    and
    e~idate in p_idate and
    e~recdu =  'L' .
    "group by aequnr deqktx feqfnr eidate erecdu erecdv.
    "endselect.
            wa_final-max_date = wa_final-max_date + wa_data-idate .
            wa_final-min_date  = wa_final-min_date + wa_data-idate .
            wa_final-max_km  = wa_final-max_km + wa_data-recdv.
            wa_final-min_km  = wa_final-min_km + wa_data-recdv.
            wa_final-max_hR  = wa_final-max_hr + wa_data-recdv.
            wa_final-min_hR  = wa_final-min_hr + wa_data-recdv.
            wa_final-max_lit = wa_final-max_lit + wa_data-recdv.
             wa_final-t_max_min_km   = ( wa_final-max_km - wa_final-min_km ).
             wa_final-t_max_min_hr  =  ( wa_final-max_hr - wa_final-min_hr ).
             "wa_final-t_max_min_lit   = ( wa_final-max_lit - wa_final-min_lit ).
              wa_final-t_fuel_con = wa_final-t_max_min_lit.
              wa_final-t_km_l = wa_final-t_max_min_km / wa_final-t_max_min_lit.
              wa_final-lit_per_hr  = wa_final-t_max_min_lit / wa_final-t_max_min_hr .    "  fuel comsumed / t_max_min_hr
      IF p_mode = 'A'.
        wa_final-equnr = wa_data-equnr.
        wa_final-eqktx = wa_data-eqktx.
        wa_final-eqfnr = wa_data-eqfnr.
        APPEND wa_final TO i_final.
      ELSE.
        MODIFY i_final FROM wa_final
          TRANSPORTING
              max_date
              min_date
              max_km
              min_km
              max_hr
              min_hr
              max_lit
              min_lit
              t_max_min_km
              t_max_min_hr
              where equnr = wa_data-equnr.
      ENDIF.
    "endselect.
    ENDFORM.                    " PREPARE_FINAL_REC

    Hi Ankit,
    If your quantity depends on your material movement type, then you can create a condition in Calculated Keyfig / Formula.
    That means as per your situation if the material movement type is 101 then quantity is incoming(+) and if the material movement type is 120 then outgoing(-).This can be done if the material movement type is fixed.
    Correct the logic if it is not right.
    Rgs,
    I.R.K

  • Fuel Consumption Report Modification - 21

    Hi Experts
    I am working on fuel consumption modification. can anyone help me how to get max and min value for this program
    I am getting one row correct with equipment no is enter but when I enter the range of equipment no it is taking long time and the result is repeating for each row
    please correct my report
    Thnaks in advanced
    Piroz
    REPORT Z_ESLP_FUEL2 LINE-SIZE  250 LINE-COUNT 75
             NO STANDARD PAGE HEADING.
    TABLES : equi,
             equz,
             imptt,
             imrg,
             eqkt,
             iloa.
    TYPES: BEGIN OF ty_equi," occurs 0,
           equnr type equi-equnr,
           END OF ty_equi.
    TYPES: BEGIN of ty_eqkt," occurs 0,
           equnr type eqkt-equnr,
           eqktx type eqkt-eqktx,
           END OF ty_eqkt.
    TYPES: BEGIN of ty_iloa ,"occurs 0,
           iloan type iloa-iloan,
           eqfnr type iloa-eqfnr,
           END OF ty_iloa.
    TYPES: BEGIN of ty_imptt," occurs 0,
           mpobj type imptt-mpobj,
           END of ty_imptt.
    TYPES: BEGIN of ty_imrg ,"occurs 0,
           idate type imrg-idate,
           recdv type imrg-recdv,
           recdu type imrg-recdu,
           END of ty_imrg.
    TYPES: BEGIN OF ty_data  ,
           equnr      type equnr,         " Euipment no
           eqktx      type eqkt-eqktx,    " Equipment Text
           eqfnr       type iloa-eqfnr,     " Equipment Sort field
           idate      type imrg-idate,    " Measuring Date
           recdu      type imrg-recdu,    " Unit of measuring ='KM','L','H'
           recdv      type imrg-recdv,    " Counter reading data
           END OF ty_data.
    TYPES: BEGIN OF ty_final,
           equnr           type equnr,            "  Equipment no
           eqktx           type eqkt-eqktx,       "  Equipment Text
           eqfnr           type iloa-eqfnr,       "  Equipment Sort field
           min_date        type imrg-idate,       "  Min Date
           min_km          type imrg-recdv,       "  Max Km
           max_km          type imrg-recdv,       "  Min km
           t_max_min_km    type i,                "  Total min_km-max_km
           max_date        type imrg-idate,       "  Max Date
           min_hr          type imrg-recdv,       "  Max hr
           max_hr          type imrg-recdv,       "  Min hr
           t_max_min_hr    type i,                "  Total min_hr-max_hr
           min_lit         type imrg-recdv,       "  Max lit
           max_lit         type imrg-recdv,       "  Min lit
           t_max_min_lit    type i,                "  Total min_lit-max_lit
           fuel_con        type p decimals 2,     "  Total_hrs / t_max_min_hr
           km_l            type p decimals 2,     "  km / L
           lit_per_hr      type i           ,     "  fuel comsumed / t_max_min_hr
           END OF ty_final.
    DATA: i_equi TYPE TABLE OF ty_equi,   "internal table
          wa_equi TYPE ty_equi, " work area
          i_eqkt TYPE TABLE OF ty_eqkt,   "internal table
          wa_eqkt TYPE ty_eqkt, " work area
          i_iloa TYPE TABLE of ty_iloa,   "internal table
          wa_iloa TYPE ty_iloa, " work area
          i_imptt TYPE TABLE of ty_imptt, "internal table
          wa_imptt TYPE ty_imptt,
          i_imrg  TYPE TABLE of ty_imrg,  "internal table
          wa_imrg TYPE ty_imrg,
          i_data TYPE TABLE OF ty_data,   "internal table
          wa_data TYPE ty_data, " work area
          i_final TYPE TABLE OF ty_final, " internal table
          wa_final TYPE ty_final. " work area
    DATA :  max_date type date ,
             min_date type date,
             max_km TYPE p DECIMALS 2,
             min_km TYPE p DECIMALS 2,
             max_hr TYPE p DECIMALS 2,
             min_hr TYPE p DECIMALS 2,
             max_lit TYPE p DECIMALS 2,
             min_lit TYPE p DECIMALS 2,
             t_max_min_km  TYPE p DECIMALS 2,
             t_max_min_hr TYPE p DECIMALS 2,
             t_max_min_lit TYPE p DECIMALS 2.
    SELECTION-SCREEN BEGIN OF BLOCK blk WITH FRAME.
    SELECTION-SCREEN BEGIN OF BLOCK blk1 WITH FRAME TITLE text-001.
    SELECT-OPTIONS: p_equnr FOR equi-equnr, "no-extension no intervals,
                    p_idate FOR imrg-idate.  "NO-EXTENSION NO INTERVALS OBLIGATORY,
                   " p_recdu FOR imrg-recdu." NO-EXTENSION NO INTERVALS ."default 'M3'" OBLIGATORY.
    SELECTION-SCREEN END OF BLOCK blk1.
    SELECTION-SCREEN BEGIN OF BLOCK blk2 WITH FRAME TITLE text-002.
    SELECTION-SCREEN END OF BLOCK blk2.
    SELECTION-SCREEN END OF BLOCK blk.
    TOP-OF-PAGE.
      FORMAT INTENSIFIED ON.
      WRITE:/1(40) ' INVESTMENT LIMITED  '.
      WRITE:/50(40) ' FUEL CONSUMPTION REPORT ' CENTERED   ,
              2 'Page', sy-pagno.
      FORMAT INTENSIFIED OFF.
      WRITE:/50(40) '----
    ' CENTERED .
      FORMAT INTENSIFIED ON.
      WRITE:/2 sy-datum COLOR 3, sy-uzeit .
      "WRITE:/1 S903-SPMON ."p_yearf.
      ULINE.
      "CENTERED.
      write: /2 'Date From     :'.
      write: /2 'Equipment No  :'.
      write: /2 'Unit          :'.
      SKIP.
      ULINE.
      WRITE:/1 sy-vline,
        2   'EQUIP NO',              10 sy-vline,
        11  'NAME',                  40 sy-vline,
        41  'SORT',                  60 sy-vline,
        61  'MIN DATE',              74 sy-vline,
        75  'MIN KM',                87 sy-vline,
        88  'MAX DATE',                100 sy-vline,
        101  'MAX KM' ,              113 sy-vline,
        114 'TOTAL MAX-MIN',                126 sy-vline,
        127  'MIN HR',               139 sy-vline,
        140 'MAX HR',                152 sy-vline,
        153 'TOTAL MAX-MIN' ,               167 sy-vline,
        168 'MIN LIT',               180 sy-vline,
        181 'MAX LIT',               193 sy-vline,
        194 'TOTAL LIT',             206 sy-vline,
        207 'FUEL CON',              219 sy-vline,
        220 'KM L',                  232 sy-vline,
        233 'LIT PER KM',            246 sy-vline.
      FORMAT COLOR 3 ON.
      ULINE.
    END-OF-PAGE.
    START-OF-SELECTION.
    select a~equnr d~eqktx f~eqfnr e~idate e~recdu e~recdv
    into corresponding fields of table i_data
    from equi AS a
    inner join equz as b
    on a~equnr = b~equnr
    inner join iloa as f
    on b~iloan = f~iloan
    inner join imptt as c
    on a~objnr = c~mpobj
    inner join eqkt as d
    on a~equnr = d~equnr
    inner join imrg as e
    on e~point = c~point
    where a~equnr in p_equnr
    and
    e~idate in p_idate and
    e~recdu in ('KM','L','H').
    "e~recdu in p_recdu.
    equi
    *select equnr from equi into table i_equi
    *for all entries in I_DATA
    **where objnr = i_equnr-mpobj.
    *where equnr = i_data-equnr.
    *endselect.
    eqkt
    *select equnr eqktx into table I_eqkt
    *from eqkt
    *FOR ALL ENTRIES IN I_DATA
    *where equnr = i_data-Equnr.
    *endselect.
    iloa
    *select eqfnr into table I_iloa
    *from equz
    *FOR ALL ENTRIES IN I_DATA
    *on equziloan = iloailoan
    *where iloan = i_data-iloan .
    *endselect.
    imrg
    *select idate recdv recdu into table I_imrg
    *from imrg
    *FOR ALL ENTRIES IN I_DATA
    *where imrg~objnr = i_date-mpobj.
    *endselect.
    loop  at i_data into wa_data.
    CLEAR: wa_final.
      READ TABLE i_final into wa_final
               with key equnr = wa_data-equnr.
        if sy-subrc EQ 0.
         PERFORM prepare_get_equi.
         PERFORM prepare_get_eqkt.
         PERFORM prepare_get_iloa.
         PERFORM prepare_get_imptt.
         PERFORM prepare_get_imrg.
          PERFORM prepare_final_rec USING'M'. " Modify Existing Record
          ElSE.
          PERFORM prepare_final_rec USING'A'. " Append New Record.
        ENDIF.
        ENDLOOP.
        LOOP AT i_final into wa_final.
          SORT i_final by equnr  descending.
        at new equnr.
        read table i_final into wa_final index sy-tabix.
    WRITE:/1 sy-vline,
    2  wa_final-equnr                                                 , 10 sy-vline,
    11 wa_final-eqktx                                                 , 40 sy-vline,
    41 wa_final-eqfnr                                                 , 60 sy-vline,
    61 wa_final-min_date                                              , 74 sy-vline,
    75 wa_final-min_km EXPONENT 0 DECIMALS 2   LEFT-JUSTIFIED           , 87 sy-vline,
    88 wa_final-max_date EXPONENT 0 DECIMALS 2   LEFT-JUSTIFIED         , 100 sy-vline,
    101 wa_final-max_km EXPONENT 0 DECIMALS 2   LEFT-JUSTIFIED          , 113 sy-vline,
    114 wa_final-t_max_min_km EXPONENT 0 DECIMALS 2 LEFT-JUSTIFIED    , 126 sy-vline COLOR 2,
    127 wa_final-min_hr EXPONENT 0 DECIMALS 2   LEFT-JUSTIFIED          , 139 sy-vline,
    140 wa_final-max_hr EXPONENT 0 DECIMALS 2 LEFT-JUSTIFIED          , 152 sy-vline,
    168 wa_final-min_lit EXPONENT 0 DECIMALS 2  LEFT-JUSTIFIED         , 180 sy-vline,
    181 wa_final-max_lit EXPONENT 0 DECIMALS 2 LEFT-JUSTIFIED         , 193 sy-vline,
    194 wa_final-t_max_min_lit EXPONENT 0 DECIMALS 2 LEFT-JUSTIFIED   , 206 sy-vline COLOR 2.
    *168 wa_final-min_lit EXPONENT 0 DECIMALS 2  LEFT-JUSTIFIED         , 180 sy-vline,
    *194 wa_final-t_max_min_lit EXPONENT 0 DECIMALS 2 LEFT-JUSTIFIED   , 206 sy-vline COLOR 2,
    *207 wa_final-fuel_con EXPONENT 0 DECIMALS 2 LEFT-JUSTIFIED        , 219 sy-vline,
    *220 wa_final-km_l EXPONENT 0 DECIMALS 2 LEFT-JUSTIFIED            , 232 sy-vline,
    *233 wa_final-lit_per_hr EXPONENT 0 DECIMALS 2 LEFT-JUSTIFIED      , 246 sy-vline.
    uline.
    uline .
    endloop.
    FORM prepare_final_rec  USING    p_mode TYPE char1.
    select MAX( eidate ) Min( eidate ) MAX( erecdv ) MIN( erecdv )
    into  corresponding fields of (wa_final-max_date,wa_final-min_date, wa_final-max_km , wa_final-min_km)
    from equi AS a
    inner join equz as b
    on aequnr = bequnr
    inner join iloa as f
    on biloan = filoan
    inner join imptt as c
    on aobjnr = cmpobj
    inner join eqkt as d
    on aequnr = dequnr
    inner join imrg as e
    on epoint = cpoint
    where a~equnr in p_equnr
    and
    e~idate in p_idate and
    e~recdu =  'KM' .
    "group by aequnr deqktx feqfnr eidate erecdu erecdv.
    "endselect.
    select MAX( eidate ) Min( eidate ) MAX( erecdv ) MIN( erecdv )
    into corresponding fields of (wa_final-max_date, wa_final-min_date, wa_final-max_hr, wa_final-min_hr)
    from equi AS a
    inner join equz as b
    on aequnr = bequnr
    inner join iloa as f
    on biloan = filoan
    inner join imptt as c
    on aobjnr = cmpobj
    inner join eqkt as d
    on aequnr = dequnr
    inner join imrg as e
    on epoint = cpoint
    where a~equnr in p_equnr
    and
    e~idate in p_idate and
    e~recdu =  'H'.
    "group by aequnr deqktx feqfnr eidate erecdu erecdv.
    "endselect.
    select MAX( eidate ) Min( eidate ) MAX( erecdv ) MIN( erecdv ) SUM( e~recdv )
    into (wa_final-max_date,wa_final-min_date, wa_final-max_lit, wa_final-min_lit ,  wa_final-t_max_min_lit )
    from equi AS a
    inner join equz as b
    on aequnr = bequnr
    inner join iloa as f
    on biloan = filoan
    inner join imptt as c
    on aobjnr = cmpobj
    inner join eqkt as d
    on aequnr = dequnr
    inner join imrg as e
    on epoint = cpoint
    where a~equnr in p_equnr
    and
    e~idate in p_idate and
    e~recdu =  'L' .
    "group by aequnr deqktx feqfnr eidate erecdu erecdv.
    "endselect.
             wa_final-t_max_min_km   = ( wa_final-max_km - wa_final-min_km ).
             wa_final-t_max_min_hr  =  ( wa_final-max_hr - wa_final-min_hr ).
             "wa_final-t_max_min_lit   = ( wa_final-max_lit - wa_final-min_lit ).
            wa_final-fuel_con =
            fuel_con        type p decimals 2,     "  Total_hrs / t_max_min_hr
            km_l            type p decimals 2,     "  km / L
            lit_per_hr      type i           ,     "  fuel comsumed / t_max_min_hr
      IF p_mode = 'A'.
        wa_final-equnr = wa_data-equnr.
        wa_final-eqktx = wa_data-eqktx.
        wa_final-eqfnr = wa_data-eqfnr.
        APPEND wa_final TO i_final.
      ELSE.
        MODIFY i_final FROM wa_final
          TRANSPORTING
              max_date
              min_date
              max_km
              min_km
              max_hr
              min_hr
              max_lit
              min_lit
              t_max_min_km
              t_max_min_hr
              where equnr = wa_data-equnr.
      ENDIF.
    "endselect.
    ENDFORM.                    " PREPARE_FINAL_REC

    Hi,
      I don't think so that there is such report which will give you operation wise consumption but you can make that fuel consumption as a activity type in ur standard value key and make some std value to put it in the routing, then if you go for operation wise confirmation then in that screen you will be able to put the consumption details in it.
    you can take a report of that also in COOIS.
    order wise consumption you can get from order report itself
    reward poits if you find it useful.

  • Dump Error in MAterial Consumption Report

    Hi all Gurus
    [1] I need help from your side i am doing one material consumption report in that i did all thing but it is giving me dump error while i was using sort  in to ALV
    so please any one help me out this .......
    [2] I am Printing sum of quantity in Header area of smartform it is printing with using comma e.x 43,000 but in body area it is showing with decimal point
    e.x 43.000
    Following is my ALV reports code please check it it is giving me short dump while using sort ..............
    I am very much in neeed
    Thanx for your suggestion in advanc.....
    and god bless you............
    *& Report  ZCONSUM
    REPORT  ZCONSUM.
    *& Report  ZCONSUMPTION
    TYPE-POOLS : SLIS.
    TABLES:marc,
           mara,
           makt,
           mard,
           mbew,
           mseg,
           mkpf.
    TYPES:
            BEGIN OF s_mseg,
                mblnr LIKE mseg-mblnr,
                mjahr LIKE mseg-mjahr,
                zeile LIKE mseg-zeile,
                bwart LIKE mseg-bwart,
                matnr LIKE mseg-matnr,
                werks LIKE mseg-werks,
                menge LIKE mseg-menge,
                budat LIKE mkpf-budat,
                mtart LIKE mara-matnr,
                matkl LIKE mara-matkl,
            END OF s_mseg,
            BEGIN OF s_t001w,
                werks LIKE t001w-werks,
                name1 LIKE t001w-name1,
            END OF s_t001w,
            BEGIN OF s_mara,
                matnr LIKE mara-matnr,
                mtart LIKE mara-mtart,
                matkl LIKE mara-matkl,
            END OF s_mara,
            BEGIN OF s_makt,
                matnr LIKE makt-matnr,
                spras LIKE makt-spras,
                maktx LIKE makt-maktx,
            END OF s_makt,
           BEGIN OF s_calc,
                matnr       LIKE mara-matnr,
                mtart       LIKE mara-mtart,
                matkl       LIKE mara-matkl,
                maktx       LIKE makt-maktx,
               menge_t     LIKE mseg-menge,
               menge_t1    LIKE mseg-menge,
                menge_con_261   LIKE mseg-menge,
                menge_con_262   LIKE mseg-menge,
                menge_con1_261  LIKE mseg-menge,
                menge_con1_262  LIKE mseg-menge,
                menge_ret_291   LIKE mseg-menge,
                menge_ret1_291  LIKE mseg-menge,
                menge_ret_292   LIKE mseg-menge,
                menge_ret1_292  LIKE mseg-menge,
                menge_unit_301  LIKE mseg-menge,
                menge_unit1_301 LIKE mseg-menge,
                menge_unit_302  LIKE mseg-menge,
                menge_unit1_302 LIKE mseg-menge,
                menge_sub   LIKE mseg-menge,
                menge_sub1   LIKE mseg-menge,
                menge_oth   LIKE mseg-menge,
                menge_oth1  LIKE mseg-menge,
            END OF s_calc,
            BEGIN OF s_data,
                matnr       LIKE mara-matnr,
                matkl       LIKE mara-matkl,
                mtart       LIKE mara-mtart,
                maktx       LIKE makt-maktx,
                menge_t     LIKE mseg-menge,
                menge_t1    LIKE mseg-menge,
                menge_con   LIKE mseg-menge,
                menge_con1  LIKE mseg-menge,
                menge_ret   LIKE mseg-menge,
                menge_ret1  LIKE mseg-menge,
                menge_unit  LIKE mseg-menge,
                menge_unit1 LIKE mseg-menge,
                menge_sub   LIKE mseg-menge,
                menge_sub1   LIKE mseg-menge,
                menge_oth   LIKE mseg-menge,
                menge_oth1  LIKE mseg-menge,
            END OF s_data.
    DATA:   w_mseg TYPE s_mseg,
            i_mseg TYPE s_mseg OCCURS 0,
            w_t001w TYPE s_t001w,
            i_t001w TYPE s_t001w OCCURS 0,
            w_mara TYPE s_mara,
            i_mara TYPE s_mara OCCURS 0,
            w_makt TYPE s_makt,
            i_makt TYPE s_makt OCCURS 0,
            w_calc TYPE s_calc,
            i_calc TYPE s_calc OCCURS 0,
            w_data TYPE s_data,
            i_data TYPE s_data OCCURS 0.
    DATA:   line_cnt TYPE i,
            v_temp TYPE p DECIMALS 2.
    ALV DATA DECLERATION
    DATA : IT_FIELD TYPE SLIS_T_FIELDCAT_ALV,
           WA_FIELD TYPE SLIS_FIELDCAT_ALV.
    DATA : IT_LAYOUT TYPE SLIS_LAYOUT_ALV.
    IT_LAYOUT-ZEBRA = 'X'.
    IT_LAYOUT-TOTALS_TEXT = 'Grand Total'.
    IT_LAYOUT-SUBTOTALS_TEXT = 'Sub Total'.
    IT_LAYOUT-INFO_FIELDNAME = 'LINE_COLOR'.
    DATA: WA_COMMENTRY TYPE SLIS_LISTHEADER.
    DATA: IT_COMMENTRY TYPE SLIS_T_LISTHEADER.
    DATA: WA_COMMENTRY1 TYPE SLIS_LISTHEADER.
    DATA: IT_COMMENTRY1 TYPE SLIS_T_LISTHEADER.
    DATA: WA_EVENT TYPE SLIS_ALV_EVENT.
    DATA: IT_EVENT TYPE SLIS_T_EVENT.
    WA_EVENT-NAME = 'TOP_OF_PAGE'.
    WA_EVENT-FORM = 'TOP'.
    APPEND WA_EVENT TO IT_EVENT.
    DATA : WA_SORT TYPE slis_sortinfo_alv,
           IT_SORT TYPE SLIS_T_SORTINFO_ALV.
    CLEAR WA_SORT.
    WA_SORT-SPOS = '1'.
    WA_SORT-FIELDNAME = 'MATKL'.
    WA_SORT-TABNAME = 'I_DATA'.
    WA_SORT-SUBTOT = 'X'.
    APPEND WA_SORT TO IT_SORT.
    CLEAR WA_SORT.
    WA_SORT-SPOS = '2'.
    WA_SORT-FIELDNAME = 'MTART'.
    WA_SORT-TABNAME = 'I_DATA'.
    WA_SORT-SUBTOT = 'X'.
    APPEND WA_SORT TO IT_SORT.
    DEFINE MAC1.
    WA_FIELD-TABNAME = 'I_DATA'.
    WA_FIELD-FIELDNAME = &1.
    WA_FIELD-COL_POS = &2.
    WA_FIELD-SELTEXT_L =&3.
    WA_FIELD-DO_SUM = &4.
    APPEND WA_FIELD TO IT_FIELD.
    END-OF-DEFINITION.
    MAC1 'MATKL'        '1'  'MATERIAL GROUP' 'X'.
    MAC1 'MTART'        '2'  'MATERIAL TYPE' 'X'.
    MAC1 'MATNR'        '3'  'MATERIAL NO'  'X'.
    MAC1 'MAKTX'        '4'  'DESCRIPTION' 'X'.
    MAC1 'MENGE_CON1'   '5'  'CONSUMPTION FOR PERIOD' 'X'.
    MAC1 'MENGE_CON'    '6'  'CONSUMPTION FOR CUMULATIVE' 'X'.
    MAC1 'MENGE_RET1'   '7'  'RETURN FROM DEPT. FOR PERIOD' 'X'.
    MAC1 'MENGE_RET'    '8'  'RETURN FROM DEPT.CUMULATIVE' 'X'.
    MAC1 'MENGE_UNIT1'  '9'  'INTER UNIT FOR PERIOD' 'X'.
    MAC1 'MENGE_UNIT'   '10'  'INTER UNIT CUMULATIVE' 'X'.
    MAC1 'MENGE_SUB1'   '11' 'SUB CONTRACTOR FOR PERIOD' 'X'.
    MAC1 'MENGE_SUB'    '12' 'SUB CONTRACTOR CUMULATIVE' 'X'.
    MAC1 'MENGE_OTH1'   '13' 'OTHERS FOR PERIOD' 'X'.
    MAC1 'MENGE_OTH'    '14' 'OTHERS CUMULATIVE' 'X'.
    MAC1 'MENGE_t1'     '15' 'TOTAL FOR PERIOD' 'X'.
    MAC1 'MENGE_t'      '16' 'TOTAL CUMULATIVE' 'X'.
    SELECTION-SCREEN: BEGIN OF BLOCK B1 WITH FRAME TITLE text-001.
      PARAMETERS: p_werks LIKE t001w-werks DEFAULT '1023' OBLIGATORY.
      select-options: s_matkl     FOR mara-matkl,
                      s_mtart     FOR mara-mtart,
                      s_matnr     FOR mara-matnr,
                      s_budat     FOR mkpf-budat OBLIGATORY.
    PARAMETERS: year(4) DEFAULT '2007'.
      SELECTION-SCREEN:END OF BLOCK B1.
      START-OF-SELECTION.
      SELECT lk~mblnr
             lk~mjahr
             lk~budat
             lp~zeile
             lp~bwart
             lp~matnr
             lp~werks
             lp~menge
             ma~mtart
             ma~matkl
             INTO CORRESPONDING FIELDs OF TABLE i_mseg
             FROM MSEG AS lp INNER JOIN MKPF AS lk
             ON lkmblnr EQ lpmblnr
             AND lkmjahr EQ lkmjahr
             INNER JOIN mara AS ma
             ON mamatnr EQ lpmatnr
             WHERE lp~werks EQ p_werks
               AND lp~matnr IN s_matnr
               AND lk~budat LE s_budat-high.
          clear line_cnt.                         "Count line of i_table i_mseg
          DESCRIBE TABLE i_mseg LINES line_cnt.
          IF  line_cnt GT 0.                      "If i_mseg has records
              SELECT matnr                        "Collect material description
                     maktx
                     spras
                     INTO CORRESPONDING FIELDS OF TABLE i_makt
                     FROM makt
                     FOR ALL ENTRIES IN i_mseg
                     WHERE matnr EQ i_mseg-matnr
                       AND spras EQ 'E'.
                CLEAR line_cnt.
                DESCRIBE TABLE i_makt LINES line_cnt.
                IF line_cnt GT 0.
                   SORT i_makt BY MATNR ASCENDING.
                   DELETE ADJACENT DUPLICATES FROM i_makt COMPARING matnr.
                ENDIF.
              SELECT werks                        "Collect plant name
                     name1
                     INTO CORRESPONDING FIELDS OF TABLE i_t001w
                     FROM t001w
                     FOR ALL ENTRIES IN i_mseg
                     WHERE werks EQ i_mseg-werks.
                CLEAR line_cnt.
                DESCRIBE TABLE i_t001w LINES line_cnt.
                IF line_cnt GT 0.
                   SORT i_t001w BY werks ASCENDING.
                   DELETE ADJACENT DUPLICATES FROM i_t001w COMPARING werks.
                ENDIF.
               LOOP AT i_mseg INTO w_mseg.        "Move recored into data i_tab
                w_calc-matnr  = w_mseg-matnr.
                w_calc-mtart = w_mseg-mtart.
                w_calc-matkl = w_mseg-matkl.
                READ TABLE i_makt WITH KEY matnr = w_mseg-matnr INTO w_makt.
                 IF sy-subrc = 0.
                    w_calc-maktx = w_makt-maktx.
                 ENDIF.
                IF w_mseg-bwart EQ '261' .
                   w_calc-menge_con_261   = w_mseg-menge.
                   IF w_mseg-budat GE s_budat-low.
                      w_calc-menge_con1_261   = w_mseg-menge.
                   ENDIF.
                ENDIF.
                IF w_mseg-bwart EQ '262' .
                   w_calc-menge_con_262   = w_mseg-menge.
                   IF w_mseg-budat GE s_budat-low.
                      w_calc-menge_con1_262   = w_mseg-menge.
                   ENDIF.
                ENDIF.
                IF w_mseg-bwart EQ '291' OR w_mseg-bwart EQ '201'.
                   w_calc-menge_ret_291 = w_mseg-menge.
                   IF w_mseg-budat GE s_budat-low.
                      w_calc-menge_ret1_291   = w_mseg-menge.
                   ENDIF.
                ENDIF.
                IF w_mseg-bwart EQ '292' OR w_mseg-bwart EQ '202'.
                   w_calc-menge_ret_292   = w_mseg-menge.
                   IF w_mseg-budat GE s_budat-low.
                      w_calc-menge_ret1_292   = w_mseg-menge.
                   ENDIF.
                ENDIF.
                IF w_mseg-bwart EQ '301'.
                   w_calc-menge_unit_301   = w_mseg-menge.
                   IF w_mseg-budat GE s_budat-low.
                      w_calc-menge_unit1_301   = w_mseg-menge.
                   ENDIF.
                ENDIF.
                IF w_mseg-bwart EQ '302'.
                   w_calc-menge_unit_302   = w_mseg-menge.
                   IF w_mseg-budat GE s_budat-low.
                      w_calc-menge_unit1_302   = w_mseg-menge.
                   ENDIF.
                ENDIF.
                IF w_mseg-bwart EQ '543'.
                   w_calc-menge_sub   = w_mseg-menge.
                   IF w_mseg-budat GE s_budat-low.
                      w_calc-menge_sub1   = w_mseg-menge.
                   ENDIF.
                ENDIF.
                    COLLECT w_calc INTO i_calc.
               ENDLOOP.                           "ENDLOOP of Move recored into data i_tab
              LOOP AT i_calc INTO w_calc.
                w_data-matnr   = w_calc-matnr.
                w_data-mtart   = w_calc-mtart.
                w_data-matkl   = w_calc-matkl.
                w_data-maktx   = w_calc-maktx.
                v_temp = w_calc-menge_con_261 - w_calc-menge_con_262.
                w_data-menge_con    = v_temp.
                CLEAR v_temp.
                v_temp = w_calc-menge_con1_261 - w_calc-menge_con1_262.
                w_data-menge_con1   = v_temp.
                CLEAR v_temp.
                v_temp = w_calc-menge_ret_291 - w_calc-menge_ret_292.
                w_data-menge_ret    = v_temp.
                CLEAR v_temp.
                v_temp = w_calc-menge_ret1_291 - w_calc-menge_ret1_292.
                w_data-menge_ret1    = v_temp.
                CLEAR v_temp.
                v_temp = w_calc-menge_unit_301 - w_calc-menge_unit_302.
                w_data-menge_unit    = v_temp.
                CLEAR v_temp.
                v_temp = w_calc-menge_unit1_301 - w_calc-menge_unit1_302.
                w_data-menge_unit1   = v_temp.
                CLEAR v_temp.
                w_data-menge_sub    = w_calc-menge_sub.
                w_data-menge_sub1   = w_calc-menge_sub.
                v_temp = w_data-menge_con + w_data-menge_ret + w_data-menge_unit + w_data-menge_sub.
                w_data-menge_t      = v_temp.
                CLEAR v_temp.
                v_temp = w_data-menge_con1 + w_data-menge_ret1 + w_data-menge_unit1 + w_data-menge_sub1.
                w_data-menge_t1      = v_temp.
                CLEAR v_temp.
                APPEND w_data TO i_data.
              ENDLOOP.
          ENDIF.                                  "ENDIf i_mseg has records
    Display_ALV
    END-OF-SELECTION.
      DATA : DATE(85),
             DATE_LOW(10),
             DATE_HIGH(10),
             MSK TYPE STRING,
             DATE1(10),
             date2(10).
    WA_COMMENTRY-TYP = 'H'.
    WA_COMMENTRY-INFO = 'Material Consumption Report'.
    APPEND WA_COMMENTRY TO IT_COMMENTRY.
    CLEAR WA_COMMENTRY.
    CONCATENATE S_BUDAT-LOW6(2) '/' S_BUDAT-LOW4(2) '/' S_BUDAT-LOW+0(4) INTO DATE1.
    CONCATENATE S_BUDAT-high6(2) '/' S_BUDAT-high4(2) '/' S_BUDAT-high+0(4) INTO DATE2.
    CONCATENATE 'Material Consumption Report :' DATE1 'To' date2 INTO DATE SEPARATED BY SPACE.
    WA_COMMENTRY-TYP  = 'S'.
    WA_COMMENTRY-INFO = DATE.
    APPEND WA_COMMENTRY TO IT_COMMENTRY.
    CLEAR WA_COMMENTRY.
    *SORT I_DATA BY   MTART MATKL .
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
       I_CALLBACK_PROGRAM                = SY-REPID
       I_CALLBACK_TOP_OF_PAGE            = 'TOP_OF_PAGE'
       I_BACKGROUND_ID                   = 'ALV_BACKGROUNG'
      I_GRID_TITLE                      = 'STOCK LEDGER SUMMARY'
       IS_LAYOUT                         = IT_LAYOUT
       IT_FIELDCAT                       = IT_FIELD
      IT_SORT                           = IT_SORT
      I_SAVE                            = 'X'
       IT_EVENTS                         = IT_EVENT
      TABLES
        T_OUTTAB                          = I_DATA.
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    FORM TOP .
    CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
      EXPORTING
        IT_LIST_COMMENTARY       = IT_COMMENTRY
      I_LOGO                   = 'INOXLOGO'
      I_END_OF_LIST_GRID       =
      I_ALV_FORM.
    REFRESH IT_COMMENTRY.
    ENDFORM.                    " TOP-OF-PAGE

    It is giving me error on sort statement 
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
    I_CALLBACK_PROGRAM = SY-REPID
    I_CALLBACK_TOP_OF_PAGE = 'TOP_OF_PAGE'
    I_BACKGROUND_ID = 'ALV_BACKGROUNG'
    I_GRID_TITLE = 'STOCK LEDGER SUMMARY'
    IS_LAYOUT = IT_LAYOUT
    IT_FIELDCAT = IT_FIELD
    IT_SORT = IT_SORT  <<<<<<<<<<<<<<<<<<<<<<<<<<<
    I_SAVE = 'X'
    IT_EVENTS = IT_EVENT
    TABLES
    T_OUTTAB = I_DATA.
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.

Maybe you are looking for

  • How do I replace a color with another color?

    I'm not having any luck finding this.  Is there a simple way to replace a color (like a red shirt) with another color (green shirt)?  Somehow I'm not seeing this anywhere.  I know how to do it in Premiere Pro.

  • SAP implementation in food industry

    Hi all Does anybody has implementaion experience in food industry.. specially wafers industry..... Coz i wud like to know more abt excise..here for purchasing excise duty has to be paid to vendor ,and this excise duty is loaded on basic price during

  • Unix Command for tracing WebIntelligence Server

    Hi All, Please can any one tell me that what is the Unix command for tracing WebIntelligence Server. I know we use -trace parameter. But where do we use this parameter? With which script do we use it? Please give me complete command for the same. Tha

  • Small box for update Acrobat Adobe reader

    I keep receiving a small box on the lower right side of my computer stating that there is an update for the Acrobat Adobe Reader almost every day.  I  downloaded it on my HP Pavilion laptop and my laptop went haywire.  I had to do a system restore. 

  • How to let Premiere or Audition put Extracted audio clips into a desired folder when clicking "Edit clips in Audition"?

    I recently did Volume Match for entire feature film dialogue clips, what happened is I found lots of extracted audio clips scattered around in my Media hard disk, luckily I only have one Hard disk for all media, I look it in Preferences in both Premi