Need Grand Totals in cross tab.
Hi All,
I have requirement in Crystal using Cross Tab.
I need to show cummulative sum (Running Totals) for my Measure value.
and at TOTAL i have to show the sum of all those above values..
like...........
IMy data in general is like as below...
IND US
Jan 10 20
Feb 15 10
Mar 15 15
Total 40 45
when I used Running total field for my measure..it would be...
Jan 10 20
Feb 25 30
Mar 40 45
Total 40 45
But, In the second case I need totals as 75 95
i.e, I have to sum of running total feild.
My out put would be as below.
*Jan 10 20*
*Feb 25 30*
*Mar 40 45*
*Total 70 95*
I was able to get Cumulative sum for measure, but am not able to get Total.
Please help to find it out....its very imp for me now
Thanks in advance.
Krishna
Let's try looking at it another way. A runnnig total using the SUM function is essentially adding a numerical value for mulitple rows:
R1 - 5
R2 - 5
R3 - 6
Now if I insert a running total for each detail line, that would calculate the following:
R1 - 5 RunT = 5
R2 - 5 RunT = 10
R3 - 6 RunT = 16
Now I am going to assume that you are grouping your data and resetting your running your total for each group value:
Group 1 - A
R1 - 5 RunT = 5
R2 - 5 RunT = 10
R3 - 6 RunT = 16
Group 1 - B
R1 - 10 RunT = 10
R2 - 10 RunT = 20
R3 - 15 RunT = 35
Group 1 - C
R1 - 8 RunT = 8
R2 - 16 RunT = 24
R3 - 10 RunT = 34
And what your user is asking for is a running total for all rows of all groups:
G1-A 16 RunT = 16
G1-B 35 RunT = 51
G1-C 34 RunT = 85
Instead of trying to sum the individual group running totals, consider creating a separate running total that sums the individual row values without resetting the running total at the group level:
G1A R1 - 5 RunT = 5
G1A R2 - 5 RunT = 10
G1A R3 - 6 RunT = 16
G1B R1 - 10 RunT = 26
G1B R2 - 10 RunT = 36
G1B R3 - 15 RunT = 51
G1C R1 - 8 RunT = 59
G1C R2 - 16 RunT = 75
G1C R3 - 10 RunT = 85
This is essentially the same thing as saying (ABC) + (DEF) + (GHI) which is simply employing the transitive nature of addition.
Fuskie
Who expects if all you care about is the result after processing all the groups, however, it would be easier to just say sum(value)...
Similar Messages
-
Hi All,
I have created a cross tab report and in this report there are 8 sub-totals.
I need to total up the first 7 sub-totals and one more total summing up the first 8 sub-totals. Is there any in-built functions to do this.
Thanks in advance
DhineshLook at the Total Wizard. You should be able select the right options to have totals at different level of the data. Also give us an example what you want to achieve.
-
Both Average and Totals for Cross Tab
Hi, can I have both a total and an average for a cross-tab report?
12/27/2009 100 200 300
12/28/2009 200 300 400
Total 300 500 700
Average 150 250 350
thanks in advanceLook at the Total Wizard. You should be able select the right options to have totals at different level of the data. Also give us an example what you want to achieve.
-
Need a multi-level control break report displaying a cross-tab for each ...
I need a multi-level control break report that displays a cross-tab report for each
detail and subtotal. The individual cross-tabs are no problem. There are two issues:
1) How to get many cross-tabs (thousands) to appear in one report.
2) How to provide cross-tabs in-line on the multi-level subtotal lines.
Here is a concrete example.
Suppose the data base contains this table:
road (
id_number number, -- this is an artificial PK
city varchar2,
county varchar2,
state varchar2,
length number,
owner varchar2, -- roads may be owned by cities, counties, states, and others
surface_type varchar2 -- the surface type may be gravel, asphalt, concrete, and others
The table is populated with several million records that include every
length of road in a US city.
It is OK to suppose that all the attributes in all the records are not null.
Without the PK, there would be millions of duplicates,
which should all contribute to the summed lengths.
The report I need is like a control break report with a detail line for each
city together with subtotals for each county and state and
a grand total for the US at the end.
However, each detail and total line needs to be a cross-tab report
summing the length over the city, county, state or US
(whichever is called for at that location)
for each combination of owner and surface_type.
so the report would have the following structure:
a city cross-tab for the first city in county 1/state 1
a city cross tab for the last city in county 1/state 1
a cross-tab for count 1
a city cross tab for the first city in county 2/state 1
a city cross tab for the last city in county 2/state 1
a cross tab for state 1
a cross-tab for the US
Any suggestions will be appreciated.
This problem comes up because my client's legacy system,
which is being replaced,
already has such a report (in COBOL).
Thanks!!!
Steve
PS, I know one ugly way to do it. Namely, make a variable for each
possible combination of owner and surface. Then code an ordinary control
break report. However, I am looking for something better.Hi Jenna_Fire,
According to your description, you have a matrix contains total for each group on each level. Now your requirement is, when you click on any number (data field or total), it will go to the detail report which returns all the detail information of the people
within the group scope. For example, if you click on the total of Active users in United States, it will return the detail information of Active users in New York and Texas. Right?
In this scenario, we should set the parameter (@Country, @State, @City) allow multiple values in both main and detail report. And in Default Value (@Country, @State, @City), query out all distinct values. In the textbox which contains
those total values, when set use these parameters to run the report, we only need to pass the parameters of parent groups. For example, if we click on the total of Active users in New York, we only need to pass Country, State, Status to detail report, and
in the detail report, the City parameter will use all distinct values (Default Values) because we don't pass the City parameter. We have tested this case with sample data in our local environment. Here are steps and screenshots for your reference:
1. Create parameter Country, State, City and Status in both main report and detail report. Set both Available Value and Default Value get values from query (Create a dataset for each parameter, use "select distinct [column] from [table]" as query). Set allow
multiple values for parameter Country, State and City in both reports.
2. In corresponding textbox, pass appropriate parameters in go to report Action.
4. Filter data in detail report (in where clause or using filters).
5. Save and preview. It looks like below:
Reference:
Using Parameters to Connect to Other Reports
If you have any question, please feel free to ask.
Best Regards,
Simon Hou -
Single and Double Underlines When Showing Cross Tab Data
Hi,
I am trying to generate an XML Publisher rtf report in which I need to show the cross tab data which is in number format underlined and totals as double underlined. Is there a way to do that;
I am using XML Publisher 5.6.2 version , Build 45 and I am trying to manage this on Windows XP, Excel 2003 environments.
Thanks and regards.Can you generate a crosstab that looks like you want to show in the Template Builder for Word?
It should generate a separate line - but 5.6.2 is so long ago, I don't remember what the pivot table
wizard did at this time.
Unfortunatley, we do support for text only single underlines - border can have double lines.
Klaus -
BI Publisher Pivot Table or Cross Tab
Hai All,
I have a doubt in developing a Matrix report in XML. I have developed a matrix report in RDF and the output is coming fine in RDF. I have generated the XML file which looks like this. I need to develop the report which displays employee details followed by the allowance which are dynamic.
- <XXHRPRF>
- <LIST_G_SUMRESULT_VALUE>
- <G_SUMRESULT_VALUE>
- <LIST_G_EMPLOYEE_NUMBER>
- <G_EMPLOYEE_NUMBER>
<EMPLOYEE_NUMBER>100026</EMPLOYEE_NUMBER>
<PERSON_ID>80</PERSON_ID>
<NATIONALITY>USA</NATIONALITY>
<NATIONAL_IDENTIFIER />
<UNIFIED_ID />
<FULL_NAME>Thomas H Mathew</FULL_NAME>
<ORGANIZATION_NAME>Corporate Affairs</ORGANIZATION_NAME>
<PENSION_FUND_ID />
<CS_SNO>1</CS_SNO>
<CF_PENSION_CONTRIBUTION>3637.5</CF_PENSION_CONTRIBUTION>
<CP_PENSION_COMP_CONTR>10912.5</CP_PENSION_COMP_CONTR>
<CP_TOTAL_SALARY>72750</CP_TOTAL_SALARY>
<CF_TOTAL_CONTRIBUTION>14550</CF_TOTAL_CONTRIBUTION>
- <LIST_G_ELEMENT_NAME>
- <G_ELEMENT_NAME>
<TAG>1</TAG>
<ELEMENT_NAME>Basic Salary</ELEMENT_NAME>
- <LIST_G_PERSON_ID>
- <G_PERSON_ID>
<RESULT_VALUE>39650</RESULT_VALUE>
</G_PERSON_ID>
</LIST_G_PERSON_ID>
</G_ELEMENT_NAME>
- <G_ELEMENT_NAME>
<TAG>2</TAG>
<ELEMENT_NAME>Housing Allowance</ELEMENT_NAME>
- <LIST_G_PERSON_ID>
- <G_PERSON_ID>
<RESULT_VALUE>25000</RESULT_VALUE>
</G_PERSON_ID>
</LIST_G_PERSON_ID>
</G_ELEMENT_NAME>
- <G_ELEMENT_NAME>
<TAG>3</TAG>
<ELEMENT_NAME>Child allowance</ELEMENT_NAME>
<LIST_G_PERSON_ID />
</G_ELEMENT_NAME>
- <G_ELEMENT_NAME>
<TAG>4</TAG>
<ELEMENT_NAME>Social allowance</ELEMENT_NAME>
- <LIST_G_PERSON_ID>
- <G_PERSON_ID>
<RESULT_VALUE>700</RESULT_VALUE>
</G_PERSON_ID>
</LIST_G_PERSON_ID>
</G_ELEMENT_NAME>
- <G_ELEMENT_NAME>
<TAG>5</TAG>
<ELEMENT_NAME>Excess Allowance</ELEMENT_NAME>
<LIST_G_PERSON_ID />
</G_ELEMENT_NAME>
- <G_ELEMENT_NAME>
<TAG>6</TAG>
<ELEMENT_NAME>Additional</ELEMENT_NAME>
- <LIST_G_PERSON_ID>
- <G_PERSON_ID>
<RESULT_VALUE>7400</RESULT_VALUE>
</G_PERSON_ID>
</LIST_G_PERSON_ID>
</G_ELEMENT_NAME>
</LIST_G_ELEMENT_NAME>
</G_EMPLOYEE_NUMBER>
- <G_EMPLOYEE_NUMBER>
<EMPLOYEE_NUMBER>100030</EMPLOYEE_NUMBER>
<PERSON_ID>82</PERSON_ID>
<NATIONALITY>Canada</NATIONALITY>
<NATIONAL_IDENTIFIER />
<UNIFIED_ID />
<FULL_NAME>Sara Wilson</FULL_NAME>
<ORGANIZATION_NAME>Human Resources</ORGANIZATION_NAME>
<PENSION_FUND_ID />
<CS_SNO>2</CS_SNO>
<CF_PENSION_CONTRIBUTION>1203.75</CF_PENSION_CONTRIBUTION>
<CP_PENSION_COMP_CONTR>3611.25</CP_PENSION_COMP_CONTR>
<CP_TOTAL_SALARY>316575</CP_TOTAL_SALARY>
<CF_TOTAL_CONTRIBUTION>4815</CF_TOTAL_CONTRIBUTION>
- <LIST_G_ELEMENT_NAME>
- <G_ELEMENT_NAME>
<TAG>1</TAG>
<ELEMENT_NAME>Basic Salary</ELEMENT_NAME>
- <LIST_G_PERSON_ID>
- <G_PERSON_ID>
<RESULT_VALUE>19600</RESULT_VALUE>
</G_PERSON_ID>
</LIST_G_PERSON_ID>
</G_ELEMENT_NAME>
- <G_ELEMENT_NAME>
<TAG>2</TAG>
<ELEMENT_NAME>Housing Allowance</ELEMENT_NAME>
- <LIST_G_PERSON_ID>
- <G_PERSON_ID>
<RESULT_VALUE>22500</RESULT_VALUE>
</G_PERSON_ID>
</LIST_G_PERSON_ID>
</G_ELEMENT_NAME>
- <G_ELEMENT_NAME>
<TAG>3</TAG>
<ELEMENT_NAME>Child allowance</ELEMENT_NAME>
- <LIST_G_PERSON_ID>
- <G_PERSON_ID>
<RESULT_VALUE>600</RESULT_VALUE>
</G_PERSON_ID>
</LIST_G_PERSON_ID>
</G_ELEMENT_NAME>
- <G_ELEMENT_NAME>
<TAG>4</TAG>
<ELEMENT_NAME>Social allowance</ELEMENT_NAME>
- <LIST_G_PERSON_ID>
- <G_PERSON_ID>
<RESULT_VALUE>800</RESULT_VALUE>
</G_PERSON_ID>
</LIST_G_PERSON_ID>
</G_ELEMENT_NAME>
- <G_ELEMENT_NAME>
<TAG>5</TAG>
<ELEMENT_NAME>Excess Allowance</ELEMENT_NAME>
<LIST_G_PERSON_ID />
</G_ELEMENT_NAME>
- <G_ELEMENT_NAME>
<TAG>6</TAG>
<ELEMENT_NAME>Additional</ELEMENT_NAME>
- <LIST_G_PERSON_ID>
- <G_PERSON_ID>
<RESULT_VALUE>3075</RESULT_VALUE>
</G_PERSON_ID>
</LIST_G_PERSON_ID>
</G_ELEMENT_NAME>
</LIST_G_ELEMENT_NAME>
</LIST_G_EMPLOYEE_NUMBER>
</G_SUMRESULT_VALUE>
</LIST_G_SUMRESULT_VALUE>
<CF_PERIOD>MAR-2009</CF_PERIOD>
- <XXHRPRF>
I need to develop a cross tab format in RTF using template builder. Can we get this in matrix report using the standard wizard given in template builder or else it should be done manual. If it can be done through wizard can u please explain the process.
And one more think what is the latest version of template builder available. In few cases its given as pivot table and in few its given as cross tab. I confused by that.
This seems to be basic doubt, but please guide me.
Regardsi,
I am developing cross tab report with group in BI Publisher(i.e matrix with group above report in report builder).
My req.is
Country1
region1 region2 region3 --- (level1 column)
d1 d2 d3 d1 d2 d3 d1 d2 d3 --(level2 column)
Row1 10 15 18 24 38 40 36 35 78 --data
Row2 -- -- -- --- --- -- - -- -- --
regions(level1 columns) and d1,d2,d3(level2 columns) are data depenent on XML data.
d1,d2 d3 may change in number based on data.Also we have page break on country.
We could able to achieve in report builder but in Bi Publisher we are unable to achieve the same.
Wizard in BI Publisher gives only one level of measure(region) only.
Currently we are using BI Publisher template builder version 10.1.3.2.1
Need help in this regard ASAP.
Thanks in advance. -
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 -
HOW TO GET THE GRAND TOTALS IN ALV USING GRID FM
Hi,
I would like to know that am getting the sub totals using the ALV_GRID FM,
But I need Grand totals how i can get and what is the paramater to keep = x to get this Grand totals\.Hi,
If you have the DO_SUM = 'X' in the field catalog internal table for the corresponding column..Then you will get the grand total..
Thanks,
Naren -
Hi There
I need to create 3 cross tabs in one crystal report with different condition, how i can do that?
for example, in one cross tab, i only want to show last year's information, in another one, i want to show this year's information
is there a way i can add some condition with the cross tab?
thanksI think what Ian means is....
Right now you have you cross tab set this way..
2008 2009
Location1
Location2
Location3
He wants you to switch rows to cloumns and make the Year your first Group.
Then you'll have
Location1 Location2 Location3
2008
2009
This way all your locations show up in your cross-tab.
Hope this makes sense.... -
Cross tab on quarter (date) parameter
Post Author: tomahawk
CA Forum: Charts and Graphs
I need to design a cross tab report where the column is a certain date field (say date1). However, the report is a quarterly report, so the columns should be for each quarter (date1 falling in a particular quarter). The user wants to select the quarter from a drop down parameter box at runtime. How do i set the condition/formula for the cross tab to display details for the quarter that the user selected?
Please help urgently.
Thanks
TomPost Author: sleahcim
CA Forum: Charts and Graphs
Hi Tom,
While there may be some method to do it by playing around with the formatting, you're likely to get it done quicker by creating a formula for your quarters, and swapping that field into your crosstab. Here's a sample report that shows you how to create a quarter formula.
-Michael -
Grand total (of all columns) in ALV grid
Hi Experts,
I have developed one custom ALV report in GRID format. Now Report output is displaying like below.
COL1 | COL2 | COL3 | COL4 |
TYPE1 | 10 | 44 | 05 |
TYPE2 | 01 | 20 | 35 |
TYPE3 | 05 | 10 | 20 |
=============================
sum | 16 | 74 | 50 |
But I need Grand Total for COL2 and COL3 and COL4 (i.e 16 + 74 + 50 )
This grand total line should be at the end of the internal table -- 140 .
The report output should be like below.....
COL1 | COL2 | COL3 | COL4 |
TYPE1 | 10 | 44 | 05 |
TYPE2 | 01 | 20 | 35 |
TYPE3 | 05 | 10 | 20 |
=============================
sum | 16 | 74 | 50 | ====> this sum will displayed when user select sum button on the Grid toolbar.
=============================
Grand Total 140 |
Suppose when I press sum button on the COL2. it should not change grand total. I mean Grand total should be like footer always.
Please advise
Thanks in advance.
RaghuHi
For your requirment ,you have to fill the field catalog for each field for which
you have to create the the grand total and check the option DO_SUM.
If you neeed the sub total ,in the sort table you can check the option- fs_sort-subtot = 'X'.
Just try the belo code .
It will solve your problem.
REPORT ztest.
* INTERNAL TABLE DECLARATION.
DATA:
t_sflight TYPE TABLE OF sflight,
fs_sflight TYPE sflight.
*OBJECTS FOR CONTAINER AND GRID.
DATA:
r_container1 TYPE REF TO cl_gui_custom_container,
r_grid1 TYPE REF TO cl_gui_alv_grid.
*FIELD CATALOG
DATA:
t_fcat TYPE lvc_t_fcat,
fs_fcat TYPE lvc_s_fcat.
fs_fcat-fieldname = 'SEATSMAX'.
fs_fcat-do_sum = 'X'.
APPEND fs_fcat TO t_fcat.
CLEAR fs_fcat.
fs_fcat-fieldname = 'PRICE'.
fs_fcat-do_sum = 'X'.
APPEND fs_fcat TO t_fcat.
CLEAR fs_fcat.
* SORT TABLE
DATA:
t_sort TYPE lvc_t_sort,
fs_sort TYPE lvc_s_sort.
* LAYOUT TABLE
DATA:
fs_layo TYPE lvc_s_layo.
*FS_LAYO-SGL_CLK_HD = 'X'.
fs_layo-zebra = 'X'.
fs_sort-spos ='1'.
fs_sort-fieldname = 'CARRID'.
fs_sort-down = 'X'.
fs_sort-group = '*'.
*fs_sort-subtot = 'X'.
APPEND fs_sort TO t_sort.
SELECT * FROM sflight INTO TABLE t_sflight.
CALL SCREEN 100.
*& Module STATUS_0100 OUTPUT
* text
MODULE status_0100 OUTPUT.
SET PF-STATUS 'SCREEN1'.
SET TITLEBAR 'TITLE1'.
ENDMODULE. " STATUS_0100 OUTPUT
*& Module USER_COMMAND_0100 INPUT
* text
MODULE user_command_0100 INPUT.
CASE sy-ucomm.
WHEN 'BACK'.
LEAVE TO SCREEN 0.
ENDCASE.
ENDMODULE. "user_command_0100 INPUT
**& Module HANDLER OUTPUT
** text
MODULE header OUTPUT.
CREATE OBJECT r_container1
EXPORTING
container_name = 'CONTAINER'.
CREATE OBJECT r_grid1
EXPORTING
i_parent = r_container1.
CALL METHOD r_grid1->set_table_for_first_display
EXPORTING
is_layout = fs_layo
i_structure_name = 'SFLIGHT'
CHANGING
it_fieldcatalog = t_fcat
it_outtab = t_sflight
it_sort = t_sort.
ENDMODULE. "Header OUTPUT
Regards
Hareesh. -
Dear users,
I have a query as below:
select a$acct$company company,
a$period_name "Period Name",
a$acct$location location,
a$acct$prime_sub "Prime Sub",
sum (balance) balance
from apps_rpt.us_gl_balances
where a$acct$prime_sub between '300001' and '313099'
and a$period_name = 'DEC-01'
and a$acct$company in ('5110')
group by a$period_name, a$acct$location, a$acct$company, a$acct$prime_sub
order by a$acct$prime_sub;
Sample output of the above query is:
COMPANY Period Name LOCATION Prime Sub BALANCE
5110 DEC-01 50008 300001 0.00
5110 DEC-01 52424 300001 0.00
5110 DEC-01 52513 300001 0.00
5110 DEC-01 50008 300008 201315.00
5110 DEC-01 50095 300008 10403.17
5110 DEC-01 50107 300008 0.00
5110 DEC-01 50108 300008 -1099236.04
5110 DEC-01 50180 300008 0.00
5110 DEC-01 51628 300008 -6396.02
5110 DEC-01 51734 300008 -5896.51
5110 DEC-01 51735 300008 -8525.78
5110 DEC-01 52423 300008 -7268.64
5110 DEC-01 52424 300008 -6945.65
5110 DEC-01 52428 300008 -7845.70
5110 DEC-01 52513 300008 -11309.44
5110 DEC-01 52514 300008 -10272.08
5110 DEC-01 52515 300008 -3861.72
5110 DEC-01 52516 300008 -6685.85I need to write a cross tab query whose output should be some thing as below:
300001 300008
50008 0 201315.00
52424 0 -6945.65
52513 0 -11309.44
50095 0 10403.17
50107 0 0
50108 0 -1099236.04
50180 0 0
51628 0 -6396.02
51734 0 -5896.51
51735 0 -8525.78
52423 0 -7268.64
52428 0 -7845.70
52514 0 -10272.08
52515 0 -3861.72
52516 0 -6685.85from the above cross tab results 300001 and 300008 are Prime Sub and the amount shown is Balance. The columns to the left side is Location. Company and Period Name remain the same for all the rows.
It would great if some one can assist me in writing a cross tab query to display results as shown above.
Thanks
SandeepFrank,
Thanks for your reply. I Tried your method of Dynamic Pivot, but its not working.
My dynamic_pivot_subscript.sql script is :
SELECT DISTINCT
', MAX(DECODE(PRIME_SUB,'|| PRIME_SUB||',' AS txt1,
'BALANCE,0)) AS '||prime_sub AS txt2
FROM
SELECT a$acct$location AS LOCATION
, a$acct$prime_sub AS PRIME_SUB
, SUM(BALANCE) AS BALANCE
FROM apps_rpt.us_gl_balances
WHERE a$acct$prime_sub BETWEEN '300001' AND '313099'
AND a$period_name = 'DEC-01'
AND a$acct$company IN ('5110')
GROUP BY a$acct$location,a$acct$prime_sub
);Sql Plus session is as follows :
-- Restore SQL*Plus features suppressed earlier
SET FEEDBACK ON
SET PAGESIZE 50
SPOOL p:\sql\cookbook\dynamic_pivot.lst
select LOCATION
@@dynamic_pivot_subscript
from
SELECT a$acct$location AS LOCATION
, a$acct$prime_sub AS PRIME_SUB
, SUM(BALANCE) AS BALANCE
FROM apps_rpt.us_gl_balances
WHERE a$acct$prime_sub BETWEEN '300001' AND '313099'
AND a$period_name = 'DEC-01'
AND a$acct$company IN ('5110')
GROUP BY a$acct$location,a$acct$prime_sub
GROUP BY LOCATION
SPOOL OFFWhen i use sql plus session then its giving me the following error:
@@dynamic_pivot_subscript
ERROR at line 2:
ORA-02019: connection description for remote database not found
(1) The version of Oracle (and any other relevant software) you're using
Ans :
Oracle8i Enterprise Edition Release 8.1.7.4.0 - 64bit Production
With the Partitioning option
JServer Release 8.1.7.4.0 - 64bit Production
I either use Toad or Sql Navigator -
Cross Tab Grand Total Out Of Line When Exporting to Excel Data Only
Does anyone have a solution to this issue:
Setting up a cross tab report with a grand-total field at the end of it and exporting to Excel Data Only format, moves the grand total values one column to the right of where the should be.
eg:
Company Month Revenue Total
Acme 200710 1000.00 1000.00
Indigo 200710 2000.00 2000.00
Total 3000.00 3000.00
Thanx for any input - looks better in fixed font.
the 2nd 3000.00 appears to the right of the Total column and not under itPost Author: swat
CA Forum: Exporting
Hi,
Of what i gather from ur scenario...this is what i did in one of my reports.
I had to use two subreports and they had to occupy one cell each, in line with other fields.
To obtain that,all the fields required in the subreport i put them into a text box.Therein restricting the fields to the txt box only...
Then import that sub-report as it is.
It worked for me....
try out...
All this only if've understood u right... -
Hi
I created a cross tab report, i am using total in all summarized filed but i need to divide my total values into sub group wise in total filed.
like total product 3000
Sales 1000
Net profit 700
but its totaling as 4700, but i need to do as different group wise totals,The values showing in each group is itself sub group total and the grand total will be the sum of all these totals. Pleas let me know what exactly the output you are expecting?
Regards,
Raghavendra -
I built a cross tab report using the wizard from BI pub plug-in. It is selecting counts of employees by building that are Male, Female and Total (see below). My XML data has all 3 counts in it (Male, Female,Total) so I just selected them for the BI report. The only issue I have is the grand totals that show on the far right. I need it to only total the "male" and "female" totals (instead of all 3). This is making the numbers doubled in the total.
It is using this in the cell and I am wondering if there is a way to only let it total specific columns
<?./T1?>
Building1____________________Building2___________________Total
Female___Male___Totals_______Female_____Male_____Total___
1_______5______6___________4_________2_______6_______24
Thanks.Look at the Total Wizard. You should be able select the right options to have totals at different level of the data. Also give us an example what you want to achieve.
Maybe you are looking for
-
Hello all. System will not boot and before I go spending more money on pointless items, I was hoping to get some feedback, please. Here are current specs on system: MSI K8T Neo2 FIR - AMI BIOS 9.4 Athlon 64 X2 4600+ PIB Antec NeoPower 480 +5V/38A +
-
Is there a way to create a Cairngorm "template" Project?
Would it be possible to create a template for Cairngorm-based Flex projects, since they all have the same general architecture?: /src /control/events /control/commands /control/Controller.as /control/Services.mxml /model/ModelLocator.as /valueObjects
-
Current date in JSP in specific format....
I want to view the current date on a JSP in the format YYYY-MM-DD I know how to get the current date <%= new Date()%> But how can I get the current date in the format specified above. Any help please??
-
I want to know how I can tell if apple got my iphone for its repair?
I accidentally sent my iphone for repairs using usps instead of FedEx. So I don't know if apple has received my phone yet. I keep checking my repair status and all it says is empty box shipped.
-
Unable to view/download recently purchased TV series on laptop
Unable to view/download recently purchased tv series on laptop. When I got to my profile it is listed in the purchase history but is not viewable to download in my recently purchased items. Also not available on the cloud to download.