Urgent: regarding the increasing the performance of report

Hi,
I had a report which is displaying the correct data but i execute on PRD Server,it gets Request Time Out.So i want to increase the performance of it.Plzz help me out in doing this.
REPORT  ZWIP_STOCK NO STANDARD PAGE HEADING LINE-SIZE 150.
TABLES: AFPO, AFRU, MARA, MAKT.
DATA: BEGIN OF ITAB OCCURS 0,
      AUFNR LIKE AFPO-AUFNR,
      MATNR LIKE AFPO-MATNR,
      LGORT LIKE AFPO-LGORT,
      MEINS LIKE MARA-MEINS,
      NTGEW LIKE MARA-NTGEW,
      MTART LIKE MARA-MTART,
      STOCK TYPE P LENGTH 10 DECIMALS 3,
      END OF ITAB.
DATA : ITAB2 LIKE ITAB OCCURS 0 WITH HEADER LINE.
DATA : DESC LIKE MAKT-MAKTX.
SELECT-OPTIONS : MAT_TYPE FOR MARA-MTART.
SELECT-OPTIONS : P_MATNR FOR AFPO-MATNR.
DATA : V_MINOPR LIKE AFRU-VORNR,
       V_MAXOPR LIKE AFRU-VORNR,
       V_QTYMIN LIKE AFRU-GMNGA,
       V_QTYMAX LIKE AFRU-GMNGA,
       V_QTY TYPE P LENGTH 10 DECIMALS 3.
        SELECT AAUFNR AMATNR ALGORT BMEINS BNTGEW BMTART FROM AFPO AS A
          INNER JOIN MARA AS B ON AMATNR = BMATNR
            INTO TABLE ITAB WHERE ELIKZ <> 'X' AND MTART IN MAT_TYPE AND A~MATNR IN P_MATNR.
    ITAB2[] = ITAB[].
    SORT ITAB2 BY MATNR MEINS MTART NTGEW.
    DELETE ADJACENT DUPLICATES FROM ITAB2 COMPARING MATNR MEINS MTART NTGEW.
   LOOP AT ITAB2.
    V_QTY = 0.
      LOOP AT ITAB WHERE MATNR = ITAB2-MATNR.
        SELECT MIN( VORNR ) INTO V_MINOPR FROM AFRU WHERE AUFNR = ITAB-AUFNR.
        SELECT MAX( VORNR ) INTO V_MAXOPR FROM AFRU WHERE AUFNR = ITAB-AUFNR.
        SELECT SUM( GMNGA ) INTO V_QTYMIN FROM AFRU WHERE AUFNR = ITAB-AUFNR AND VORNR =  V_MINOPR.
        SELECT SUM( GMNGA ) INTO V_QTYMAX FROM AFRU WHERE AUFNR = ITAB-AUFNR AND VORNR =  V_MAXOPR.
        V_QTY = V_QTY + V_QTYMIN - V_QTYMAX.
      ENDLOOP.
      ITAB2-STOCK = V_QTY.
      MODIFY ITAB2.
    ENDLOOP.
    LOOP AT ITAB2.
          WRITE:/ ITAB2-MATNR,ITAB2-STOCK.
    ENDLOOP.

Instead of code from
itab2[] = itab[] till last endloop try code given below
data : begin of minopr occurs 0,
       aufnr type afru-aurnr,
       vornr type afru-vornr,
       end of minopr.
data : begin of maxopr occurs 0,
       aufnr type afru-aurnr,
       vornr type afru-vornr,
       end of maxopr.
data : begin of qtymin occurs 0,
       aufnr type afru-aurnr,
       vornr type afru-vornr,
       end of qtymin.
data : begin of qtymax occurs 0,
       aufnr type afru-aurnr,
       vornr type afru-vornr,
       end of qtymax.
select aurnr vornr into table minopr from afru for all entries in itab where aurnr = itab-aufnr
maxopr[] = minopr[].
sort minopr by aufnr vornr ascending.
sort maxopr by aufnr vornr descending.
delete adjacent duplicates from minopr comparing aufnr.
delete adjacent duplicates from maxopr comparing aufnr.
SELECT aufnr vornr GMNGA INTO TABLE QTYMIN FROM AFRU for all entries in minopr WHERE AUFNR = minopr-AUFNR AND VORNR = MINOPR-vornr.
SELECT aufnr vornr GMNGA INTO TABLE QTYMAX FROM AFRU for all entries in maxopr WHERE AUFNR = maxopr-AUFNR AND VORNR = maxopr-vornr.
sort qtymin by aufnr.
sort qtymax by aufnr
sort itab by matnr MEINS MTART NTGEW.
LOOP AT ITAB.
v_minopr = 0.
v_maxopr = 0.
read table qtymin with key aufnr = itab-aufnr binary search.
if sy-subrc = 0.
loop at qtymin from sy-tabix.
if qtymin-aufnr = itab-aufnr.
V_MINOPR = V_MINOPR + itab-gmnga.
else.
exit.
endif.
endloop.
endif.
read table qtymax with key aufnr = itab-aufnr binary search.
if sy-subrc = 0.
loop at qtymax from sy-tabix.
if qtymax-aufnr = itab-aufnr.
V_MaxOPR = V_MaxOPR + itab-gmnga.
else.
exit.
endif.
endloop.
endif.
V_QTY = V_QTY + V_QTYMIN - V_QTYMAX.
At new itab-matnr.
if sy-tabix = 1.
continue.
endif.
itab2 = itab.
itab2-stock = v_qty.
append itab2.
V_QTY = 0.
endat.
ENDLOOP.
itab2 = itab.
itab2-stock = v_qty.
append itab2.
LOOP AT ITAB2.
WRITE:/ ITAB2-MATNR,ITAB2-STOCK.
ENDLOOP.

