Grand Total % Variance

Hi,
I have a Report for GL Reconciliation and it shows Source System Balances and GL Balances along with the Variance in these two and % Variance.
Sample data is as follows:
Year     Month     SYS     Source System Bal GL Balances     Variance     % Variance
2010     MAY     A     66,100,676,002     60,994,246,811     -5106429191     -8.37%
2010     MAY     B     29,081,192,665     29,066,650,415     -14542249.78     -0.05%
2010     MAY     C     218,856,115     212,416,688     -6439426.71     -3.03%
2010     MAY     D     14,601,939               -100.00%
2010     MAY     E     808,716,681     822,453,990     13737309.05     1.67%
2010     MAY     F     5,874,200,259     6,856,456,401     982256141.3     14.33%
2010     MAY     G     2,181,160,124     2,164,379,222     -16780901.26     -0.78%
2010     MAY     H     10,505,609,797     23,529,905,894     13024296097     55.35%
2010     MAY     I     1,566,030,457     1,565,502,039     -528418.48     -0.03%
2010     MAY     J     1,479,284,089          100.00%
2010     MAY     K     10,939,680,559     7,481,930,011     -3457750548     -46.21%
2010     MAY     L     8,774,737,817     8,831,160,339     56422521.84     0.64%
2010     MAY     M     1,117,717,954     548,331,847     -569386106.3     -103.84%
2010     MAY     N     73,670,961     55,680,430     -17990531.39     -32.31%
2010     MAY     O     4,583,263,229     4,562,122,752     -21140477.19     -0.46%
2010     MAY     P     204,382,965     206,288,734     1905768.97     0.92%
2010     MAY NULL          332,763,879          100.00%
     MAYTotal          142,044,497,524     148,709,573,543     6665076018     4.48%
Now This is how the Report will work as Normal...
What the user wants is Instead of Variance he wants to see the Absolute variance. So If I run absolute function on This Column, I will get following results:
ABS(Variance)
5,106,429,191
14,542,250
6,439,427
13,737,309
982,256,141
16,780,901
13,024,296,097
528,418
3,457,750,548
56,422,522
569,386,106
17,990,531
21,140,477
1,905,769
6665076018 --- -This Total is Incorrect as it is showing only the Absolute value to the Total, where as it should be More than this and to achieve this, I changed the Aggreegation Rule to SUM
to Get the correct sum of the figures mentioned ablove which will show following output:
ABS(Variance)
5,106,429,191
14,542,250
6,439,427
13,737,309
982,256,141
16,780,901
13,024,296,097
528,418
3,457,750,548
56,422,522
569,386,106
17,990,531
21,140,477
1,905,769
23,289,605,688
Now Till this point everything is correct and can be achieved. The problem is with the % Variance:
Bydefault % Variance ( Calculated using Variance/GL Balances )*100 Is as follows:
% Variance
-8.37%
-0.05%
-3.03%
-100.00%
1.67%
14.33%
-0.78%
55.35%
-0.03%
100.00%
-46.21%
0.64%
-103.84%
-32.31%
-0.46%
0.92%
100.00%
4.48%
But the Users wants that The % variance be calculated on Variance Column and GL Balances Column ( Variance/ GL Balances)*100
But the Grand Total values at the bottom should be based on ( Grand Total of ABS(Variance)/ Grand Total of GL Balances ) *100
to get the Desired results as :
% Variance
-8.37%
-0.05%
-3.03%
-100.00%
1.67%
14.33%
-0.78%
55.35%
-0.03%
100.00%
-46.21%
0.64%
-103.84%
-32.31%
-0.46%
0.92%
100.00%
15.66%
(23,289,605,688/1,48,709,573,543)*100
If someone can help me with this...
Edited by: help-required on Oct 1, 2010 1:14 AM

