How to create a sub total and grand total using my query.
How can I create a sub total for each section and grand total for using my query like this. your help is appreciated. I am working with 9g
WITH BidItemsInformation AS
( SELECT DISTINCT q.iplineno "Line Number", q.section "Section Number",
i.item "Item Number",
initcap(i.idescr) "Description" ,
i.iunits "Unit",
q.qty "Quantity" ,q.price "Engineers Unit Price",
(q.price * q.qty) "Engineers Estimate"
FROM letprop l,
proposal p,
propitem q,
bidlet b,
bidtabs c,
itemlist i,
vendor v,
bidders d
WHERE(l.letting = b.letting
And b.letting = c.letting
And p.cspecyr = i.ispecyr)
AND q.prpitem = i.item
AND p.contid = l.lcontid
AND q.contid = p.contid
AND c.vendor = l.avendor
AND l.CALL = c.CALL
AND q.lineflag = c.lineflag
AND q.iplineno = c.iplineno
AND l.letting = d.letting
AND c.letting = l.letting
AND c.CALL = d.CALL
AND v.vendor = d.vendor
-- AND AND l.letstat = 'A'
AND c.lineflag = 'L'
AND l.letting ='&letting'
AND l.CALL = '&call'
), BiddersInformation AS
-- This is where you make your changes for vendor name and vendor number Do not touch the above code
-- It is always the same for any call number and letting date
( SELECT IPLINENO "BLine Number",
MAX(CASE WHEN VENDOR='K020' THEN bidprice ELSE NULL END) "K020:: Unit Price",
MAX(CASE WHEN VENDOR='K020' THEN bidprice ELSE NULL END) K,
MAX(CASE WHEN VENDOR='H438' THEN bidprice ELSE NULL END) "H438:: Unit Price",
MAX(CASE WHEN VENDOR='H438' THEN bidprice ELSE NULL END) H,
MAX(CASE WHEN VENDOR='U010' THEN bidprice ELSE NULL END) "U010:: Unit Price",
MAX(CASE WHEN VENDOR='U010' THEN bidprice ELSE NULL END) U,
MAX(CASE WHEN VENDOR='G110' THEN bidprice ELSE NULL END) "G110:: Unit Price",
MAX(CASE WHEN VENDOR='G110' THEN bidprice ELSE NULL END) G,
MAX(CASE WHEN VENDOR='H530' THEN bidprice ELSE NULL END) "H530:: Unit Price",
MAX(CASE WHEN VENDOR='H530' THEN bidprice ELSE NULL END) H1
FROM BIDTABS
WHERE LETTING='&letting'
AND CALL='&call'
AND BIDPRICE <> 0
GROUP BY IPLINENO
SELECT BidItemsInformation."Line Number",
BidItemsInformation."Section Number",
BidItemsInformation."Item Number",
BidItemsInformation."Description",
BidItemsInformation."Unit",
BidItemsInformation."Quantity",
BidItemsInformation."Engineers Unit Price",
BidItemsInformation."Engineers Estimate",
BiddersInformation."K020:: Unit Price",
(BidItemsInformation."Quantity" * K) "KGM CONTRACTORS INC",
BiddersInformation."H438:: Unit Price",
(BidItemsInformation."Quantity" * H) "HOFFMAN CONSTRUCTION COMPAN",
BiddersInformation."U010:: Unit Price",
(BidItemsInformation."Quantity" * U) "ULLAND BROTHERS INC",
BiddersInformation."G110:: Unit Price",
(BidItemsInformation."Quantity" * G) "GLADEN CONSTRUCTION INC",
BiddersInformation."H530:: Unit Price",
(BidItemsInformation."Quantity" * H1) "HOOVER CONSTRUCTION CO"
FROM BidItemsInformation,BiddersInformation
WHERE BidItemsInformation."Line Number" = BiddersInformation."BLine Number";
Line Number Section Number Item Number Description Unit Quantity Engineers Unit Price Engineers Estimate K020:: Unit Price
0010 0001 2011601/00003 Construction Surveying LS 1 143,000 143,000 75,000 75,000 67,080 67,080
0013 0001 2013601/00010 Survey Equipment LS 1 25,000 25,000 25,000 25,000 30,000 30,000
0020 0001 2015601/00030 Blast Monitor/Survey LS 1 50,000 50,000 30,000 30,000 35,000 35,000
0030 0001 2021501/00010 Mobilization LS 1 382,250 382,250 809,000 809,000 704,000 704,000
0040 0001 2021602/00010 Well Survey EACH 60 500 30,000 2,150 129,000 1,600 96,000
0050 0001 2031501/00040 Field Office Type D EACH 1 6,367 6,367 4,000 4,000 25,000 25,000
sub total:
1610 0002 2401501/01143 Structural Concrete (1a43) C Y 46 350 16,100 408 18,768 400 18,400
1620 0002 2401501/01362 Structural Concrete (1c62) C Y 68 200 13,600 204 13,872 200 13,600
1630 0002 2401501/03643 Structural Concrete (3y43) C Y 60 600 36,000 592 35,520 580 34,800
1640 0002 2401512/03633 Bridge Slab Concrete (3y33) S F 1,876 24 45,024 28 51,778 27 50,652
1650 0002 2401521/00030 Structure Excavation Class R C Y 17 125 2,125 1,000 17,000 500 8,500
1660 0002 2401541/00010 Reinforcement Bars LB 2,490 2 3,735 1 3,312 1 3,237
1670 0002 2401541/00011 Reinforcement Bars (Epoxy Coated) LB 12,380 2 18,570 1 17,703 1 17,332
1680 0002 2401601/00010 Structure Excavation LS 1 2,500 2,500 2,000 2,000 5,000 5,000
1690 0002 2402583/00020 Ornamental Metal Railing Type Special L F 284 150 42,600 194 55,096 190 53,960
sub total
1820 0003 2401513/00346 Type Curb Railing Concrete (3y46) L F 135 25 3,375 16 2,093 15 2,025
1830 0003 2401513/07447 Type Mod P-4 (Tl-4) Railing Conc (3y46) L F 302 85 25,670 72 21,593 70 21,140
1840 0003 2401541/00010 Reinforcement Bars LB 14,780 1 18,475 1 13,598 1 13,302
1850 0003 2401541/00011 Reinforcement Bars (Epoxy Coated) LB 76,720 1 103,572 1 85,926 1 84,392
1860 0003 2401601/00010 Structure Excavation LS 1 10,000 10,000 116,000 116,000 115,000 115,000
1870 0003 2402583/00020 Ornamental Metal Railing Type Special L F 132 150 19,800 184 24,288 180 23,760
sub total
total
You can accomplish that using decode with the grouping function. It returns 1 when that column passed as argument was grouped (or is in some total) and 0 otherwise.
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> with t as
2 (select 'New York' city, 'US' country, 1 num from dual
3 union all select 'Los Angeles' city, 'US' country, 2 num from dual
4 union all select 'London' city, 'GB' country, 2 num from dual
5 union all select 'London' city, 'GB' country, 2 num from dual
6 union all select 'London' city, 'GB' country, 7 num from dual)
7 select decode(grouping(country), 0, country, 'GRAND TOTAL') country,
8 decode(grouping(city), 0, city, decode(grouping(country), 0, 'SUBTOTAL')) city,
9 sum(num) num_total
10 from t
11 group by rollup(country, city)
12 /
COUNTRY CITY NUM_TOTAL
GB London 11
GB SUBTOTAL 11
US New York 1
US Los Angeles 2
US SUBTOTAL 3
GRAND TOTAL 14
6 linhas selecionadas.
SQL>
Similar Messages
-
Urgent : how to calculate sub total and grand total in smart forms
Hi Friens..how to calculate sub total and grand total in smart forms..How to print them in smart forms...Also kindly explain how to handle events in smart forms..Thanks in advance
Re: Subtotal with Table Node in smartforms
-
How to create table.maint.generator and enduser should use using ztcode
Hi,
can any one guide me how to create table maintanence generator and after creating,enduser must use using ztcode.
any help can be appreciated.
Thanks & Regards,
Sandeep.Hi,
Table Maintenance generator is required to do Manual entries in the Table. If the requirement is to update the table only programmatically and not manually then table maint. generator is not required.
Manual entries in table can be maintained ( New record can be inserted / existing can be modified ) using transaction SM 30, if the table maintenance for the table is generated.
How to activate Table maint.
Goto SE11 and open the table.
Click UTILITIES -> Table Maint. Generator, Enter the details and click on Save. Then activate the table.
chk a sample 1.
refer.
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/abap/how%20to%20implement%20events%20in%20table%20maintenance.doc
some more helps
Check out this thread:
table maintenance
http://help.sap.com/saphelp_erp2005/helpdata/en/a7/513520407a11d1893b0000e8323c4f/frameset.htm - a link for basics on Table Maintenance.
Also, Check out this weblog on table maintenance:
/people/sudheer.cheedella/blog/2006/02/20/extracting-data-in-table-maintenance
<b>how to create a a T-code of that</b>
Go to se93.
Then create the new T.code.
Under that select parameter Transaction.
Then give the sm30 in the t.code in default values tab.
check the checkbox skip initial screen.
in classification tab.
click checkbox inherit gui attributes..
Now below..
In the default values..
WRITE
viewname = give ur table name.
show = X
save and check it once...
now u can able to call ur table through ur new t.code...
rgds
anver
if hlped pls mark points -
Help regarding how to show total and grand total
hi all
please help me to show the total / grand total fund wise
i m giving final output that i want
which functions may i use .
following is my query
SELECT MUT_NAME , NATURE , BROK_TYPE ,sum(BROKERAGE) brokerage FROM (
SELECT MUT_NAME , NATURE , BROK_TYPE ,BROKERAGE FROM (
select mf.mut_name , si.nature ,'UPFRONT' BROK_TYPE , sum(up1.paid_brok) BROKERAGE from upfront_paid up , upfront_paid_dtl upd , upfront_pr up1 , scheme_info si , mut_fund mf
where up.slab_id = upd.slab_id
and up.SLAB_ID = up1.paid_slab_id
and up.sch_code = si.sch_code
and si.mut_code = mf.mut_code
-- and si.mut_code = 'MF004'
group by grouping sets ( (mf.mut_name , si.nature) ) ROLLUP(MF.MUT_NAME,SI.NATURE)
UNION ALL
select mf.mut_name , si.nature ,'TRAIL' BROK_TYPE , sum(up1.paid_brok) BROKERAGE from TRAIL_paid up , TRAIL_paid_dtl upd , TRAIL_pr up1 , scheme_info si , mut_fund mf
where up.slab_id = upd.slab_id
and up.SLAB_ID = up1.paid_slab_id
and up.sch_code = si.sch_code
and si.mut_code = mf.mut_code
-- and si.mut_code = 'MF004'
group by grouping sets ( (mf.mut_name , si.nature) ) ) ROLLUP(MF.MUT_NAME,SI.NATURE)
UNION ALL
SELECT 'TOTAL ' MUT_NAME , ' ' NATURE , ' ' BROK_TYPE ,SUM(BROKERAGE) FROM (
select mf.mut_name , si.nature ,'UPFRONT' BROK_TYPE , sum(up1.paid_brok) BROKERAGE
from upfront_paid up , upfront_paid_dtl upd , upfront_pr up1 , scheme_info si , mut_fund mf
where up.slab_id = upd.slab_id
and up.SLAB_ID = up1.paid_slab_id
and up.sch_code = si.sch_code
and si.mut_code = mf.mut_code
--and si.mut_code = 'MF004'
group by grouping sets ( (mf.mut_name , si.nature) ) ROLLUP(MF.MUT_NAME,SI.NATURE)
UNION ALL
select mf.mut_name , si.nature ,'TRAIL' BROK_TYPE , sum(up1.paid_brok) BROKERAGE from TRAIL_paid up , TRAIL_paid_dtl upd , TRAIL_pr up1 , scheme_info si , mut_fund mf
where up.slab_id = upd.slab_id
and up.SLAB_ID = up1.paid_slab_id
and up.sch_code = si.sch_code
and si.mut_code = mf.mut_code
-- and si.mut_code = 'MF004'
group by grouping sets ( (mf.mut_name , si.nature) ) ) ROLLUP(MF.MUT_NAME,SI.NATURE)))
GROUP BY grouping sets (MUT_NAME),( NATURE ),( BROK_TYPE)
ORDER BY MUT_NAME , NATURE , BROK_TYPE
Sl. No. Fund House Fund Type Brokerage Type "Type-wise
Commission " Gross Commission
(1) Fidelity Mutual Fund Equity Upfront Commission xxx
Trail xxx
Others xxx
Debt Upfront Commission xxx
Trail xxx
Others xxx
T O T A L : xxxxx
(2) Franklin Templeton Mutual Fund Equity Upfront Commission
Trail
Per Form
AUM Linked
SIP Advance Annual Brokerage
Others
Debt Upfront Commission
Trail
Others
T O T A L : xxxxx
CONSOLIDATED TOTAL COMMISSION : xxxxxany help appriciated.how can i use compute in procedure
actually i am giving the output from query to ref_cursor and from front end ( .NET) they are fetch rows and show the output.
i want output as fallows
fund name -- nature --- brok type --- brokerage
1] fidelity equity upfront 2000
equity trail 1000
debth upfront 1500
debth trail 500
Fidelity 5000
2] abc --
so on hope this clears you
Message was edited by:
Pankaj M -
Page break,sub total and grand total in adobe forms
hi,
In adobe forms, i am displaying purchase order details in table format. internal table contains 150 records but it displaying
only 50 records in single page. how i have to call a new page,how i have to create a page preak and i want to display only
5 records for a page with carry forward,page total and total net value.Hi Sivaprasath,
For the table content to flow onto the next pages please make sure that the outermost subform is NOT with the content property "Positioned".
For having only 5 records per page, you can design a deep structure with fields:
Table 1 (The table which will hold 5 records per page)
Page total
total net value
Have the table type of it defined in the form.
Put the logic for filling the table in such a way that each row of this nested table has 5 records and pagetotal and total net value.
then put it inside a subform and check the checkbox for "rpeat subformt for each data item".
Another way is to use Conditional breaks in Pagination tab.
Thanks and regards,
Priyanka -
Need Help with the Total and Grand Total
Hi All,
I have posted a question couple of days ago regarding the COUNT and AVERAGES, for a minute i thought i got the work around, but the problem still exists. I'm trying to find the average work done and average revenue generated. I have to do this by the location,
employee id , date and the number of hours. Below is a sample for february 2014. I have two averages for the work done AvgWorkDone=(sum of work done/count of workingdays in month), the second one is AverageWorkDone1... which i skewed by multiplying by 16 (since
there are 16 hours in my data per day) Please need help
Year Name
Calendar 2014
Month Of Year Name
Month 2
Row Labels
workdone
STG WORKDONE VW Count
AvgRev
AvgWorkdone
AvgWorkdone1
1
2433.333333
368
1.591304348
6.612318841
105.7971014
1368
2433.333333
368
1.591304348
6.612318841
105.7971014
10AM
0
23
0
0
0
11AM
23.33333333
23
0
1.014492754
16.23188406
12PM
91.66666667
23
0
3.985507246
63.76811594
1PM
58.33333333
23
0
2.536231884
40.57971014
2PM
41.66666667
23
0
1.811594203
28.98550725
3PM
161.6666667
23
0
7.028985507
112.4637681
4PM
176.6666667
23
0
7.68115942
122.8985507
5AM
0
23
25.46086957
0
0
5PM
191.6666667
23
0
8.333333333
133.3333333
6AM
0
23
0
0
0
6PM
450
23
0
19.56521739
313.0434783
7AM
0
23
0
0
0
7PM
618.3333333
23
0
26.88405797
430.1449275
8AM
0
23
0
0
0
8PM
620
23
0
26.95652174
431.3043478
9AM
0
23
0
0
0
Grand Total
2433.333333
368
1.591304348
6.612318841
105.7971014
If you see the above report the number of days are adding upto 368, this causes the Individual Averages to be fine but the GrandToatl of the Average is messed up. If i multiply by 16 the Individual Averages are messed up, but the GrandAverage is coming RIGHT.
Please need help where i can get both the individual and the grand averages right.
SVHi All,
Finally i found a solution. a) I have a time dim from the ware house and its joined to the fact table based on the dateid, since the fact table is getting only the data for the working days , the ware house time dim is showing only those days as count.
b) I created a new time dim in SSAS TIMEDIMSSAS
c) I joined the new TIMEDIMSSAS to the warehouse time dimension and the fact table and created new measure AvgWorkDone over time and Avg Rev over time.
I'm getting what i wanted. BUT here is a new problem , when i select multiple months the grand total (which should be Average is showing wrong average and i'm not sure why), can anyone please help ?
Row Labels
AvgRevenue
AvgWorkDone
1
$4.17
277.6801802
1368
$4.17
277.6801802
February 2014
$1.59
105.7971014
January 2014
$0.97
64.66666667
March 2014
$9.52
634.5512821
Grand Total
$4.17
277.6801802
The values were supposed to be (1.59+.97+9.52)/3=4.02 and NOT 4.17 for Revenue. Similarly for WorkDone (105.79+64.66+634.55)/3=268.33 and NOT 277.68
Please can some one suggest what is going wrong here?
Thanks
SV -
How to create the Export Data and Import Data using flat file interface
Hi,
Request to let me know based on the requirement below on how to export and import data using flat file interface.....
Please provide the steps involved for the same.......
BW/BI - Recovery Process for SNP data.
For each SNP InfoProvider,
create:
1) Export Data:
1.a) Create an export data source, InfoPackage, comm structure, etc. necessary to create an ASCII fixed length flat file on the XI
ctnhsappdata\iface\SCPI063\Out folder for each SNP InfoProvider.
1.b) All fields in each InfoProvider should be exported and included in the flat file.
1.c) A process chain should be created for each InfoProvider with a start event.
1.d) If the file exists on the target drive it should be overwritten.
1.e) The exported data file name should include the InfoProvider technical name.
1.f) Include APO Planning Version, Date of Planning Run, APO Location, Calendar Year/Month, Material and BW Plant as selection criteria.
2) Import Data:
2.a) Create a flat file source system InfoPackage, comm structure, etc. necessary to import ASCII fixed length flat files from the XI
ctnhsappdata\iface\SCPI063\Out folder for each SNP InfoProvider.
2.b) All fields for each InfoProvider should be mapped and imported from the flat file.
2.c) A process chain should be created for each InfoProvider with a start event.
2.d) The file should be archived in the
ctnhsappdata\iface\SCPI063\Archive directory. Each file name should have the date appended in YYYYMMDD format. Each file should be deleted from the \Out directory after it is archived.
Thanks in advance.
TysonHere's some info on working with plists:
http://developer.apple.com/documentation/Cocoa/Conceptual/PropertyLists/Introduc tion/chapter1_section1.html
They can be edited with any text editor. Xcode provides a graphical editor for them - make sure to use the .plist extension so Xcode will recognize it. -
Hai all,
Good day. I am new to Visual C++. I tried and done some simple programs and dialog based programs in MFC application using Visual C++. But when i am trying to do
VC++ smart device win32 smart device project application project, not getting how to add event handler function for button. I tried serial communication in smart device application. i have inserted dialog and in that
no event handler. Can you please guide me to make a project for embedded board in VC++ smart device application.
Thanks & Regards Sasi ................. Go GreenHi kvg,
Thanks for posting in MSDN forum.
From your post, it seem that this issue is better ask to the
Visual Studio Smart Device Development - Native C++ Project forum. I will move your thread to that forum for a better support. Thanks for your understanding.
Best regards,
Shu Hu
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey. -
How to get sub and grand total
Dear all, I have a report which combines the two totals together and and makes one formula. This formula then is filtered according to Group2 (Reason Code).
Group 1 is the same Reason Code however with Specified names. Group2 is the same reason code however with ascending order.
My question is how to make the sub total and grand total of this formula.
Detailed Information:
1: Total One - DistinctCount(Order_no),GroupName2 -- In this Total, the records are counted when Linetype = F
2: Total Two - DistinctCount(Order_no),GroupName2 -- In this Total, the records are counted when Linetype = S
Formula
Whileprintingrecords;
Numbervar x:=0;
Numbervar y:=0;
Numbervar z:=0;
x:={#FOCTC};
y:={#CREDITTC};
z:=x+y;
z;
Now this formula is placed in the footer of the Group2 (Reason Code).
What I would like to do is to have a Group2 Sub Total and Finally Grand Total.
I have tried the Following however it doesn't seem to be working.
I created another formula exactly like above and placed it into the same Group footer however removed the "Numbervar o:=0;" (The numbervar z:=0; in the above case however when I created another formula I created named the variable "o" instead of "z") so that it does not reset it.
Then I placed another formula into the Report Footer with the following code
Whileprintingrecords;
Numbervar o;
Any ideas?
Many thanks
Regards
JehanzebOk sorted, I used another formula like this.
Whileprintingrecords;
Numbervar TJGs;
Numbervar TotalJobs=0;
Numbervar CAvg=0;
TotalJobs := {@TotalFOCCR};
CAvg:= TotalJobs;
TJGs:=TJGs + CAvg;
CAvg
It sorted the issue. -
COMPUTE function: How to get subtotals and GRAND total together?
I am wrtiting a report using SQL and SQL*Plus to get subtotals and a grand total. The COMPUTE function allows me to COMPUTE SUM on a group, but it only gives me subtotals. I'm interested in getting a report with the SUBTOTALS and a final GRAND TOTAL. Can this be done using SQL*Plus?
Here is my current code that gives me subtotals:
COMPUTE SUM LABEL subtotal OF sal ON deptno
SELECT ename, sal, deptno
FROM emp
ORDER BY deptno;
ENAME SAL DEPTNO
CLARK 2450 10
VOLLMAN 5000
MILLER 1300
8750 subtotal
SMITH 800 20
ADAMS 1100
FORD 3000
SCOTT 3000
JONES 2975
10875 subtotal
ALLEN 1600 30
BLAKE 2850
MARTIN 1250
JAMES 950
TURNER 1500
WARD 1250
9400 subtotalHere is the code to give one grand total:
Column DUMMY NOPRINT
COMPUTE SUM OF sal ON DUMMY
BREAK ON DUMMY
SELECT NULL DUMMY, ename, sal, deptno
FROM emp
ORDER BY deptno;
ENAME SAL DEPTNO
CLARK 2450 10
VOLLMAN 5000 10
MILLER 1300 10
SMITH 800 20
ADAMS 1100 20
FORD 3000 20
SCOTT 3000 20
JONES 2975 20
ALLEN 1600 30
BLAKE 2850 30
MARTIN 1250 30
JAMES 950 30
TURNER 1500 30
WARD 1250 30
29025
How can I combine both on one report?Massimo Ruocchio wrote:
Do you like this?I believe OP is looking for both department totals and grand total. Frank already showed how to do it in SQL*Plus. To do it in SQL:
SELECT CASE GROUPING_ID(real_deptno,real_ename)
WHEN 0 then real_ename
WHEN 1 then 'Department ' || real_deptno || ' total'
ELSE 'All department total'
END ename,
SUM(sal),
deptno
FROM (
SELECT deptno real_deptno,
ename real_ename,
sal,
CASE ROW_NUMBER() OVER(PARTITION BY deptno order by ename) WHEN 1 THEN deptno end deptno
FROM emp
GROUP BY GROUPING SETS((),real_deptno,(real_deptno,deptno,real_ename))
ORDER BY real_deptno nulls last,
real_ename nulls last
ENAME SUM(SAL) DEPTNO
CLARK 2450 10
KING 5000
MILLER 1300
Department 10 total 8750
ADAMS 1100 20
FORD 3000
JONES 2975
SCOTT 3000
SMITH 800
Department 20 total 10875
ALLEN 1600 30
ENAME SUM(SAL) DEPTNO
BLAKE 2850
JAMES 950
MARTIN 1250
TURNER 1500
WARD 1250
Department 30 total 9400
All department total 29025
18 rows selected.
SQL> SY. -
Break Total and Section Totals
Hi,
I have a webi report which consist of s section and a break. The report also does a sub total by break and then section. At last we also show grand total.
The report has section of fleet center.
The report has break on driver name.
The report is in drill mode and has drop downs on fleet name and driver name.
From the drop down menu when I select a particular driver to view information-- the webi shows :
Totals by that driver ( there is a break on this field)
Totals by that fleet ( there is a section on this field)
and Grand total :
Since I have selected a single driver information to view ---all the three totals comes out to be same .
The requirement is to hide the other two totals when we select a particular driver information from the drop down so that we only show the driver level totals. I am looking out for a way to hide section and grand totals when we select a particular driver .
Thank You,Hi Wavery,
Thank you for your response. I tried with the property when section is empty checkbox. In my case I still have a section value. My section is not empty. Its just that when I select only a particular driver the totaling information is repeated twice once at the break level, section level and grand total.
I am looking at ways to hide the section total and grand total when we select a particular drive from the drop down so that the redundant information is avoided at section and grand total level.
Let me know if there is a way out on this.
Thank you,
boe user. -
How to do subtotal and grand total as per currency in a tree ALV
Hi Experts,
I am doing a tree ALV for SD output. I met an urgent problem that is how to do subtotal and grand total on the field (netwr) as per currency (waerk) in the tree ALV. I am using below codes to create the tree ALV.
l_tree_container_name = 'CCONTAINER1'.
CREATE OBJECT objCustomContainer
EXPORTING
container_name = l_tree_container_name
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
lifetime_dynpro_dynpro_link = 5.
create tree control
CREATE OBJECT objTree1
EXPORTING
parent = objCustomContainer
node_selection_mode = cl_gui_column_tree=>node_sel_mode_single
item_selection = ' '
no_html_header = 'X'
no_toolbar = ''
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
illegal_node_selection_mode = 5
failed = 6
illegal_column_name = 7.
DATA l_hierarchy_header TYPE treev_hhdr.
call method buildHierarchyHeader
IMPORTING
p_hierarchy_header = l_hierarchy_header.
Build fieldcatalog
call method buildFieldcatalog.
CALL METHOD objTree1->set_table_for_first_display
EXPORTING
is_hierarchy_header = l_hierarchy_header
CHANGING
it_fieldcatalog = l_fieldcatalog
it_outtab = lt_order.
CALL METHOD objTree1->update_calculations.
CALL METHOD objTree1->frontend_update.
filling fieldcatalog,
LS_FIELDCATALOG-FIELDNAME = 'NETWR'.
LS_FIELDCATALOG-SCRTEXT_S = 'Net Value'.
LS_FIELDCATALOG-COL_POS = l_pos.
LS_FIELDCATALOG-OUTPUTLEN = 15.
LS_fieldcatalog-do_dum= 'X'.
LS_FIELDCATALOG-DATATYPE = 'CURR'.
APPEND LS_FIELDCATALOG TO l_FIELDCATALOG.
CLEAR LS_FIELDCATALOG.
l_pos = l_pos + 1.
I could see the subtotal and grandtotal in tree ALV but they are simply sumed up regardless different currency.
Thank you very much for your kindly helps.
Yuhi
good
go through this report and work accordingly.
REPORT ZALV.
TYPE-POOLS: SLIS.
DATA: G_REPID LIKE SY-REPID,
GS_PRINT TYPE SLIS_PRINT_ALV,
GT_LIST_TOP_OF_PAGE TYPE SLIS_T_LISTHEADER,
GT_EVENTS TYPE SLIS_T_EVENT,
GT_SORT TYPE SLIS_T_SORTINFO_ALV,
GS_LAYOUT TYPE SLIS_LAYOUT_ALV,
GT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
FIELDCAT_LN LIKE LINE OF GT_FIELDCAT,
COL_POS TYPE I.
DATA: BEGIN OF ITAB,
FIELD1(5) TYPE C,
FIELD2(5) TYPE C,
FIELD3(5) TYPE P DECIMALS 2,
END OF ITAB.
DATA: BEGIN OF ITAB1 OCCURS 0.
INCLUDE STRUCTURE ITAB.
DATA: END OF ITAB1.
DATA: BEGIN OF ITAB_FIELDCAT OCCURS 0.
INCLUDE STRUCTURE ITAB.
DATA: END OF ITAB_FIELDCAT.
Print Parameters
PARAMETERS:
P_PRINT AS CHECKBOX DEFAULT ' ', "PRINT IMMEDIATE
P_NOSINF AS CHECKBOX DEFAULT 'X', "NO SELECTION INFO
P_NOCOVE AS CHECKBOX DEFAULT ' ', "NO COVER PAGE
P_NONEWP AS CHECKBOX DEFAULT ' ', "NO NEW PAGE
P_NOLINF AS CHECKBOX DEFAULT 'X', "NO PRINT LIST INFO
P_RESERV TYPE I. "NO OF FOOTER LINE
INITIALIZATION.
G_REPID = SY-REPID.
PERFORM PRINT_BUILD USING GS_PRINT. "Print PARAMETERS
START-OF-SELECTION.
TEST DATA
MOVE 'TEST1' TO ITAB1-FIELD1.
MOVE 'TEST1' TO ITAB1-FIELD2.
MOVE '10.00' TO ITAB1-FIELD3.
APPEND ITAB1.
MOVE 'TEST2' TO ITAB1-FIELD1.
MOVE 'TEST2' TO ITAB1-FIELD2.
MOVE '20.00' TO ITAB1-FIELD3.
APPEND ITAB1.
DO 50 TIMES.
APPEND ITAB1.
ENDDO.
END-OF-SELECTION.
PERFORM BUILD.
PERFORM EVENTTAB_BUILD CHANGING GT_EVENTS.
PERFORM COMMENT_BUILD CHANGING GT_LIST_TOP_OF_PAGE.
PERFORM CALL_ALV.
FORM BUILD.
DATA FIELD CATALOG
Explain Field Description to ALV
DATA: FIELDCAT_IN TYPE SLIS_FIELDCAT_ALV.
CLEAR FIELDCAT_IN.
FIELDCAT_LN-FIELDNAME = 'FIELD1'.
FIELDCAT_LN-TABNAME = 'ITAB1'.
*FIELDCAT_LN-NO_OUT = 'X'. "FIELD NOT DISPLAY, CHOOSE FROM LAYOUT
FIELDCAT_LN-KEY = ' '. "SUBTOTAL KEY
FIELDCAT_LN-NO_OUT = ' '.
FIELDCAT_LN-SELTEXT_L = 'HEAD1'.
APPEND FIELDCAT_LN TO GT_FIELDCAT.
CLEAR FIELDCAT_IN.
FIELDCAT_LN-FIELDNAME = 'FIELD2'.
FIELDCAT_LN-TABNAME = 'ITAB1'.
FIELDCAT_LN-NO_OUT = 'X'.
FIELDCAT_LN-SELTEXT_L = 'HEAD2'.
APPEND FIELDCAT_LN TO GT_FIELDCAT.
CLEAR FIELDCAT_IN.
FIELDCAT_LN-FIELDNAME = 'FIELD3'.
FIELDCAT_LN-TABNAME = 'ITAB1'.
FIELDCAT_LN-REF_FIELDNAME = 'MENGE'. "<- REF FIELD IN THE DICTIONNARY
FIELDCAT_LN-REF_TABNAME = 'MSEG'. "<- REF TABLE IN THE DICTIONNARY
FIELDCAT_LN-NO_OUT = ' '.
FIELDCAT_LN-DO_SUM = 'X'. "SUM UPON DISPLAY
APPEND FIELDCAT_LN TO GT_FIELDCAT.
DATA SORTING AND SUBTOTAL
DATA: GS_SORT TYPE SLIS_SORTINFO_ALV.
CLEAR GS_SORT.
GS_SORT-FIELDNAME = 'FIELD1'.
GS_SORT-SPOS = 1.
GS_SORT-UP = 'X'.
GS_SORT-SUBTOT = 'X'.
APPEND GS_SORT TO GT_SORT.
CLEAR GS_SORT.
GS_SORT-FIELDNAME = 'FIELD2'.
GS_SORT-SPOS = 2.
GS_SORT-UP = 'X'.
*GS_SORT-SUBTOT = 'X'.
APPEND GS_SORT TO GT_SORT.
ENDFORM.
FORM CALL_ALV.
ABAP List Viewer
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER =
I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = G_REPID
I_CALLBACK_PF_STATUS_SET = ' '
I_CALLBACK_USER_COMMAND = ' '
I_STRUCTURE_NAME = 'ITAB1'
IS_LAYOUT = GS_LAYOUT
IT_FIELDCAT = GT_FIELDCAT[]
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT = GT_SORT[]
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
I_SAVE = ' '
IS_VARIANT =
IT_EVENTS = GT_EVENTS[]
IT_EVENT_EXIT =
IS_PRINT = GS_PRINT
IS_REPREP_ID =
I_SCREEN_START_COLUMN = 0
I_SCREEN_START_LINE = 0
I_SCREEN_END_COLUMN = 0
I_SCREEN_END_LINE = 0
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
TABLES
T_OUTTAB = ITAB1
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2.
ENDFORM.
HEADER FORM
FORM EVENTTAB_BUILD CHANGING LT_EVENTS TYPE SLIS_T_EVENT.
CONSTANTS:
GC_FORMNAME_TOP_OF_PAGE TYPE SLIS_FORMNAME VALUE 'TOP_OF_PAGE'.
*GC_FORMNAME_END_OF_PAGE TYPE SLIS_FORMNAME VALUE 'END_OF_PAGE'.
DATA: LS_EVENT TYPE SLIS_ALV_EVENT.
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
I_LIST_TYPE = 0
IMPORTING
ET_EVENTS = LT_EVENTS.
READ TABLE LT_EVENTS WITH KEY NAME = SLIS_EV_TOP_OF_PAGE
INTO LS_EVENT.
IF SY-SUBRC = 0.
MOVE GC_FORMNAME_TOP_OF_PAGE TO LS_EVENT-FORM.
APPEND LS_EVENT TO LT_EVENTS.
ENDIF.
define END_OF_PAGE event
READ TABLE LT_EVENTS WITH KEY NAME = SLIS_EV_END_OF_PAGE
INTO LS_EVENT.
IF SY-SUBRC = 0.
MOVE GC_FORMNAME_END_OF_PAGE TO LS_EVENT-FORM.
APPEND LS_EVENT TO LT_EVENTS.
ENDIF.
ENDFORM.
FORM COMMENT_BUILD CHANGING GT_TOP_OF_PAGE TYPE SLIS_T_LISTHEADER.
DATA: GS_LINE TYPE SLIS_LISTHEADER.
CLEAR GS_LINE.
GS_LINE-TYP = 'H'.
GS_LINE-INFO = 'HEADER 1'.
APPEND GS_LINE TO GT_TOP_OF_PAGE.
CLEAR GS_LINE.
GS_LINE-TYP = 'S'.
GS_LINE-KEY = 'STATUS 1'.
GS_LINE-INFO = 'INFO 1'.
APPEND GS_LINE TO GT_TOP_OF_PAGE.
GS_LINE-KEY = 'STATUS 2'.
GS_LINE-INFO = 'INFO 2'.
APPEND GS_LINE TO GT_TOP_OF_PAGE.
CLEAR GS_LINE.
GS_LINE-TYP = 'A'.
GS_LINE-INFO = 'ACTION'.
APPEND GS_LINE TO GT_TOP_OF_PAGE.
ENDFORM.
FORM TOP_OF_PAGE.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
IT_LIST_COMMENTARY = GT_LIST_TOP_OF_PAGE.
WRITE: SY-DATUM, 'Page No', SY-PAGNO LEFT-JUSTIFIED.
ENDFORM.
FORM END_OF_PAGE.
WRITE at (sy-linsz) sy-pagno CENTERED.
ENDFORM.
PRINT SETTINGS
FORM PRINT_BUILD USING LS_PRINT TYPE SLIS_PRINT_ALV.
LS_PRINT-PRINT = P_PRINT. "PRINT IMMEDIATE
LS_PRINT-NO_PRINT_SELINFOS = P_NOSINF. "NO SELECTION INFO
LS_PRINT-NO_COVERPAGE = P_NOCOVE. "NO COVER PAGE
LS_PRINT-NO_NEW_PAGE = P_NONEWP.
LS_PRINT-NO_PRINT_LISTINFOS = P_NOLINF. "NO PRINT LIST INFO
LS_PRINT-RESERVE_LINES = P_RESERV.
ENDFORM.
thanks
mrutyun^ -
How to display subtotal and grand total with a top 10 condistion ?
Hello,
I would like to display a Top 10 list with subtotal for Top 10 and grand total for all the lines.
I succeed to display top 10 subtotal with "calculations/total" parameter but my question is How to display also the grand total for all the lines ?
Thank you in advance.
Best regards
NicolasCalculate Results/not defined gives grand total and calculation / total gives top 10 sum. As far as I know, you can't display both at the same time.
-
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 AMHi arun,
check these links
total and subtotal in alv
ALV SUBTOTAL
Regards,
Anirban -
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
Shivacheck 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
Maybe you are looking for
-
Why can't I print a 3 page pdf document?
I have an HP Laserjet P1102W. I am trying to print a 3 page pdf document. The print preview looks correct but when I go to print it prints a blank first page. The second page prints correctly but the 3rd page won't print at all and I get a error ligh
-
my kids i pod shuffle hardware is not being recognized by my pc....just so happens I have 2 kids and neither ipod will work....I have tried the 5 r's,checked my usb's and everything else works in my usb's, loaded and unloaded the software and nothing
-
I can't seem to send a photo via email without having to type in my password. Can I disable that?
-
Can i transfer stock with transfer order in Inventory management?
Can i transfer stock with transfer order in Inventory management between two storage locations in the same plant?
-
When I try to update the firmware for my WRT54G V5 it is not a .bin file. It is an EFW file. Any suggestions??