Similar Messages

  • Regarding the performance in report

    Hi Abap Gurus,
                              i am working on the report. my requirement is that after executing the report data gets extracting after 11 hours.the required data is comonf perfectly.  how to improve the performance. any tips to follow the performance in the report.  if possible post the code.
    Moderator Message: Please search the forum for available information.
    Edited by: kishan P on Oct 19, 2010 4:50 PM

    Hi,
    Please check below thread;
    Extract from ALV List
    Regards
    Jana

  • Split of Cubes to improve the performance of reports

    Hello Friends . We are now Implementing the Finance GL Line Items for Global Automobile operations in BMW and services to Outsourced to Japan which increased the data volume to 300 millions records for last 2 years since we go live. we have 200 Company codes.
    How To Improve performance
    1. Please suggest if I want to split the cubes based on the year and Company codes which are region based. which means european's will run report out of one cube and same report for america will be on another cube
    But Question here is if I make 8 cube (2 For each year : 1- current year comp code ABC & 1 Current Year DEF), (2 For each year : 1- Prev year comp code ABC & 1 Prev Year DEF)
    (2 For each year : 1- Arch year comp code ABC & 1 Archieve Year DEF)
    1. Then what how I can I tell the query to look the data from which cube. since Company code is authorization variable so to pick that value  of comp code and make a customer exit variable for infoprovider  will increase lot of work.
    Is there any good way to do this. does split of cubes make sense based on company code or just make it on year.
    Please suggest me a excellent approach step by step to split cubes for 60 million records in 2 years growth will be same for
    next 4 years since more company codes are coming.
    2. Please suggest if split of cube will improve performance of report or it will make it worse since now query need to go thru 5-6 different cubes.
    Thanks
    Regards
    Soniya

    Hi Soniya,
    There are two ways in which you can split your cube....either based on Year or based on Company code.(i.e Region). While loading the data, write a code in the start routine which will filter tha data. For example, if you are loading data for three region say 1, 2, and 3, you code will be something like
    DELETE SOURCE_PACKAGE WHERE REGION EQ '2' OR
    REGION EQ '3'.
    This will load data to your cube correspoding to region 1.
    you can build your reports either on these cubes or you can have a multiprovider above these cubes and build the report.
    Thanks..
    Shambhu

  • Can the Performance Detail reports be exported as PDF without the Detail Table?

    We previously generated significant numbers of Performance Detail reports out of SCOM 2007 R2 as PDF files, and the 'Detail Table' did not show.
    Now that we are on SCOM 2012 R2, the same reports show the 'Detail Table' when exported to PDF. We report on 6 to 12 months of data, so these tables are huge, and are also useless for our purposes.
    Is there some way to suppress the Detail Table when exporting a Performance Detail report to PDF?

    Hello,
    Please see if the method in the following post can meet your requirements:
    SCOM reports on performance counters for large groups of servers
    http://www.bictt.com/blogs/bictt.php/2010/11/28/scom-reports-on-performance-counters-for-large-groups-of-servers

  • Regarding the performance comparision of application/web servers

    i want the details of performance comparision of application/web servers and which is the best, efficient and easy to use.

    Try google.
    However for the most part the performance is not related to the application/web server that you use.
    It more depends on
    - the machine you are running it on
    - what code you are running on it.
    With regards to "best", you can debate that forever.
    Tomcat is widely used, mainly because it is free. But it is solid.

  • Does the ETL workload effect the performance of reports?

    Hello
    There are several heavy ETL processes running on production. Do they effect the performance of the reports that user may execute during this time?
    thanks

    Definitely... Your server has a finite number of resources available to share with all those processes... Running a report is just one more process... Users can be (and are) impacted by other processes in the system...

  • Regarding the performance of the Transaction F.01 Program RFBILA00

    Hi Everyone,
    We are running the transaction F.01for financial statements. The program is RFBILA00. We are facing the performance issue with this program. The version is ECC 6.0
    Is there any solution to reduce the running time of this program. We are not using the business area.
    Thanks,
    Senthil

    1.Run time analysis transaction SE30
    This transaction gives all the analysis of an ABAP program with respect to the database and the non-database processing.
    2.SQL Trace transaction ST05
    The trace list has many lines that are not related to the SELECT statement in the ABAP program. This is because the execution of any ABAP program requires additional administrative SQL calls. To restrict the list output, use the filter introducing the trace list.
    The trace list contains different SQL statements simultaneously related to the one SELECT statement in the ABAP program. This is because the R/3 Database Interface - a sophisticated component of the R/3 Application Server - maps every Open SQL statement to one or a series of physical database calls and brings it to execution. This mapping, crucial to R/3s performance, depends on the particular call and database system. For example, the SELECT-ENDSELECT loop on the SPFLI table in our test program is mapped to a sequence PREPARE-OPEN-FETCH of physical calls in an Oracle environment.
    The WHERE clause in the trace list's SQL statement is different from the WHERE clause in the ABAP statement. This is because in an R/3 system, a client is a self-contained unit with separate master records and its own set of table data (in commercial, organizational, and technical terms). With ABAP, every Open SQL statement automatically executes within the correct client environment. For this reason, a condition with the actual client code is added to every WHERE clause if a client field is a component of the searched table.
    To see a statement's execution plan, just position the cursor on the PREPARE statement and choose Explain SQL. A detailed explanation of the execution plan depends on the database system in use.
    Or can use load balancing servers for user over load.

  • Regarding the simple ALV report

    Hi All,
    I created the simple code for disply of the alv report the code is provided below,but the output is showing only the column heading not the data in the grid, i won't came to know where the problem is please find the problem in the code.
    Regards
    Sai
    ********sample code**********
    type-pools : slis.
    data : b_display type slis_t_fieldcat_alv,
           w_display type slis_fieldcat_alv.
    data : begin of itab_display occurs 0,
            kunnr type kna1-kunnr,
            name1 type kna1-name1,
            end of itab_display.
    data : gd_repid like sy-repid.
          itab_display-name1 = 'ram'.
          itab_display-kunnr = '10000033242'.
          append itab_display.
          clear itab_display.
          itab_display-name1 = 'sai'.
          itab_display-kunnr = '10000033243'.
          append itab_display.
          clear itab_display.
       w_display-col_pos = 0.
       w_display-fieldname = 'name1'.
       w_display-seltext_m = 'name'.
       append w_display to b_display.
       clear w_display.
       w_display-col_pos = 1.
       w_display-fieldname = 'kunnr'.
       w_display-seltext_m = 'cus.no'.
       append w_display to b_display.
       clear w_display.
    gd_repid  = sy-repid.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
      I_CALLBACK_PROGRAM  = gd_repid
      IT_FIELDCAT       = b_display[]
      I_SAVE            = 'X'
      TABLES
        t_outtab       =  itab_display.

    Hi,
    Please use the following code.
    type-pools : slis.
    data : b_display type slis_t_fieldcat_alv,
    w_display type slis_fieldcat_alv.
    data : begin of itab_display occurs 0,
    kunnr type kna1-kunnr,
    name1 type kna1-name1,
    end of itab_display.
    data : gd_repid like sy-repid.
    itab_display-name1 = 'ram'.
    itab_display-kunnr = '10000033242'.
    append itab_display.
    clear itab_display.
    itab_display-name1 = 'sai'.
    itab_display-kunnr = '10000033243'.
    append itab_display.
    clear itab_display.
    w_display-col_pos = 0.
    w_display-fieldname = 'NAME1'.
    w_display-tabname = ITAB_DISPLAY.
    w_display-seltext_m = 'Name'.
    w_display-ddictxt   = 'M'.
    append w_display to B_DISPLAY.
    w_display-col_pos = 1.
    w_display-fieldname = 'KUNNR'.
    w_display-tabname = ITAB_DISPLAY.
    w_display-seltext_m = 'cus.no'.
    w_display-ddictxt   = 'M'.
    append w_display to B_DISPLAY.
    gd_repid = sy-repid.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
    I_CALLBACK_PROGRAM = gd_repid
    IT_FIELDCAT = b_display[]
    I_SAVE = 'X'
    TABLES
    t_outtab = itab_display[].
    Regards,
    Sankar.

  • Urgent:Regarding the Pre-Installation Tasks

    Hi,
    I have a scenario:
    Currently, i have installed Oracle AS Infrastructure(D'base 10.1.0.5.0) as a pre-requisite for installing oracle Content DB.
    My Question is : Is that mandatory that i have to again install oracle 10g database as pre-requisite before installing oracle content DB.
    Please help me.
    Regards,
    - Sri

    As long as you can perform all the pre-install steps using SQL*Plus (as the SYS user), and you can bring up and shut down the database, I think you will be fine. iFS manages it's own schema (default name: IFSSYS) and doesn't require SYSDBA or SYS access. The only time the SYS user is required is during installation and configuration. If your configuration is successful, you should be fine, as far as iFS is concerned.

  • Regarding the Crystal Xcelsius Report

    Hello Experts,
    I am new to buisness Intelligence ...
    I have task to create Celsiuse reports for SCM EWM.
    I have the following doubt.....
    so can you please let me know the procedure how to start?
    Whether i have to extract data using extractor? if i extract data using extractor whenther it is available in
    Xcelsius report?
    Please provide me Crystal Xcelsius document for developing report.
    Thanks and regards,
    zubera

    Hello,
    Thanks for your help.
    Please give the link for business object site.
    Thanks and regards,
    zubera

  • How to maximize the performance of report service 9i?

    I have a report running in Oracle 9iAS report service. The report is invoked from forms by PL/SQL function run_report_object and generated into PDF file. The report is so complex that the RDF file size reaches to 6MB.
    Now it takes about 30 seconds to run the report. My form service and report service are installed on same machine which has 2 intel XEON 2G CPU and 4G memory. If i run the report twice at same time, the report jobs are put into a queue and runs one by one, so it take me 60 seconds. I find the CPU loading is about 20% during the report is running, it means the report service did not make the base of CPU.
    How can report service process multi jobs at same on a multi CPU machine? What is the best config in report service about engine number?

    Hi,
    Whenever you start a new Reports Server in 9iAS, by default it starts 1 Reports Engine (rwEng). You can increase the number of engines to 2 for processing the 2 jobs simultaneously. you can do this by using the Oracle Enterprise Manager (via the browser). You can also change the following parameters in the server config file directly
    file name: OH/reports/conf/<your_reports_server_name>.conf
    <engine id="rwEng" ... initEngine="1" maxEngine="1" minEngine="0" ... >
    You can either increase both initEngine and maxEngine to 2, only maxEngine. In the latter case, the second reports engine will be started only when needed.
    However, increasing the number of engines will obviously increase the overhead. The optimum value for number of engines depends on your machine, load, response characteristics required, etc. You can test with a few values to arrive at an optimum number.
    I would recommend going through the Oracle Reports Tuning whitepaper
    http://otn.oracle.com/products/reports/htdocs/getstart/whitepapers/cb_tuning8.pdf
    Navneet.

  • Regarding the performance

    I had an application which consists of many forms and each form will have different form objects.. the values already there in the database for these form objects should be displayed to the user in a popup so that he can select the existing ones. There can be be 10 form objects for which the data should be displayed to the user, and for each form object there can be records in thousands.
    For this i have approached the following way:
    So as soon as the user clicks on the form, Based on the form objects fr which the data has to be displayed.. I am retrieving the first 1000 records ( if the records are more than 1000) for each form object and storing in the session and when user browses through all these records and clicks on the next then the next 1000 records i am fetching from the database and replacing the session with the new records. that is at any point of time there will be only 1000 records for the form object and like that there are 10 form objects.
    I am retrieving these records using the cursors within the cursor and sending to the java client. at the client end i am splitting these curosors into result sets.
    Right now i am success fully doing with above procedure..but my question is the procedure i am following is an ideal one or not. Is there any better way to do the above task. Suggestions are appreciated.
    Thanks for your time
    bye
    s

    This sounds like a similar situation described in Re: Getting the records from database in order which was posted last week. Perhaps if you read th eadvic ethere it might help.
    Incidentally, why do you think you may have a problem? If the thing is working then I suggest you leave it alone, until a user complains about performance (or it fails some predefined acceptance criterion). I know refactoring is a very popular concept but it is not always appropriate.
    Cheers, APC

  • Urgent regarding the Weblogic Application server

    Hi,
    In my previous applications I have used weblogic5.1.0 as our
    Application server. Now we know that Weblogic 6.1 is the latest version
    to implement
    J2EE technologies. I want to know any problems are there in using
    Weblogic 5.1.0 to implement J2EE technologies.
    Please let me know any problems are there in using weblogic5.1.0
    for J2EE technologies.
    Thanks and Regards,
    Seshu Srinivas

    For a new project, you should shoot for 6.1sp2 ...
    Peace,
    Cameron Purdy
    Tangosol, Inc.
    Clustering Weblogic? You're either using Coherence, or you should be!
    Download a Tangosol Coherence eval today at http://www.tangosol.com/
    "seshusrinivas" <[email protected]> wrote in message
    news:[email protected]..
    Hi,
    Actually we want to start new project using j2ee technologies.Thing
    is we are having some experience in weblogic5.1.0, then going for weblogic6.1
    any advantages are there.
    Thanks and Regards,
    Bye
    Seshu Srinivas
    Cameron Purdy wrote:
    Please let me know any problems are there in using
    weblogic5.1.0
    for J2EE technologies.Basically, none. Except it's a bit out of date.
    Is that what you were asking?
    Peace,
    Cameron Purdy
    Tangosol, Inc.
    Clustering Weblogic? You're either using Coherence, or you should be!
    Download a Tangosol Coherence eval today at http://www.tangosol.com/
    "seshusrinivas" <[email protected]> wrote in message
    news:[email protected]..

  • Urgent Regarding the SAP Script

    Hi all,
    I am developing a SAP-Script in which there is table like
    Description Resuts Parameters
    uline
    values values values
    My doubt is using the driver program the values has to be printed. Can anybody provide the piece of code for these requirement.
    Another doubt is in this script there 2 pages . But in the print preview i can see only 1 page . In the page setting i have given the next page as page2 . But still i m facing the same problem. In page there is no main page only footer, page no, and some std descptn window is available.
    Depending on the 1 field i want to print the send field value i have change these things in the driver program so that the correct can be printed in the form.
    With Regards,
    Srinivas.

    hi,
    How to Upload graphics (IMAGE) to your Sapscript?
    Command in your Sapscript
    /: INCLUDE Z_YOUR_LOGO OBJECT TEXT ID ST LANGUAGE E
    These are the steps to be followed for uploading graphics in R/3 system
    1. First save the file as BMP
    2. Open the BMP file in IMaging (Goto -> Programs -> Accessories -> Imaging) and
    make it Zoom as 100% and save as *.TIFF
    3. Open SE38 and execute program RSTXLDMC
    4. Give your TIFF file path name
    5. Select Bcol (for Color)
    6. TEXT ID will be ZHEX-MACRO-*.
    7. Inplace of * write your own logo name (ZCOMPANYLOGO)
    8. Execute the program
    9. Now Goto SE71 create your ZFORM
    10. Create logo window
    11. Goto text element of logo window
    or
    In 4.6x :-
    1. Goto SE71 Change the mode to GRAPHICAL
    2. Choose the Graph Tabstrips
    3. Now type in some name for the LOGO WINDOW
    4. Press the IMPORT BUTTON (third button from left) and then IMPORT the BMP file from your DESKTOP
    5. The code will be written automatically. You just need to drag and drop wherever you want
    the graphics to be.
    /: INCLUDE Z_COMPANY_LOGO OBJECT GRAPHICS ID BMON LANGUAGE EN
    Message Edited By ,
    Vani

  • Urgent: regarding sub total button in alv report

    hi,
    i had made dis report and it is is fine till now,but now i want add the sub total field in it ,by making double click on the field sub-total should be displayed in it.
    here is d code as i had tried the sub - total but when i execute it is giving some diferrent result.
    *& Report  ZTET2
    REPORT  ZTET2.
    TABLES: ISEG,MARA.
    TYPE-POOLS : SLIS.
    DATA : DATE1(15) TYPE C,
    DATE2(15) TYPE C,
    TITLE(65) TYPE C,
    DT(25) TYPE C.
    DATA : ITEVENT TYPE SLIS_T_EVENT.
    DATA: lv_sort TYPE slis_sortinfo_alv,
          t_sort type slis_t_sortinfo_alv.
    DATA : repid LIKE sy-repid.
    INTERNAL TABLE FOR INVENTORY STOCK *****************
    DATA: BEGIN OF ITS1 OCCURS 0,
          MATNR LIKE ISEG-MATNR,
          ITEMID(6) TYPE C,
          MEINS LIKE ISEG-MEINS,
          MENGE LIKE ISEG-MENGE,
          WRTZL LIKE ISEG-WRTZL,
          BUCHM LIKE ISEG-BUCHM,
          WRTBM LIKE ISEG-WRTBM,
          WERKS LIKE ISEG-WERKS,
          BUDAT LIKE ISEG-BUDAT,
          ZLDAT LIKE ISEG-ZLDAT,
          MTART LIKE MARA-MTART,
          ITEMDESC LIKE MAKT-MAKTX,
          DIFFQTY LIKE ISEG-BUCHM,
          DIFFVALUE LIKE ISEG-WRTBM,
          GRUND LIKE ISEG-GRUND,
          GRTXT LIKE T157E-GRTXT,
          BWART LIKE T157E-BWART,
          REAS TYPE C LENGTH 15,
          END OF ITS1.
    data: t_heading type slis_t_listheader.
    SELECTION-SCREEN BEGIN OF BLOCK PAR1 WITH FRAME TITLE TEXT-001.
    *SELECTION-SCREEN : BEGIN OF BLOCK blk1 WITH FRAME TITLE text-001.
    *********PARAMETERS*********
    PARAMETERS : PLANT LIKE ISEG-WERKS OBLIGATORY.
    *********SELECTION SCREEN OPTIONS*********
    SELECT-OPTIONS : R_DATE FOR ISEG-BUDAT OBLIGATORY NO-EXTENSION,
                     M_TYPE  FOR MARA-MTART,
                     IT_M FOR MARA-MATNR.
    *********DEFINING VARIABLES*********
    SELECTION-SCREEN END OF BLOCK par1.
    CONCATENATE R_DATE-LOW6(2) '.' R_DATE-LOW4(2) '.' R_DATE-LOW+0(4) INTO DATE1.
    CONCATENATE R_DATE-HIGH6(2) '.' R_DATE-HIGH4(2) '.' R_DATE-HIGH+0(4) INTO DATE2.
    TOP-OF-PAGE.
      PERFORM PG_HEADER.
       START-OF-SELECTION.
      SELECT AMATNR AMEINS AMENGE AWRTZL ABUCHM AWRTBM AWERKS ABUDAT AZLDAT BMTART AGRUND CBWART
       FROM ISEG AS A INNER JOIN MARA AS B ON BMATNR = AMATNR
       INNER JOIN MSEG AS C ON AMBLNR = CMBLNR
       INTO CORRESPONDING FIELDS OF TABLE ITS1 WHERE BMATNR = AMATNR  AND BMEINS = AMEINS AND AWERKS = PLANT AND ABUDAT IN R_DATE AND BMTART IN M_TYPE AND BMATNR IN IT_M.
    LOOP AT ITS1.
         ITS1-ITEMID = ITS1-MATNR+12(6).
         ITS1-DIFFQTY = ITS1-MENGE - ITS1-BUCHM.
         ITS1-DIFFVALUE = ITS1-WRTZL - ITS1-WRTBM.
         SELECT SINGLE MAKTX FROM MAKT INTO ITS1-ITEMDESC WHERE MATNR = ITS1-MATNR.
         SELECT SINGLE GRTXT INTO ITS1-GRTXT FROM T157E WHERE GRUND = ITS1-GRUND AND SPRAS = 'E' AND BWART = ITS1-BWART.
         MODIFY ITS1.
    ENDLOOP.
    PERFORM PRN_SMSTOCK_ALV.
    WRITING DATA FROM D TABLES**********
    FORM PG_HEADER.
    WRITE : 'PHYSICAL INVENTORY AUDIT REPORT             PLANT : ', PLANT.
    ENDFORM.
    *&      Form  PRN_SMSTOCK_ALV
          text
    -->  p1        text
    <--  p2        text
    form PRN_SMSTOCK_ALV .
    data: w_title   type lvc_title,
          w_repid   type syrepid,
          w_comm    type slis_formname,
          w_status  type slis_formname,
          x_layout  type slis_layout_alv,
          t_event   type slis_t_event,
          t_fieldcat type slis_t_fieldcat_alv,
          t_subtot TYPE slis_t_sortinfo_alv,
          subtot LIKE LINE OF t_subtot.
    refresh t_fieldcat.
    refresh t_event.
    refresh t_sort.
    clear x_layout.
    clear w_title.
      perform set_fieldcat2 using:
    1  'MTART'     'MTART'     'MARA'  '15'  space 'MATERIAL TYPE'        space  space  space space space space space space SPACE t_fieldcat 'L' 'L',
    2  'ITEMID'    'ITEMID'    'MARA'  '7'   space 'ITEM ID'              space  space  space space space space space space SPACE t_fieldcat 'R' 'C',
    3  'ITEMDESC'  'MAKTX'     'MAKT'  '25'  space 'MATERIAL DESCRIPTION' space  space  space space space space space space SPACE t_fieldcat 'L' 'C',
    4  'MEINS'     'MEINS'     'MARA'  '5'   space 'UOM'                  space  space  space space space space space space SPACE t_fieldcat 'C' 'C',
    5  'MENGE'     'MENGE'     'ISEG'  '13'  space 'ORG.INV.QTY'          space  space  space space space space space space SPACE t_fieldcat 'R' 'C',
    6  'WRTZL'     'WRTZL'     'ISEG'  '13'  space 'ORG.INV.VALUE'        space  space  space space space space space space SPACE t_fieldcat 'R' 'C',
    7  'BUCHM'     'BUCHM'     'ISEG'  '13'  space 'PHY.INV.QTY'          space  space  space space space space space space SPACE t_fieldcat 'R' 'C',
    8  'WRTBM'     'WRTBM'     'ISEG'  '13'  space 'PHY.INV.VALUE'        space  space  space space space space space space SPACE t_fieldcat 'R' 'C',
    9  'DIFFQTY'   'MENGE'     'ISEG'  '13'  space 'DIFF.INV.QTY'         space  space  space space space space space space SPACE t_fieldcat 'R' 'C',
    10 'DIFFVALUE' 'WRTZL'     'ISEG'  '13'  space 'DIFF.INV.VALUE'       space  space  space space space space space space SPACE t_fieldcat SPACE 'P',
    11 'BUDAT'     'BUDAT'     'ISEG'  '18'  space 'CORRECTED DATE'       space  space  space space space space space space SPACE t_fieldcat  'C' 'C',
    12 'GRTXT'     'GRTXT'     'ISEG'  '18'  space 'REASON'               space  space  space space space space space space SPACE t_fieldcat  'L' 'L',
    13 'REAS'      'REAS'      'ISEG'  '18'  space 'AUTH.BY'              space  space  space space space space space space SPACE t_fieldcat  'C' 'C'.
    x_layout-zebra = 'X'.
    perform set_top_page_heading using t_heading t_event.
    perform set_events using t_event.
    perform get_subtotals.
      w_status = ''.
      w_repid = sy-repid.
    w_comm   = 'USER_COMMAND'.
      call function 'REUSE_ALV_GRID_DISPLAY'
        exporting
          i_callback_program       = w_repid
          it_fieldcat              = t_fieldcat
          i_Callback_top_of_page   = 'Top-of-page'
          is_layout                = x_layout
          it_sort                  = t_sort
          i_callback_pf_status_set = w_status
          i_callback_user_command  = w_comm
          i_save                   = 'X'
          it_events                = t_event
          i_grid_title             = w_title
          tables
          t_outtab                 = ITS1
          exceptions
          program_error            = 1
          others                   = 2.
    if sy-subrc <> 0.
        message id sy-msgid type sy-msgty number sy-msgno
                with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      endif.
    ENDFORM.
    FORM set_fieldcat2 USING
          p_colpos p_fieldname p_ref_fieldname p_ref_tabname
          p_outputlen p_noout
          p_seltext_m p_seltext_l p_seltext_s p_reptext_ddic p_ddictxt
          p_hotspot p_showasicon p_checkbox p_edit
          p_dosum
        p_subtot
          t_fieldcat TYPE slis_t_fieldcat_alv
          P_JUST
          P_FTYPE.
      DATA: wa_fieldcat TYPE slis_fieldcat_alv.
      CLEAR wa_fieldcat.
    General settings
      wa_fieldcat-fieldname = p_fieldname.
      wa_fieldcat-col_pos = p_colpos.
      wa_fieldcat-no_out = p_noout.
      wa_fieldcat-hotspot = p_hotspot.
      wa_fieldcat-checkbox = p_checkbox.
      wa_fieldcat-icon = p_showasicon.
      wa_fieldcat-do_sum = p_dosum.
    wa_fieldcat-t_subtot = p_subtot.
    Set output length.
      IF NOT p_outputlen IS INITIAL.
        wa_fieldcat-outputlen = p_outputlen.
      ENDIF.
    Set text headers.
    IF NOT p_seltext_m IS INITIAL.
        wa_fieldcat-seltext_m = p_seltext_m.
    ENDIF.
    IF NOT p_seltext_l IS INITIAL.
        wa_fieldcat-seltext_l = p_seltext_l.
    ENDIF.
    IF NOT p_seltext_s IS INITIAL.
        wa_fieldcat-seltext_s = p_seltext_s.
    ENDIF.
      IF NOT p_reptext_ddic IS INITIAL.
        wa_fieldcat-reptext_ddic = p_reptext_ddic.
      ENDIF.
    IF NOT p_ddictxt IS INITIAL.
        wa_fieldcat-ddictxt = p_ddictxt.
    ENDIF.
      IF NOT P_JUST IS INITIAL.
        WA_FIELDCAT-JUST = P_JUST.
      ENDIF.
      IF NOT p_edit IS INITIAL.
        wa_fieldcat-Input     = 'X'.
        wa_fieldcat-edit     = 'X'.
        wa_fieldcat-do_sum = 'x'.
       wa_fieldcat-p_subtot = 'x'.
      ENDIF.
    APPEND wa_fieldcat TO t_fieldcat.
    ENDFORM.                   "set_fieldcat2
    ======================== Subroutines called by ALV ================
    *&      Form  top_of_page
          Called on top_of_page ALV event.
          Prints the heading.
    form top_of_page.
      call function 'REUSE_ALV_COMMENTARY_WRITE'
         exporting
              it_list_commentary = t_heading.
    ENDFORM.
    form set_top_page_heading using t_heading type slis_t_listheader
                                    t_events  type slis_t_event.
    data: x_heading type slis_listheader,
          x_event   type line of slis_t_event.
    Report title
      clear t_heading[].
      clear x_heading.
      x_heading-typ = 'H'.
      x_heading-info = 'PHYSICAL INVENTORY AUDIT REPORT'.
      append x_heading to t_heading.
    Plant Name
    clear x_heading.
      x_heading-typ = 'S'.
      x_heading-key = 'PLANT        : '.
      x_heading-info = PLANT.
      append x_heading to t_heading.
    IF DATE2 = '00.00.0000'.
      CONCATENATE DATE1 'to' DATE1 INTO DT SEPARATED BY SPACE.
    ELSE.
      CONCATENATE DATE1 'to' DATE2 INTO DT SEPARATED BY SPACE.
    ENDIF.
    X_heading-TYP = 'S'.
    X_heading-key = 'PERIOD         :'.
    X_heading-INFO = DT.
    APPEND x_heading TO t_heading.
    Control Date
      clear x_heading.
      x_heading-typ = 'S'.
      x_heading-key = 'CONTROL NO. :'.
      x_heading-info = ' ASDFADDFAAS  DATE : 11.04.2007'.
      append x_heading to t_heading.
    Control date
    clear x_heading.
    x_heading-typ = 'S'.
    x_heading-key = 'CONTROL DATE : '.
    x_heading-info = ''.
    append x_heading to t_heading.
    Time of execution
    clear x_heading.
    x_heading-typ = 'S'.
    x_heading-key = 'DATE : '.
    write sy-DATUM to x_heading-info.
    append x_heading to t_heading.
    Top of page event
      x_event-name = slis_ev_top_of_page.
      x_event-form = 'TOP_OF_PAGE'.
      append x_event to t_events.
    endform.
    FORM get_subtotals.
    CLEAR lv_sort.
    lv_sort-fieldname = 'MENGE'.
    lv_sort-up = 'X'.
    lv_sort-subtot = 'X'.
    APPEND lv_sort TO t_sort.
    clear lv_sort.
    *lv_sort-fieldname = 'MENGE'.
    *lv_sort-tabname = 'ITS1'.
    *lv_sort-subtot = 'X'.
    *APPEND lv_sort TO t_sort.
    lv_sort-fieldname = 'WRTZL'.
    lv_sort-tabname = 'ITS1'.
    lv_sort-subtot = 'X'.
    APPEND lv_sort TO t_sort.
    clear lv_sort.
    lv_sort-fieldname = 'BUCHM'.
    lv_sort-tabname = 'ITS1'.
    lv_sort-subtot = 'X'.
    APPEND lv_sort TO t_sort.
    clear lv_sort.
    lv_sort-fieldname = 'WRTBM'.
    lv_sort-tabname = 'ITS1'.
    lv_sort-subtot = 'X'.
    APPEND lv_sort TO t_sort.
    clear lv_sort.
    lv_sort-fieldname = 'DIFFQTY'.
    lv_sort-tabname = 'ITS1'.
    lv_sort-subtot = 'X'.
    APPEND lv_sort TO t_sort.
    clear lv_sort.
    lv_sort-fieldname = 'DIFFVALUE'.
    lv_sort-tabname = 'ITS1'.
    lv_sort-subtot = 'X'.
    APPEND lv_sort TO t_sort.
    clear lv_sort.
    ENDFORM.
    form set_events using t_events type slis_t_event.
    data: x_event   type line of slis_t_event.
    endform.
    PLZ HELP ME and definately get rewarded.

    hi,
    how did u declared ur internal table?
    Declare a dummy field in your internal table to trigger subtotal text event.
    TYPES: BEGIN OF ty_ekpo,
              lifnr TYPE ekko-lifnr,    "vendor number
              ebeln TYPE ekko-ebeln,    "purchase document number
              ebelp TYPE ekpo-ebelp,    "Item Number of Purchasing Document
              matnr TYPE ekpo-matnr,    "Material Number
              bukrs TYPE ekpo-bukrs,    "Company Code
              werks TYPE ekpo-werks,    "Plant
              d,                        "Dummy field to fire the Subtotal text event
          END OF ty_ekpo.
    Prepare field catalog for that dummyfield also and set attributes like below
    wa_fcat-col_pos = 7.
      wa_fcat-fieldname = 'D'.
      wa_fcat-tabname = 'IT_EKPO'.
      wa_fcat-ref_fieldname = 'NETPR'.
      wa_fcat-ref_tabname = 'EKPO'.
      wa_fcat-no_out = 'X'.
      APPEND wa_fcat TO it_fcat.
    Fill sortinfo table as follows
    wa_sort-spos = 1.
      wa_sort-fieldname = 'LIFNR'.
      wa_sort-tabname = 'IT_EKPO'.
      wa_sort-up = 'X'.
      wa_sort-group = 'UL'.
      APPEND wa_sort TO it_sort.
      CLEAR wa_sort.
      wa_sort-spos = 2.
      wa_sort-fieldname = 'D'.
      wa_sort-tabname = 'IT_EKPO'.
      wa_sort-up = 'X'.
      wa_sort-group = 'UL'.
      wa_sort-subtot = 'X'.
      APPEND wa_sort TO it_sort.
    fill the event table
    wa_event-name = 'SUBTOTAL_TEXT'.  "--> this event is used to trigger subtotal text
      wa_event-form = 'SUBTOTAL'.
      APPEND wa_event TO it_event.
    *&      Form  subtotal
    FORM subtotal USING i_listhead STRUCTURE wa_ekpo  i_subtotal TYPE slis_subtot_text.
      READ TABLE it_sort INTO wa_sort WITH KEY fieldname = 'D'.
      IF sy-subrc = 0.
        IF i_subtotal-criteria = 'D'.
          i_subtotal-display_text_for_subtotal = 'Sub total'.
        ENDIF.
      ENDIF.
    ENDFORM.                    "subtotal
    Thanks & REgards

Maybe you are looking for

  • Why can I change the callout text font in some documents and not others?

    By experimenting I have determined that some documents that will allow me to add callouts also let me change the text font to a different font or font size.  Other documents that will let me add callouts will not allow me to change the text font. A s

  • Import contacts to address book

    Does importing new contacts via a csv file overwrite or delete existing contacts in Address Book?

  • Todate performance issue

    Hi I am working on improving performance of reports using todate (more specific year to date calculations) in 11.1.1.5. A simple query containing a ytd calculation takes 11 - 13 seconds (oracle 11.2; fact table 2.7 mio rows, calender dimension: 50 ye

  • IPhoto - importing photos message

    Whenever i get onto iPhoto,  a message comes up like this I always click yes but then i comes up again. What do I do?

  • Limitation in LR2 cropping

    Some of my commercial work is for realtors. For listing photos of homes in the MLS listing service, they require all photos to be in landscape orientation and typically at a 3:4 aspect ratio. I shoot both portrait and landscape for the client to use