OK, there are a couple of things that have to be pointed out before getting to the actual problem. First of all, the column you named "Variance" is not a variance, but a "difference" and should be labeled as such. Second, what is the variance you are trying to calculate?
If the variance is from the "Source System Bal," then the calculation is ("GL Balances" - "Source System Bal")/"Source System Bal"
If the variance is from the "GL Balances," then the calculation is ("Source System Bal" - GL Balances")/"GL Balances"
You have ("GL Balances" - "Source System Bal")/"GL Balances" so do you know what you are measuring? Make sure you get this part right first. Now on to the issue itself.
This is the point of confusion with some I think: you want the individual rows of the "% Variance" column to display the +actual+ variance, positive or negative, but in just the total at the bottom, you want the "% Variance" to reflect the "absolute values of the differences, summed, and then divided by the GL Balances."
You can't have two different calculations on the same column like that, one for the rows and a completely different one for the total.
Here's a workaround. Uncheck the "totals" for the pivot table completely and just show the rows. (Make sure you change the name of the "Variance" column to "Difference" or something similar.)
Now create another pivot table view, but take out all the attributes so the measures sum up. Add an additional column called "ABS % Variance" and make this calculated column (do this in Criteria in the fx of a "dummy column"):
(ABS("GL Balances" - "Source System Balances")/"Source System Bal")*100.00
Don't forget to change the data format to "percentage."
Now place this pivot table view directly below the one with the individual rows. You should now have what you are looking for.
Edited by: David_T on Sep 30, 2010 10:58 AM

Similar Messages

  • Grand total on table with variance

    !http://img17.imageshack.us/img17/4070/resulta.jpg!
    hi, I set the column formula of variance to be: ("Current Value" - "Last Value) / "Last Value" * 100
    when I enabled the "grand total" of the table, it gives the grand total of variance = 0%.
    but actually it should be 3.3%
    how to achieve my goal.
    thank you very much!

    ("Current Value" - "Last Value) / "Last Value" * 100.00
    Change "100" to "100.00"

  • How to show grand total at bottom in Pivot view?

    Hi All,
    How to show the report Grand total at bottom in pivot table?Plz help.
    Regards,
    Vaishnavi

    Hi ,
    Thanks for the reply but My report structure is like below:
    AAA,BBB,CCC,DDD,EEE,FFF,GGG,HHH & III my report columns.I have arranged those columns in measure & i have to calculate the variance against each column like below structure.As per the report here I have lto calculate variance for 4 columns like AAA,BBB,CCC,DDD & after that total of each..then again variance for EEE,FFF & their total.After that i have to show grand total of all from AAAA to FFF likewise for rest of fields.
    Measures           variance
    AAA(db column)          1
    BBB(db column)          2
    CCC(db column)     3      
    DDD(db column
    Total     6
    EEE(db column)     4      
    FFF(db column) 5
    Total     9
    Grand Total(AAA TO FFF)     15
    GGG(db column)     6     
    Total     6
    Grand Total(AAA TO GGG) 21
    III(db column)          
    Grand Total(AAA TO III)     
    How to do that?
    Regards,
    Sonal
    Edited by: Sonal on Jan 11, 2012 9:06 AM
    Edited by: Sonal on Jan 11, 2012 9:15 AM
    Edited by: Sonal on Jan 11, 2012 9:17 AM

  • Grands totals for % Columns coming incorrect in pivot view .

    Hello ,
    I have the below scenario . Iam trying to get the calculated grand total for % column . I tired several ways ...like report aggregates enabled in instanceconfig,tried creating cal colum using physical columns as well as logical columns in RPD , changing the aggregation rule. The row wise values (%) are coming correct but iam unable to get correct % grand total (36.8%) instead iam just getting the sum of the % total ( 83.3%) . I have tried the above options in my previous reports and those conditions work perfectly right but for this report they are not able to . kindly please let me know if anybody has a solution for this issue .
    Department ...USD CAD Variance (USD/CAD)*100
    XYZ 10 20 50%
    ABC 25 75 33.3%
    Total 35 95 36.8% ( 35/95)
    Thanks
    Karthik

    Just to cross check
    Do you have following tag in your instanceconfig file ? if its not there then you may encounter grand total incorrect calculations.
    <ReportAggregateEnabled>true</ReportAggregateEnabled>

  • OBIEE 10g - Unable to see data in the report view with grand total applied

    Hi,
    We're facing with a strange issue.
    We're working on a report view.
    We're able to see data when Grand total is not applied on the report. The moment Grand Total is applied, it's showing either an empty table with NULL values or "No Results" page.
    Please help.
    Thanks in advance.
    -Rama

    Hi Dpk,
    Thanks for your reply.
    I included it in the instanceconfig.xml, but the issue still exists.
    Couple of Observations
    #1 - We noticed this issue when we drill down to the level which has really sparse data.
    It works fine when we look at the enterprise wide report.
    #2 - Works fine with few dimensional attributes and facts on the report
    When we add a fact that doesn't have any value at that level, the issue starts to appear.
    Thanks in advance.
    -Rama

  • % is not getting correctly for the Grand Total Row in OBI10g

    Hi,We have a report in table view with the following structure.
    Name     Target     Act     %Ach
    ABC     100     50     50
    XYZ     200     10     5
    Total     300     60     27.5
    The value for the %Ach Total row should be 20% but in the report it is showing as 27.5.
    any one observed this ,how to correct this??
    Thanks

    Hi,
    To get grand total correctly..configure instanceconfig.xml and put..
    <ReportAggregateEnabled>true</ReportAggregateEnabled> between <serverinstace>..
    refer..
    http://obiee101.blogspot.com/2009/09/obiee-grand-totals-with-calculated.html
    Hope it solves ur problem

  • Total variances through IR

    Hi experts,
    Could some one explain me when  the 'Total variances through IR' are generated?
    We have a case of a PO in Foreign currency for quantity of 1.
    This PO was invoiced before being received.
    When received, the GR  value does not match the invoice value.
    The total GR value is adjusted with a 'Total variances through IR'.  The total goods receipts does match the invoice value.
    I tried to look for possible different currency rates,but the documents have the same currency - PO and invoice  and GR -
    Thank you.
    Monica.

    Hi Monica,
    When the invoice was posted prior to the receiver the entries will be
    Invoice Receipt
    Debit  GR/IR Clearing
    Credit  Supplier Vendor
    then Goods Receipt
    Debit  Inventory account
    credit  GR/IR Clearing
    debit   Variance
    then clear the variance
    debit  Vendor
    credit  variance
    assign points if useful
    Regards
    Genie

  • Urgent:Grand total in hierarchical alv

    I am printing a hierarchical alv with subtotals. I want to print the grand total for the whole numeric columns ...
    Can anyone explain me how i can do this.
    Thanks and regards,
    Subhakar

    Hi,
    In this case you not only require the totals but the subtotals also.
    For achieving this output you will have to sort the alv on the first column and also give subtotals there.
    use
    data: SORTF TYPE SLIS_SORTINFO_ALV,
             TSORT TYPE SLIS_T_SORTINFO_ALV.
    in the function module reuse_alv_grid_display give
    it_sort = tsort.
    eg:
    FORM ALV_SHOW.
      LAYOUT-COLWIDTH_OPTIMIZE = 'X'.
      LAYOUT-BOX_TABNAME = 'IT_DISPLAY'.
      LAYOUT-INFO_FIELDNAME = 'LINE_COLOR'.
      LAYOUT-ZEBRA = 'X'.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          I_CALLBACK_PROGRAM        = SY-REPID
         I_CALLBACK_USER_COMMAND   = 'USER_COMMAND'
          IS_LAYOUT                 = LAYOUT
          IT_FIELDCAT               = TCATALOG
          IS_VARIANT                = VAR1
          I_SAVE                    = 'A'
          IT_SORT                   = TSORT
          IT_EVENTS                 = TEVENT[]
        TABLES
          T_OUTTAB                  = IT_DISPLAY.
    ENDFORM .                    "ALV_SHOW
    and write a subroutine for sort...
    form sort.
    CLEAR SORTF.
      SORTF-spos = 1.
      SORTF-fieldname = 'column_1'.
      SORTF-tabname = 'IT_table used for display in alv'.
      SORTF-up = 'X'.
      SORTF-subtot = 'X'.
    APPEND SORTF TO TSORT.
    endform.
    If this doesn't help I will send you the whole source of a sample program..
    Abdullah

  • Sub total wise Grand total in ALV report

    Dear All,
    I am displaying a list of material through material group wise so for each material i want to display sub-total for stock and grand total of stock(material group wise).Here it is adding up all the stock displayed for different AUOM(alternative unit of measure ) which is for same material so i want to pick only the sub-total and sum up in my Grand total.
    How to pick only the Sub-total Results and Add in ALV List for Grand total.
    Thanks & Regards,
    Arun.
    Edited by: Arun Kumaran on Sep 24, 2008 7:46 AM

    Hi arun,
    check these links
    total and subtotal in alv
    ALV SUBTOTAL
    Regards,
    Anirban

  • Hide grand total field on ALV report, But keep the sub total fields

    Dear Experts,
    1) How to hide grand total field on ALV report, But keep the sub total fields.
    2) How to populate rate per ton & calculate total price according to the qty in delivering document.

    Dear Experts,
    1) How to hide grand total field on ALV report, But keep the sub total fields.
    2) How to populate rate per ton & calculate total price according to the qty in delivering document.

  • Alv subtotals  and grand total for a field

    Hi friends,
    I Have an internal table ITAB1
    in that i have a senario as below.
    In my GRID display iam getting values in the layou as follows
    BUKRS =  1000
    LIFNR      MATNR     STCST
    100          abc            500,00
    100          pqr             400,00
    100          xyz            200,00
                        sub total
    200         pto              700,00
    200         vbr              900,00
                        sub total
    BUKRS =  2000
    LIFNR      MATNR     STCST
    150          abc            500,00
    150          pqr             400,00
    150          xyz            200,00
                        sub total
    260         pto              700,00
    260         vbr              900,00
                        sub total
              GRAND TOTAL = 
    Now my requirement is at the end of every vendor  i need sub total for STCST field.
    and at the end of every company code i need GRAND TOTAL for STCST field.
    Its alv grid display.
    how can i do that.
    Regards,
    Priyanka.

    Check this sample code may it will help u:
    *& Report  Z_ALV_SUBTOTAL
    REPORT z_alv_subtotal.
    *& Table declaration
    TABLES: ekko.
    *& Type pool declaration
    TYPE-POOLS: slis. " Type pool for ALV
    *& Selection screen
    SELECT-OPTIONS: s_ebeln FOR ekko-ebeln.
    *& Type declaration
    * Type declaration for internal table to store EKPO data
    TYPES: BEGIN OF x_data,
           ebeln  TYPE char30,  " Document no.
           ebelp  TYPE ebelp,   " Item no
           matnr  TYPE matnr,   " Material no
           matnr1 TYPE matnr,   " Material no
           werks  TYPE werks_d, " Plant
           werks1 TYPE werks_d, " Plant
           ntgew  TYPE entge,   " Net weight
           gewe   TYPE egewe,   " Unit of weight                          
           END OF x_data.
    *& Internal table declaration
    DATA:
    * Internal table to store EKPO data
      i_ekpo TYPE STANDARD TABLE OF x_data INITIAL SIZE 0,
    * Internal table for storing field catalog information
      i_fieldcat TYPE slis_t_fieldcat_alv,
    * Internal table for Top of Page info. in ALV Display
      i_alv_top_of_page TYPE slis_t_listheader,
    * Internal table for ALV Display events
      i_events TYPE slis_t_event,
    * Internal table for storing ALV sort information
      i_sort TYPE  slis_t_sortinfo_alv,
      i_event TYPE slis_t_event.
    *& Work area declaration
    DATA:
      wa_ekko TYPE x_data,
      wa_layout     TYPE slis_layout_alv,
      wa_events         TYPE slis_alv_event,
      wa_sort TYPE slis_sortinfo_alv.
    *& Constant declaration
    CONSTANTS:
       c_header   TYPE char1
                  VALUE 'H',                    "Header in ALV
       c_item     TYPE char1
                  VALUE 'S'.
    *& Start-of-selection event
    START-OF-SELECTION.
    * Select data from ekpo
      SELECT ebeln " Doc no
             ebelp " Item
             matnr " Material*
             matnr " Material*
             werks " Plant*
             werks " Plant*
             ntgew " Quantity
             gewei " Unit
             FROM ekpo
             INTO TABLE i_ekpo
             WHERE ebeln IN s_ebeln
             AND ntgew NE '0.00'.
      IF sy-subrc = 0.
        SORT i_ekpo BY ebeln ebelp matnr .
      ENDIF.
    * To build the Page header
      PERFORM sub_build_header.
    * To prepare field catalog
      PERFORM sub_field_catalog.
    * Perform to populate the layout structure
      PERFORM sub_populate_layout.
    * Perform to populate the sort table.
      PERFORM sub_populate_sort.
    * Perform to populate ALV event
      PERFORM sub_get_event.
    END-OF-SELECTION.
    * Perform to display ALV report
      PERFORM sub_alv_report_display.
    *&      Form  sub_build_header
    *       To build the header
    *       No Parameter
    FORM sub_build_header .
    * Local data declaration
      DATA: l_system     TYPE char10 ,          "System id
            l_r_line     TYPE slis_listheader,  "Hold list header
            l_date       TYPE char10,           "Date
            l_time       TYPE char10,           "Time
            l_success_records TYPE i,           "No of success records
            l_title(300) TYPE c.                " Title
    * Title  Display
      l_r_line-typ = c_header.               " header
      l_title = 'Test report'(001).
      l_r_line-info = l_title.
      APPEND l_r_line TO i_alv_top_of_page.
      CLEAR l_r_line.
    * Run date Display
      CLEAR l_date.
      l_r_line-typ  = c_item.                " Item
      WRITE: sy-datum  TO l_date MM/DD/YYYY.
      l_r_line-key = 'Run Date :'(002).
      l_r_line-info = l_date.
      APPEND l_r_line TO i_alv_top_of_page.
      CLEAR: l_r_line,
             l_date.
    ENDFORM.                    " sub_build_header
    *&      Form  sub_field_catalog
    *       Build Field Catalog
    *       No Parameter
    FORM sub_field_catalog .
    *  Build Field Catalog
      PERFORM sub_fill_alv_field_catalog USING:
         '01' '01' 'EBELN' 'I_EKPO' 'L'
         'Doc No'(003) ' ' ' ' ' ' ' ',
         '01' '02' 'EBELP' 'I_EKPO' 'L'
         'Item No'(004) 'X' 'X' ' ' ' ',
         '01' '03' 'MATNR' 'I_EKPO' 'L'
         'Material No'(005) 'X' 'X' ' ' ' ',
         '01' '03' 'MATNR1' 'I_EKPO' 'L'
         'Material No'(005) ' ' ' ' ' ' ' ',
         '01' '04' 'WERKS' 'I_EKPO' 'L'
         'Plant'(006) 'X' 'X' ' ' ' ',
         '01' '04' 'WERKS1' 'I_EKPO' 'L'
         'Plant'(006) ' ' ' ' ' ' ' ',
         '01' '05' 'NTGEW' 'I_EKPO' 'R'
         'Net Weight'(007) ' ' ' ' 'GEWE' 'I_EKPO'.
    ENDFORM.                    " sub_field_catalog
    *&     Form  sub_fill_alv_field_catalog
    *&     For building Field Catalog
    *&     p_rowpos   Row position
    *&     p_colpos   Col position
    *&     p_fldnam   Fldname
    *&     p_tabnam   Tabname
    *&     p_justif   Justification
    *&     p_seltext  Seltext
    *&     p_out      no out
    *&     p_tech     Technical field
    *&     p_qfield   Quantity field
    *&     p_qtab     Quantity table
    FORM sub_fill_alv_field_catalog  USING  p_rowpos    TYPE sycurow
                                            p_colpos    TYPE sycucol
                                            p_fldnam    TYPE fieldname
                                            p_tabnam    TYPE tabname
                                            p_justif    TYPE char1
                                            p_seltext   TYPE dd03p-scrtext_l
                                            p_out       TYPE char1
                                            p_tech      TYPE char1
                                            p_qfield    TYPE slis_fieldname
                                            p_qtab      TYPE slis_tabname.
    * Local declaration for field catalog
      DATA: wa_lfl_fcat    TYPE  slis_fieldcat_alv.
      wa_lfl_fcat-row_pos        =  p_rowpos.     "Row
      wa_lfl_fcat-col_pos        =  p_colpos.     "Column
      wa_lfl_fcat-fieldname      =  p_fldnam.     "Field Name
      wa_lfl_fcat-tabname        =  p_tabnam.     "Internal Table Name
      wa_lfl_fcat-just           =  p_justif.     "Screen Justified
      wa_lfl_fcat-seltext_l      =  p_seltext.    "Field Text
      wa_lfl_fcat-no_out         =  p_out.        "No output
      wa_lfl_fcat-tech           =  p_tech.       "Technical field
      wa_lfl_fcat-qfieldname     =  p_qfield.     "Quantity unit
      wa_lfl_fcat-qtabname       =  p_qtab .      "Quantity table
      IF p_fldnam = 'NTGEW'.
        wa_lfl_fcat-do_sum  = 'X'.
      ENDIF.
      APPEND wa_lfl_fcat TO i_fieldcat.
      CLEAR wa_lfl_fcat.
    ENDFORM.                    " sub_fill_alv_field_catalog
    *&      Form  sub_populate_layout
    *       Populate ALV layout
    *       No Parameter
    FORM sub_populate_layout .
      CLEAR wa_layout.
      wa_layout-colwidth_optimize = 'X'." Optimization of Col width
    ENDFORM.                    " sub_populate_layout
    *&      Form  sub_populate_sort
    *       Populate ALV sort table
    *       No Parameter
    FORM sub_populate_sort .
    * Sort on material
      wa_sort-spos = '01' .
      wa_sort-fieldname = 'MATNR'.
      wa_sort-tabname = 'I_EKPO'.
      wa_sort-up = 'X'.
      wa_sort-subtot = 'X'.
      APPEND wa_sort TO i_sort .
      CLEAR wa_sort.
    * Sort on plant
      wa_sort-spos = '02'.
      wa_sort-fieldname = 'WERKS'.
      wa_sort-tabname = 'I_EKPO'.
      wa_sort-up = 'X'.
      wa_sort-subtot = 'X'.
      APPEND wa_sort TO i_sort .
      CLEAR wa_sort.
    ENDFORM.                    " sub_populate_sort
    *&      Form  sub_get_event
    *       Get ALV grid event and pass the form name to subtotal_text
    *       event
    *       No Parameter
    FORM sub_get_event .
      CONSTANTS : c_formname_subtotal_text TYPE slis_formname VALUE
    'SUBTOTAL_TEXT'.
      DATA: l_s_event TYPE slis_alv_event.
      CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
        EXPORTING
          i_list_type     = 4
        IMPORTING
          et_events       = i_event
        EXCEPTIONS
          list_type_wrong = 0
          OTHERS          = 0.
    * Subtotal
      READ TABLE i_event  INTO l_s_event
                        WITH KEY name = slis_ev_subtotal_text.
      IF sy-subrc = 0.
        MOVE c_formname_subtotal_text TO l_s_event-form.
        MODIFY i_event FROM l_s_event INDEX sy-tabix.
      ENDIF.
    ENDFORM.                    " sub_get_event
    *&      Form  sub_alv_report_display
    *       For ALV Report Display
    *       No Parameter
    FORM sub_alv_report_display .
      DATA: l_repid TYPE syrepid .
      l_repid = sy-repid .
    * This function module for displaying the ALV report
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          i_callback_program       = l_repid
          i_callback_top_of_page   = 'SUB_ALV_TOP_OF_PAGE'
          is_layout                = wa_layout
          it_fieldcat              = i_fieldcat
          it_sort = i_sort
          it_events                = i_event
          i_default                = 'X'
          i_save                   = 'A'
        TABLES
          t_outtab                 = i_ekpo
        EXCEPTIONS
          program_error            = 1
          OTHERS                   = 2.
      IF sy-subrc <> 0.
    *    MESSAGE i000 WITH 'Error in ALV report display'(055).
      ENDIF.
    ENDFORM.                    " sub_alv_report_display
    *       FORM sub_alv_top_of_page
    *       Call ALV top of page
    *       No parameter
    FORM sub_alv_top_of_page.                                   "#EC CALLED
    * To write header for the ALV
      CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
        EXPORTING
          it_list_commentary = i_alv_top_of_page.
    ENDFORM.                    "alv_top_of_page
    *&      Form  subtotal_text
    *       Build subtotal text
    *       P_total  Total
    *       p_subtot_text Subtotal text info
    FORM subtotal_text CHANGING
                   p_total TYPE any
                   p_subtot_text TYPE slis_subtot_text.
    * Material level sub total
      IF p_subtot_text-criteria = 'MATNR'.
        p_subtot_text-display_text_for_subtotal
        = 'Material level total'(009).
      ENDIF.
    * Plant level sub total
      IF p_subtot_text-criteria = 'WERKS'.
        p_subtot_text-display_text_for_subtotal = 'Plant level total'(010).
      ENDIF.
    ENDFORM.                    "subtotal_text
    Edited by: Joyjit Ghosh on Aug 21, 2008 5:25 PM

  • Subtotal in ALV grid for a particular type and Grand total in ALV

    Hi,
    I need to have sub total for a particular type(eg: goods, services).. and grand total at end in ALV grid..
    ALV output required as below:
    Type     VAT registration number     Country      Total Gross Amounts       Total Tax Amounts       Total Amount, ex-tax
    Goods     ATU12345678     AT                  222.42      0         222.42
    Goods     NL123456789B02     NL               3,417.00      0      3,417.00
         Goods Total                    3,639.42                -         3,639.42
    Services     ATU12345678     AT               2,342.34      0      2,342.34
    Services     NL123456789B02     NL                  223.33      0         223.33
         Services Total                    2,565.67                -         2,565.67
         Grand Total                    6,205.09                -         6,205.09
    Let me as to how to achieve the above type in ALV grid...
    Regards
    Shiva

    check this link..
    Grand Totals in ALV grid disply function module
    or do like this..
    REPORT  ZALVTESTFORSUBTOTAL.
    tables:pa0008.
    type-pools:slis.
    types:begin of ty_pa0008,
          pernr like pa0008-pernr,
          begda like pa0008-begda,
          endda like pa0008-endda,
          ansal like pa0008-ansal,
          lga01 like pa0008-lga01,
          bet01 like pa0008-bet01,
          end of ty_pa0008.
    data:it_pa0008 type standard table of ty_pa0008 with header line.
    data:it_fieldcat type SLIS_T_FIELDCAT_ALV,
         wa_fieldcat type slis_fieldcat_alv,
         it_layout type slis_layout_alv,
         WA_events TYPE slis_alv_event,
         it_events TYPE slis_t_event.
    select-options:s_pernr for pa0008-pernr.
    start-of-selection.
    perform getD_data.
    perform disp_alv.
    *&      Form  getD_data
          text
    -->  p1        text
    <--  p2        text
    form getD_data .
    select pernr
           begda
           endda
           ansal
           lga01
           bet01
           from pa0008
           into table it_pa0008
           where pernr in s_pernr.
    sort it_pa0008 by pernr begda descending.
    endform.                    " getD_data
    *&      Form  disp_alv
          text
    -->  p1        text
    <--  p2        text
    form disp_alv .
    wa_fieldcat-fieldname = 'PERNR'.
    wa_FIELDCAT-REPTEXT_DDIC = 'Personnel no'.
    *WA_FIELDCAT-no_subtotals = 'X'.
    append wa_fieldcat to it_fieldcat.
    clear wa_fieldcat.
    wa_fieldcat-fieldname = 'BEGDA'.
    wa_FIELDCAT-REPTEXT_DDIC = 'Start date'.
    append wa_fieldcat to it_fieldcat.
    clear wa_fieldcat.
    wa_fieldcat-fieldname = 'ENDDA'.
    wa_FIELDCAT-REPTEXT_DDIC = 'End date'.
    append wa_fieldcat to it_fieldcat.
    clear wa_fieldcat.
    wa_fieldcat-fieldname = 'ANSAL'.
    wa_FIELDCAT-REPTEXT_DDIC = 'Annula salary'.
    wa_fieldcat-do_sum = 'X'.
    append wa_fieldcat to it_fieldcat.
    clear wa_fieldcat.
    wa_fieldcat-fieldname = 'LGA01'.
    wa_FIELDCAT-REPTEXT_DDIC = 'Wage Type'.
    append wa_fieldcat to it_fieldcat.
    clear wa_fieldcat.
    wa_fieldcat-fieldname = 'BET01'.
    wa_FIELDCAT-REPTEXT_DDIC = 'Amount for wagetype'.
    append wa_fieldcat to it_fieldcat.
    clear wa_fieldcat.
    DATA: sort TYPE slis_sortinfo_alv,
    it_sort TYPE slis_t_sortinfo_alv.
    sort-fieldname = 'PERNR'.
    sort-subtot = 'X'.
    SORT-UP = 'X'.
    APPEND sort TO it_sort.
    *sort-fieldname = 'BEGDA'.
    *SORT-NO_SUBTOTS = 'X'.
    *APPEND sort TO it_sort.
    IT_layout-totals_text = 'total text'.
    IT_layout-subtotals_text = 'Subtotal text'.
    *WA_EVENTS-NAME = 'SUBTOTAL TEXT'.
    *WA_EVENTS-FORM = 'SUBTOTAL TEXT'.
    *APPEND WA_EVENTS TO IT_EVENTS.
    CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
    EXPORTING
       I_CALLBACK_PROGRAM             = sy-repid
       IS_LAYOUT                      = it_LAYOUT
       IT_FIELDCAT                    = IT_FIELDCAT
       it_sort                        = it_sort
      it_events                      = it_events
       TABLES
        t_outtab                       = it_pa0008 .
    endform.                    " disp_alv

  • (Smartform) Print grand total on the last page

    Hi everyone,
    I'm trying to print the Grand Totals on the last page of my Smartform. I have two pages - FIRST and SECOND.
    What I did was I created a Text to display the grand total, and I specified that this text should be printed 'Only After End of Main Window'. However, the total is not being printed out.
    I can't change the condition to 'Not on First Page', because my form has more than two pages, and I only want the grand totals on the last page.
    Any help would be appreciated.

    hi,
    we have a window type called final window if u define this type window in second page . create a table in the window and go to calculations tab and define an internal table. i think u can get the grand totals.
    if u want maore clearly go throuh this link
    https://www.sdn.sap.com/irj/sdn/forums
    hope this will help you.
    REWARD ME IF USEFUL.
    thanks,
    gupta
    Edited by: gupta pullipudi on Apr 9, 2008 9:23 PM

  • Grand Total Text is not printing in ALV

    Hi all,
    I am not able to print Grand Total text in my report
    I am not doing subtotal, i am using only grand totals.
    So i have used in the following way
    WA_FIELDCAT-DO_SUM        = GC_X.
      GS_LAYOUT-TOTALS_ONLY       = GC_X.
      GS_LAYOUT-TOTALS_TEXT       = 'Totals'(049).
    i am using using ALV GRID DISPLAY FM...its displaying the total amount, buts text is missing...
    Can any one tell me what else i have to pass in the layout or fieldcatlog or FM

    Hi AMR,
    If you use REUSE_ALV_GRID_DISPLAY function module, i think Total text does not come .but if u use REUSE_ALV_LIST_DISPLAY function module Total text comes .
    Check this sample program it let u know ..
    "Types
    TYPES:
          BEGIN OF t_pa0008,
            pernr TYPE pa0008-pernr,
            lga01 TYPE pa0008-lga01,
            bet01 TYPE pa0008-bet01,
          END OF t_pa0008.
    "Work areas
    DATA:
          w_pa0008 TYPE t_pa0008.
    "Internal tables
    DATA:
          i_pa0008 TYPE STANDARD TABLE OF t_pa0008.
    PARAMETERS:
               list TYPE c RADIOBUTTON GROUP gr1,
               grid TYPE c RADIOBUTTON GROUP gr1.
    " ALV Declarations
    " Types Pools
    TYPE-POOLS:
       slis.
    " Types
    TYPES:
       t_fieldcat         TYPE slis_fieldcat_alv,
       t_events           TYPE slis_alv_event,
       t_layout           TYPE slis_layout_alv,
       t_sort             TYPE  slis_sortinfo_alv,
       t_keyinfo          TYPE slis_keyinfo_alv.
    " Workareas
    DATA:
       w_fieldcat         TYPE t_fieldcat,
       w_events           TYPE t_events,
       w_sort             TYPE t_sort,
       w_layout           TYPE t_layout,
       w_keyinfo          TYPE t_keyinfo.
    " Internal Tables
    DATA:
       i_fieldcat         TYPE STANDARD TABLE OF t_fieldcat,
       i_events           TYPE STANDARD TABLE OF t_events,
       i_sort             TYPE STANDARD TABLE OF t_sort.
    START-OF-SELECTION.
      PERFORM get_data.
    END-OF-SELECTION.
      PERFORM build_fieldcatalog.        "Fieldcatalog
      PERFORM build_events.              "Events table
      PERFORM buid_layout.               "Layout structure.
      PERFORM build_sort_tab.            "To sort table and get subtotal
      PERFORM display_data.
    *&      Form  get_data
    FORM get_data.
      DATA:l_0008 TYPE pa0008 OCCURS 0 WITH HEADER LINE.
      SELECT pernr lga01 bet01
        FROM pa0008
        INTO CORRESPONDING FIELDS OF l_0008
        WHERE begda LE sy-datum
          AND endda GE sy-datum.
        w_pa0008-pernr = l_0008-pernr.
        w_pa0008-lga01 = l_0008-lga01.
        w_pa0008-bet01 = l_0008-bet01.
        APPEND w_pa0008 TO i_pa0008.
        CLEAR  w_pa0008.
        w_pa0008-pernr = l_0008-pernr.
        w_pa0008-lga01 = l_0008-lga02.
        w_pa0008-bet01 = l_0008-bet02.
        APPEND w_pa0008 TO i_pa0008.
        CLEAR  w_pa0008.
        w_pa0008-pernr = l_0008-pernr.
        w_pa0008-lga01 = l_0008-lga03.
        w_pa0008-bet01 = l_0008-bet03.
        APPEND w_pa0008 TO i_pa0008.
        CLEAR  w_pa0008.
        w_pa0008-pernr = l_0008-pernr.
        w_pa0008-lga01 = l_0008-lga04.
        w_pa0008-bet01 = l_0008-bet04.
        APPEND w_pa0008 TO i_pa0008.
        CLEAR  w_pa0008.
      ENDSELECT.
    ENDFORM.                    "get_data
    *&      Form  build_fieldcatalog
    FORM build_fieldcatalog.
      PERFORM build_fcat USING:
                    "Field    Int.Table    Text
                     'PERNR' 'I_PA0008'   'PERNR', "Remove this if u dont want in the item table as well as it is there in the header table
                     'LGA01' 'I_PA0008'   'LGA01',
                     'BET01' 'I_PA0008'   'BET01'.
    ENDFORM.                    "build_fieldcatalog
    *&      Form  build_events
    *       text
    FORM build_events.
      CLEAR:
            w_events, i_events[].
      w_events-name = 'TOP_OF_PAGE'.
      w_events-form = 'TOP_OF_PAGE'.
      APPEND w_events TO i_events.
      CLEAR  w_events.
    ENDFORM.                    "build_events
    *&      Form  display_data
    *       text
    FORM display_data.
      DATA:
            l_program TYPE sy-repid VALUE sy-repid,
            l_fm      TYPE RS38L_FNAM.
      IF list = 'X'.
        l_fm =  'REUSE_ALV_LIST_DISPLAY'.
      ELSEIF grid ='X'.
        l_fm =  'REUSE_ALV_GRID_DISPLAY'.
      ENDIF.
      CALL FUNCTION l_fm
        EXPORTING
          i_callback_program = l_program
          is_layout          = w_layout
          it_fieldcat        = i_fieldcat
          it_events          = i_events
          it_sort            = i_sort
        TABLES
          t_outtab           = i_pa0008.
      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.                    "display_data
    *&      Form  build_fcat
    FORM build_fcat  USING l_field l_tab l_text.
      w_fieldcat-fieldname = l_field.
      w_fieldcat-tabname   = l_tab.
      w_fieldcat-seltext_m = l_text.
      IF l_field = 'BET01'.
        w_fieldcat-do_sum = 'X'.
      ENDIF.
      APPEND w_fieldcat TO i_fieldcat.
      CLEAR  w_fieldcat.
    ENDFORM.                    " build_fcat
    *&      Form  top_of_page
    *       text
    FORM top_of_page.
      DATA :
      i_header TYPE slis_t_listheader,
      w_header LIKE LINE OF i_header.
      DATA:l_date1 TYPE datum,
           l_date2 TYPE datum.
      w_header-typ = 'S'.
      w_header-info = sy-title.
      APPEND w_header TO i_header.
      CLEAR w_header.
      w_header-typ = 'H'.
      w_header-info = sy-repid.
      APPEND w_header TO i_header.
      CLEAR w_header.
      CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
        EXPORTING
          it_list_commentary = i_header
          i_logo             = 'ENJOYSAP_LOGO'.
    ENDFORM.                    "top_of_page
    *&      Form  BUILD_sort_tab
    FORM build_sort_tab .
      CLEAR :i_sort[],w_sort.
      w_sort-spos      = 1.
      w_sort-fieldname = 'PERNR'.
      w_sort-tabname   = 'I_PA0008'. "header table
      w_sort-up        = 'X'.
      w_sort-subtot    = 'X'.
      APPEND w_sort TO i_sort.
      CLEAR w_sort.
    ENDFORM.                    " BUILD_sort_tab
    *&      Form  buid_layout
    FORM buid_layout .
      w_layout-totals_text = 'Total'.
      w_layout-subtotals_text = 'S.Total'.
    ENDFORM.                    " buid_layout
    Regards,
    Venkat.O

  • Using Rollup to get subtotals and grand total - missing right pren error

    Hello,
    I am trying to create sub totals by person_id and a grand total row in my APEX report but I get a "missing right pren error." I finally figure out that I need to eliminate column alias names to fix this problem, however, I now get an ambigous column reference. I am making this change in my main SQL report statement, however, I was wondering if I should be using the "group by Rollup" somewhere else while using "Break Formatting."
    I would appreciate any help.
    Thanks
    leh

    Can you post the Query please?

