Creation of Sub-Totals within Groups

Hi - hope this is me just being a plank but I've hit a brick wall whilst trying to recreate a set of management accounts. So far the report has just two Groups - call them A & B for ease. Group B summarizes the detail and Group A neatly collects the results from Group B.
Group A  comprises 6 parts all doing their bit and all the standard Crystal Sub-Totals (Summaries) work just fine. The problem I encounter is when I need to insert another Sub-Total into Group A which summarizes multiple parts of Group A e.g. Part 1 is Sales, Part 2 is Cost of sales, Part 3 is Labour, Part 4 is Expenses, Part 5 is Other and Part 6 is Depreciation. I need to insert a Sub-Total between Parts 3 and 4 which basically gives a total of Sales minus Cost of Sales minus Labour and to then continue with Parts 4 to 6. This is obviously a huge simplification of the issue but an answer to this would let me proceed with everything else.
I've tried creating an line so I can add a formula for this by giving it a name of its own in Group A but it fails to appear on the report. I've also tried the 'Insert Section Below' option and whilst I can suppress it where necessary the formula just picks up values from the last entry on the Detail Section.
Any ideas where I am making some elementary mistakes and is there an easy solution? Many thanks

Hi,
  Try to create a manual running total formula for summing the fields with a condition.
Create a @reset formula and place it report header:
formula:
whileprintingrecords;
numbervar i:=0;
Create a @eval formula and place it in group header A:
formula:
whileprintingrecords;
numbervar i;
if {groupname.field} = 'Labour' or {groupname.field} = 'Expenses'  then
i:= i + {summary.field};
Create a @display formula and place it in report footer;
formula:
whileprintingrecords;
numbervar i;
Hope this helps!
Regards,
Vinay