Maybe you are looking for

  • GetCallerPrincipal() returns wrong object

    I have implemented my own realm and was successfull doing so. I also created my own User object and that is returned in the authentication method. My problem is that when I call getCallerPrincipal() from within an EJB the object returned has the corr

  • Using Macbook Pro's Audio Output

    Hello I'm considering a purchase of an Apple TV so I can stream films up to my projector which is on the far side of my room. However my Macbook and speakers are on the other. Is it possible to stream content to the Apple TV but use the Macbook's aud

  • Would  it be more expensive to replace the screen on my iPod nano generation 6 or purchase a new one?

    Today I dropped my sixth generation iPod nano which cracked the screen, and my "Apple Care" has runout. Would I be better off purchasing a new iPod or having the screen replaced by a Springboard Apple Specialist.

  • Parallels Desktop 4  - 32 or 64 bit version of Vista?

    Hello Folks! Anyone using Parallels Desktop 4 with Vista? What have you experienced with Vista and Parallels 4? QUESTION: Should I install the 32 or 64 bit version of Vista? I am on a new MacPro computer under OSX 10.5.6

  • Simple script tip please

    Folks, Lets say a button in my page works correctly with this path: ../../index.html How do I change that path in action script when the button is incorporated into a movie clip nav bar? MeanIng, now the button is buried one level deeper in the fla i