Similar Messages

  • SUB Totals within a Dynamic Data Column

    Has anyone ever calculated SUB Totals in a Layout with a Dynamic Data Column?
        The TOTAL for all data is expressed on the Data Column tab of the Layout as C(1):C(1) - 0FISCPER / Posting Period is the Dynamic Characteristic.  When the system actually displays the 12 columns of data for the Year, the formula for TOTAL is also adjusted - no problem here.  But the user also wants SUB Totals, by Quarter, within the Year.
        Any insight or suggections are appreciated !
    Thanks,
    Lyle

    Hello,
    use variables Q1, ..., Q4 for the quarters and create
    data colums as follows
    1 Q1 dynamic = X
    2 Total C(1)
    3 Q2 dynamic = X
    4 Total C(3)
    5 Q3 dynamic = X
    6 Total C(5)
    7 Q4 dynamic = X
    8 Total C(7)
    9 Year Total C(2)C(4)C(6)+C(8)
    Regards,
    Gregor

  • Sub Totals of Groups

    Hi experts,
    <br>
    <br>
    i have the following problem. I've already checked this forum for it and the internet but i can't find a solution. Maybe someone of you can help me or give me a hint.
    <br>
    <br>
    I have a printform with a table in it, i'm able to calculate page wise totals and grandtotal. But i need now a total for groups.
    <br>
    <br>
    For instance table on first page:
    <br><br>
    Table header. Nr. | Date | Amount | price |
    <br>
    Table data        1  | 1.1   | 2            | 2.00 |
    <br>
                             1  |  2.1  | 3           | 3.00 |
    <br>
                             2  |  2.1  | 3           | 3.00 |
    <br>
                             2  |  2.1  | 3           | 3.00 |
    <br>
                             3  |  2.1  | 3           | 3.00 |
    <br>
                             3  |  2.1  | 3           | 3.00 |
    <br>
                             3  |  2.1  | 3           | 3.00 |
    <br>
    Table footer                                  |pagesum|
    <br><br>
    For instance table on second page:
    <br><br>
    Table header. Nr. | Date | Amount | price |
    <br>
    Table data        4  | 1.1  | 2            | 2.00 |
    <br>
                             4  |  2.1  | 3           | 3.00 |
    <br>
                             4  |  2.1  | 3           | 3.00 |
    <br>
                             5  |  2.1  | 3           | 3.00 |
    <br>
                             5  |  2.1  | 3           | 3.00 |
    <br>
                             5  |  2.1  | 3           | 3.00 |
    <br>
                             5  |  2.1  | 3           | 3.00 |
    <br>
    Table footer                                  |pagesum|
    <br>
    Field                                              |grad total|
    <br><br>
    This is the form like i have it at the moment! I want to achieve the following form.
    <br><br>
    For instance table on first page:
    <br><br>
    Table header. Nr. | Date | Amount | price |
    <br>
    Table data        1  | 1.1   | 2            | 2.00 |
    <br>
                             1  |  2.1 | 3           | 3.00 |
    <br>
    total                                              |Nr 1total|
    <br>
                             2  |  2.1  | 3           | 3.00 |
    <br>
                             2  |  2.1  | 3           | 3.00 |
    <br>
    total                                              |Nr 2total|
    <br>
                             3  |  2.1  | 3           | 3.00 |
    <br>
                             3  |  2.1  | 3           | 3.00 |
    <br>
                             3  |  2.1  | 3           | 3.00 |
    <br>
    total3                                             |Nr 3total|
    <br>
    Table footer                                  |pagesum|
    <br><br>
    For instance table on second page:
    <br><br>
    Table header. Nr. | Date | Amount | price |
    <br>
    Table data        4  | 1.1   | 2            | 2.00 |
    <br>
                             4  |  2.1  | 3           | 3.00 |
    <br>
                             4  |  2.1 | 3           | 3.00 |
    <br>
    total                                              |Nr 4total|
    <br>
                             5  |  2.1  | 3           | 3.00 |
    <br>
                             5  |  2.1  | 3           | 3.00 |
    <br>
                             5  |  2.1  | 3           | 3.00 |
    <br>
                             5  |  2.1  | 3           | 3.00 |
    <br>
    total                                              |Nr 5total|
    <br>
    Table footer                                  |pagesum|
    <br>
    Field                                              |grad total|
    <br><br>
    Is this possible in Adobe Interactive Forms?
    <br>
    <br>
    Thanks for help in advanced!!!!

    Hi,
      Try to create a manual running total formula for summing the fields with a condition.
    Create a @reset formula and place it report header:
    formula:
    whileprintingrecords;
    numbervar i:=0;
    Create a @eval formula and place it in group header A:
    formula:
    whileprintingrecords;
    numbervar i;
    if {groupname.field} = 'Labour' or {groupname.field} = 'Expenses'  then
    i:= i + {summary.field};
    Create a @display formula and place it in report footer;
    formula:
    whileprintingrecords;
    numbervar i;
    Hope this helps!
    Regards,
    Vinay

  • Sub total from group by query?

    Hi,
    im using oracle 9i.
    Im getting results fine for the following kind of query,
       select a,b,c,sum(qty) d,sum(val) e from my_table group by a,b,c
       Now the output look like this
    a     b     c     d     e
    1     tt     rr     10     15
    1     tt     rr     10     25
    1     tt     rr     50     50
    1     tt     rr     10     20
    2     tt     rr     10     20
    2     tt     rr     20     40
    2     tt     rr     30     90
    2     tt     rr     40     80
    3     tt     rr     50     100
    3     tt     rr     60     180
    3     tt     rr     70     140but i want the output with subtotal based on column a. finally i want grant total. My output should b
    a     b     c     d     e
    1     tt     rr     10     15
    1     tt     rr     10     25
    1     tt     rr     50     50
    1     tt     rr     10     20
                   80     110
    2     tt     rr     10     20
    2     tt     rr     20     40
    2     tt     rr     30     90
    2     tt     rr     40     80
                   100     230
    3     tt     rr     50     100
    3     tt     rr     60     180
    3     tt     rr     70     140
                   180     420
                        760I tried with rollup,cube and grouping sets. But im not able to get exact result.
    Good help will be appreciated.
    Regards
    Sankar MN
    Edited by: SankarMCA on Oct 5, 2010 6:02 AM

    This may help you
    SQL> ed
    Wrote file afiedt.buf
      1  SELECT empno,sal,SUM(sal) OVER (order by sal RANGE BETWEEN UNBOUNDED PRECEDING and CURRENT ROW) cumulative_sum
      2* FROM emp
    SQL> /
         EMPNO        SAL CUMULATIVE_SUM
          7369        800            800
          7900        950           1750
          7876       1100           2850
          7521       1250           5350
          7654       1250           5350
          7934       1300           6650
          7844       1500           8150
          7499       1600           9750
          7782       2450          12200
          7698       2850          15050
          7566       2975          18025
         EMPNO        SAL CUMULATIVE_SUM
          7788       3000          24025
          7902       3000          24025
          7839       5000          29025
    14 rows selected.

  • Creating sub-cluster within a Coherence cluster

    Hi all,
    Does Coherence support creation of 'sub-clusters' within a larger coherence cluster - such that certain caches can be configured to run only on these subclusters, and other caches run on the entire coherence cluster as usual.
    E.g., suppose my application consists of 3 websphere clusters (under same cell) - each cluster consists of 2 Websphere server instances. Each Websphere cluster has got a specific functional responsbility (e.g., 1 cluster handles the UI, one handles core processing functionality and the 3rd cluster handles links with external legacy systems). Since the functionality itself is 'partitioned' - its possible that certain data managed by a particular WAS cluster should only be managed within that cluster and not across all 6 WAS instances.
    So - in this case - suppose I do have an 'outer' Coherence cluster of all 6 WAS instances (and some Caches are configured to be acessible to all 6 WAS instances - since the data managed in these caches is needed by all 6 WAS instances). Can I configure a smaller Coherence cluster to be available only on say 2 of the Websphere instances (say the WAS cluster which handles legacy links) - and configure certain caches which are available only on this smaller sub-cluster.
    regards,
    Sanjeev.

    I am quite confused about the purpose of the service-name. How would you tie down a cache to a particular service? In the context of the above example, the requirement seems to be:
    CacheA should be spread over the UI cluster.
    CacheB should be spread over the legacy cluster.
    CacheC should be spread over the global cluster.
    Are you suggesting something like the following:
    <u>Cache config file on a UI node</u>:
    <cluster-config>
       <caching-scheme-mapping>
          <cache-mapping>
             <cache-name>CacheA</cache-name>
             <scheme-name>ui</scheme-name>
          </cache-mapping>
          <cache-mapping>
             <cache-name>CacheC</cache-name>
             <scheme-name>global</scheme-name>
          </cache-mapping>
       </caching-scheme-mapping>
       <caching-schemes>
          <distributed-scheme>
              <scheme-name>ui</scheme-name>
              <service-name>ui</service-name>
         </distributed-scheme>
         <distributed-scheme>
              <scheme-name>global</scheme-name>
              <service-name>global</service-name>
         </distributed-scheme>
       </caching-schemes>
    </cluster-config><u>Cache config file on a legacy node</u>:
    <cluster-config>
       <caching-scheme-mapping>
          <cache-mapping>
             <cache-name>CacheB</cache-name>
             <scheme-name>legacy</scheme-name>
          </cache-mapping>
          <cache-mapping>
             <cache-name>CacheC</cache-name>
             <scheme-name>global</scheme-name>
          </cache-mapping>
       </caching-scheme-mapping>
       <caching-schemes>
          <distributed-scheme>
              <scheme-name>legacy</scheme-name>
              <service-name>legacy</service-name>
         </distributed-scheme>
         <distributed-scheme>
              <scheme-name>global</scheme-name>
              <service-name>global</service-name>
         </distributed-scheme>
       </caching-schemes>
    </cluster-config>The basic question seems to be: how do you control the nodes over which a cache is spread, purely from the cache name?
    Also, the 3.2 <role-name> feature seems to be something that addresses this requirement. How does that play v/s a service-name?
    My requirement is similar (needing to control the nodes over which different caches are spread) but I do not quite understand how the service-name would be used to satisfy this example. Could you please explain via cache configurations for this example?
    Thanks
    Ghanshyam

  • Sub totals& grand totals

    Dear All,
    I need to calculate sub totals then group totals and grand totals.
    ex
    x y z Val1 val2 val3
    x1 y1 z1 10 20 30
    x1 y1 z2 10 20 30
    x1 y2 z3 10 20 30
    Req Format
    x y z Val1 val2 val3
    x1 y1 z1 10 20 30
    x1 y1 z2 10 20 30
    y1 sum 20 40 60
    x1 y2 z3 10 20 30
    x1(sum) 30 60 90
    for that one where i need to make changes while in query in data set Or in template
    Awaiting for reply
    Subbu...

    Yes. I also wanna know how to do it. Would you pls point out an instruction for us? I read <<Oracle Business Intelligence Publisher B40017>> intensively. But I cann't find out any clue in it yet.
    I'm very urgent. Can you tell us how to do it?

  • Force the Summary Sub totals on same page as the Repeating Group

    Hello folks,
    I have a Group by Left Report where I am showing Patients and the Visits that they have taken for each Department.
    I am then doing a Sub Total of the number of Visits the Patient has taken. I would like to make sure that the sub total shows
    up on the same page as the data in the Repeating Group. I tried using an Anchor but the Report does not like it.
    It gives an Error: REP 1213 - Field references column at a frequency below its group when I anchor from Repeating frame to the sub total footer
    and REP 1814 Report cannot be formatted. Object 'Horizontally' can never fit within 'M_1' when I try to anchor the other way.
    My goal is to show the Sub Totals (Total) on the same page as the Patient and not go to the next page. I have enclosed the single dashed line and the Total (Label and field) in a Frame.
    Output of Report:
    Patient ID     Patient Name              Department              Visit
    ======================================================================
    1001           Mary Poppins              Department 001              3
                                             Department 002              4
                                             Department 003              1
                                             Total                       8
    1002           Peter Pan                 Department 001              2
                                             Department 002              1
                                             Department 003              2
                                             Total                       5
                                             -----------------------------Thanks in advance!

    Pls set the property(page protect of the frame containing both sub total and patient details) to yes.

  • How to handle goup sub total for each group in oracle query ?

    hi,
    i want to handle one complex thing in oracle query.
    i have a grouping in my oracle query.
    i want to do sub total for each group in query and after that i want to subtract one group sub total from previous group subtotal ?
    so how can i handle this in oracle query ?
    any help is greatly appreciated.
    thanks.

    Hello
    Interesting requirement.
    I wonder why are you not using these calculation during the display time. If it is acceptable then you can try using the custom formula with the running total combination in crystral report to achieve to get the required results.
    Best regards
    Ali Hadi

  • Showing Sub-Totals only for Specific Column in PowerView

    Hi,
    Is there a way of showing the sub-totals only for specific columns in a PowerView Matrix?
    I am only aware of showing the sub-totals for all or non of the columns.
    Thanks and Regards,
    Justin

    Hi Justin,
    According to your description, you want to get sub-totals specific columns within columns group. Right?
    In this scenario, we can use IIF() function in expression to achieve your goal. The expression will only return the total value when the column value is a specific value, otherwise we can make it return nothing. Try the following expression:
    IIF(Fields!Column.Value="[specific value]",Sum(Fields!Total.Value),nothing)
    We have tested this scenario in our local environment. Here are screenshots for your reference:
    Reference:
    Expression Examples (Report Builder and SSRS)
    If you have any question, please feel free to ask.
    Best Regards,
    Simon Hou

  • 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

  • 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

  • Report Total but no Sub total.

    Hi,
    I have a report ( PL/SQL Function returning SQL Query).
    The query is complicated.
    If value of item :p1 is not null then it returns select col_a , col_b ... from table_a
    but if value of item :p1 is null then it returns select col_a , sum( col_b) , sum(col_c).... from table_a group by col_a
    I went to report attributes and checked SUM for all the fields ( Except the first field )
    Its showing Sub total for each row and grand total..
    Is there a way I can show only grand total and not the sub total.

    1. Yes I'm using "Use generic column Name"
    2. No I'm not using column alias for sum
    3. Further my report uses two lines for Header , for which I am using custom report region.
    Re: Two level row header
    Below is the exact query i'm using for report
    DECLARE
    vc_query VARCHAR2(9000);
    BEGIN
    if :P19_PROJECT_OWNER <> 0 and :P19_PROJECT_OWNER is not null then
    vc_query := 'select * from
    ( select current_status , count , high , medium , low , red , green , yellow , priority_list , ">30 Days" from project_summary where user_id = ' || :P19_PROJECT_OWNER
    || 'union
    select current_status , 0 , 0 , 0 , 0 , 0, 0 , 0, 0, 0 from sr_current_status where current_status not in ( select distinct current_status from project_summary where user_id = ' || :P19_PROJECT_OWNER || ')) where current_status not like ''Closed%''';
    else
    vc_query :='select current_status , sum(count) , sum(high) , sum(medium) , sum(low) , sum(red) , sum(green) , sum(yellow) , sum(priority_list) , sum(">30 Days") from project_summary where current_status not like ''Closed%'' group by current_status';
    end if;
    return vc_query;     
    end;
    Edited by: Shijesh Kumar on Jan 29, 2009 12:19 PM

  • HT201320 Does my email service provider have to provide the ability for me to create an IMAP email account in order for me to create Sub-folders within Apple Mail?

    Hi, Apple Mail provides a function to create sub-folders within my mailbox so that I can group emails of similar subjects or from the same sender. My service provider only provides POP email protocol and the New Folder button does not appear in my Apple Mail account for that service provider. Icloud provides the opportunity for the iPad user to select between POP and IMAP. I can select IMAP and the New Folder button appears allowing me to create sub-folders within the icloud email account. Does this mean I cannot create sub-folders in my email account unless my service provider provides customers with the option of creating an IMAP email account?
    This appears to be a problem for quite a few Apple Mail users, but service providers appear reticent to provide a response other than 'use Microsoft Exchange / Hotmail, Google GMail, or some other third party email service provider'. This is why I have chosen icloud as my email service provider. It is Apple and therefore Apple supports it. I have been a Telstra customer for over 15 years and they informed me today, strongly, that they support their own products and services, not Apple products, even though Telstra sell them. When I asked the Telstra Customer Support Manager whether they support Telstra customers, I was informed 'no, because the Telstra customer is not a Telstra product or service'. I have since cancelled my Telstra email account and am in the process of cancelling all of my Telstra services.

    Apple Sceptic wrote:
    Does this mean I cannot create sub-folders in my email account unless my service provider provides customers with the option of creating an IMAP email account?
    Yes. That is what it means. You need an IMAP account in order to create sub folders on the iPad.

  • How can I create a sub-folder within my "Documents" folder?

    How can I create a sub-folder within my "Documents" folder? I have many similar documents that I want to group together. This will also un-clutter my Documents folder.

    Also, you can add a New Folder button to the Finder's toolbar by opening Finder, going to the View menu in the menubar, selecting Customize Toolbar..., and dragging the New Folder icon to the toolbar in the Finder window. Then it's just one-click for new folders wherever you want them.

  • Alv - sub  totals and avg

    Hi gurus,
    I have a problem, please help me out.
    Iam doing an report program with alv display. In that iam calculating the AVG for the workcenter wise for the field TAT.
    please observe my below o/p in general ALv  format.
    work center-- TAT- Tat(Yes/no)
    qm0010------ 1 --  yes
    qm0010-------2 --  yes
    qm0010------ 4 -- yes
    qm0010------ 7 -- No (because >5)
    Subtotal(qm0010)--3  (avg caluculated)
    qm0020--  4 --- yes
    qm0020-7-- No (because >5)
    qm0020--10 - No (because >5)
    qm002010- No (because >5)
    Subtotal(qm0020)-- 7 (avg caluculated).
    this is the rough o/p iam getting . this is acheived by programming the Field catalog for TAT field i.e... do_sum  = 'C'.
    then giving the sort table to REUSE_ALV_GRID_DISPLAY.
    Now my problem is:
    I want the avg to be calcuted by the business formula which is:
    avg  =  sum of(TAT within 5 days) / total no of the entries .
    Ex:
    work center-- TAT- Tat(Yes/no)
    qm0010------ 1 --  yes
    qm0010-------2 --  yes
    qm0010------ 4 -- yes
    qm0010------ 7 -- No (because >5)
    Subtotal(qm0010)---*7/4=2 (avg caluculated for tat<5)*
    qm0020--  4 --- yes
    qm0020-7-- No (because >5)
    qm0020--10 - No (because >5)
    qm002010- No (because >5)
    Subtotal(qm0020)--4/4=1 (avg caluculated for tat<5).
    How can i acheive the above, since in field catalog and alv, i think we cannot pass any conditions(like for TAT which is less than 5). So is there any other way to acheive the above.
    Please understand the problem and give me(please directly dont suggest any programs , since iam not a expert to understand)..
    Please explain me in detail.  Points will be duly rewarded.
    Thanks in advance........Chaitu
    Edited by: chaitanya on May 30, 2008 12:33 PM
    Edited by: chaitanya on May 30, 2008 12:38 PM
    Edited by: chaitanya on May 30, 2008 12:39 PM

    Hi Chaitanya,
       You can display in your report with totals and sub-totals using alv, but not average. That functionality has not provided by sap. Do one thing add one more extra column Average in your output, do the calculation for average and pass the value in the coding itself. Then last display your report with Average field.
    Rgds,
    Bujji

Maybe you are looking for