Formula in Crosstab to calculate group totals
Hi,
I want to do a cross tab as following:
......................January.................. February.................................->up to current month.......... total per year
................. 2010.....2011............2010.....2011............................................................................2010.....2011
Brian:...........15 .....13....................11..... 17...................................................................................26 .....28
Peter:...........10 ..... 20...................33.....44.................................................................................... 43.....64
Lars............xx.....and so on
I couldn't find a way to calculate the yearly totals. The years are groups. Is there an easy solution which I oversaw? Automatically CR is just calculating a grouplevel 1 total, no seperated group level 2 totals...
I tried to insert a calculated field and to make the "static" formula (which works):
GridValueAt(GetRowPathIndexOf(2, 2010.00), CurrentColumnIndex, CurrentSummaryIndex) +
//GridValueAt(GetRowPathIndexOf(3, 2010.00), CurrentColumnIndex, CurrentSummaryIndex) +
//GridValueAt(GetRowPathIndexOf(4, 2010.00), CurrentColumnIndex, CurrentSummaryIndex) +
//GridValueAt(GetRowPathIndexOf(5, 2010.00), CurrentColumnIndex, CurrentSummaryIndex) +
//GridValueAt(GetRowPathIndexOf(6, 2010.00), CurrentColumnIndex, CurrentSummaryIndex);
dynamic:
local numbervar jahr;
local numbervar i:=0;
for i:= 1 to maximum({@Monat}) do
jahr + GridValueAt(getrowpathindexof(i,2010.00), CurrentColumnIndex, CurrentSummaryIndex);
jahr;
But it the formula is not working. The formula is accepted, but the result is always zero. "0"..
So in case there is an easy way, I am keen to know. But anyway, if there is a mistake in my formula it would be good to know as well.
Thank you and best regards from Berlin
Bernd
Hi Aljun,
thanx for your fast answer. But this is the problem, that CR is not doing the totals out of the box. I want to compare the months results of two or more years.
The out of the box solution is a total per line per group (in this example per January, february, etc.)
I included in the table now how the cross tab is editing it.
I couldn't manage to
......................January..........Total..Jan............. February...........Total Feb.................->up to current month.......... total overall
................. 2010.....2011................................ 2010.....2011..........................................................................................
Brian:...........15 .....13................28.....................11..... 17................28 ...........................................................................54
Peter:...........10 ..... 20...............30......................33.....44................77............................................................................ 107
Lars............xx.....and so on
I want to have a seperated total overall per 2010 and per 2011, not a line total. Probably there exists an very easy solution, but although I tried several hours the only solution I found was the formula which is not working properly. Probably I can calculate the yearly results through a formula, not through grouping?
Anyway I am asking myself why my formula is not working as there are other needs for such a dynamic calculation.
For example:
.............2010...................................................................................................................2011
............January...................February......subtotal....March.to.December.............january........february..........total 2011so far
Ger.......150............................200...................350.........150.......................................120..............180...................300
I want to compare the results of two years and want to calculate a subtotal in the previous according to the current month to be able to compare the current result with the previous' year result.
Do you have a solution?
Thank you and best regards
Bernd
Similar Messages
-
Help with Formula/Placeholder columns for group totals
I have select that is broken into 2 groups (a COMPANY group and a DETAIL group within company). I need to determine the COMPANY group totals based on values in a column in the DETAIL group. I.E. the column is a transaction description and can have up to 15 different values and it did not appear that a summary column would work for what I need. I have currently set up 15 formula columns in the DETAIL group and check the value of the REASON to accumulate totals and return the total to a PLACEHOLDER column (which is numeric and defined in the COMPANY group).
I then report the Placeholder columns at break of COMPANY. This all works fine if I run only one company. If I run with multiple companies the Placeholder columns are used as a running total.
My question is how do I reset the PLACEHOLDER columns at company break if at all, or is there a simpler way to accomplish what I need.
Any and all assistance would be greatly appreciated.
Tom VereeckeIf you are using one placeholder column in different formula columns just ignore the following solution. It will not work in that case. I will post it here if i find out any way to initialize placeholder columns at different groups or anyother way to solve this issue.
I think if you remove placeholder columns and create summary columns at Company Level, that will work. And formula columns will be changed as follows:
Formula Column:
active_total number(10) := 0;
begin
if :status_1 = 'ACTIVE' then
active_total := active_total + 1;
end if;
if :status_2 = 'ACTIVE' then
active_total := active_total + 1;
end if;
if :status_3 = 'ACTIVE' then
active_total := active_total + 1;
end if;
return active_total;
end;
And in summary columns source will be formula columns. And reset the summary columns at Company.
Hope this helps.
Message was edited by:
fs -
Hi,
I have sql query which gives output of accounts and balance.
I have designed report to show chart of accounts and their balances.
How can I take group total fields to show sum of each level of accounts.
Level
Account
Header 3
Header 4
Header 5
Header 6
Header 7
1
Revenue
2300
2
Direct Income
300
3
Sales
300
4
Sales
300
5
In Store Sales
100
5
Online Sales
200
2
Indirect Income
2000
3
Interest
1100
4
Bank Interest
1100
5
Bank Interest A
400
5
Bank Interest B
700
3
Other Income
900
4
Other Income
900
5
Other Income
900
In my reports I have taken all the accounts and balances in five detail sections.
I want to create formula to show level wise addition of account balances.
Please reply.Thanks.Hi,
Try this code
{Level}=1 then {Header 3}
else if {Level}=2 then {Header 4}
else if {Level}=3 then {Header 5}
else if {Level}=4 then {Header 6}
else if {Level}=5 then {Header 7} -
Weekly Group Total and associated YTD total
Hello,
I need to show current week group total and total year to date of the same group. My columns are Model, Department, Issue. Currently, the report is grouped on Model, Department and Issue with a filter for date. Can this be done? Thank youCreate a formula field, say {@Current Week Amount} as (basic syntax):
if datepart("ww", {datefield}) = datepart("ww", CurrentDate) then
formula = {amount}
else
formula = 0
end if
You can then sum() this, or place it in a detail line, or whatever. It will only have a (non-zero) value when the date field is in the current week.
HTH,
Carl -
I use Numbers for my business and I currently use it to create individual invoices and then (manually) enter the totals from the invoices into a Master Spreadsheet where I can see the sum of the individual totals. Is there anyway to set up a formula or a system that automatically funnels the numbers from the Individual Spreadsheets into the Master Spreadsheet to calculate a total?
Marni,
If you can tolerate all the data and the summary being in a single document, this can be done. Any cell in a document can reference any other cell in the same document for the purpose of making a summary or other calculations.
Jerry -
Incrementing Total not correct(adding +1) in some group totals
Hi All,
I have an incrementing total that appears to work fine except when I try to display the total's final count only SOME groups have a +1 count. There doesn't seem to be a logical reason for it.
Any ideas?
Incrementing total formula:
Whileprintingrecords;
if Not({Command.BI_UPD_DT_TM} > {@f_ConvertRevYrMo_DtTm})
then
Global numbervar memberlinecnt := memberlinecnt +1
else
memberlinecnt+0;
Formula to call incrementing total's final group total:
Global numbervar memberlinecnt:={@f_RRTMemberIncrement};
memberlinecnt;
Note: I've not been able to use Running Total fields with this report because I need to evaluate totals based on group criteria and there are multiple groups and criteria.Hi Sharon,
I do have a reset, just didn't include it in my post.
Reset
//@Reset (Place this in the group header section suppressed)
WhilePrintingRecords;
Global NumberVar memberlinecnt:= 0;
Like I said,the whole thing appears to work, counting for ever group, resetting; except for only some groups, the total is +1 of the total. I don't know why.
Thanks,
John -
FOX: how to calculate weeks totals?
All, I need to calculate the suggested order order quantity (KF = ZPOSUGQTY) for a vendor/material combination. For this I need to calculate,
the total sales quantity (KF 0QUANTITY) of the last 4 weeks (so 'current week - 1' till 'current week - 4')
the total sales quantity of week 5 till 9 (so 'current week - 5' till 'current week - 9')
In my fields to be changed I have 0MATERIAL and 0VENDOR. 0CALWEEK is in the aggregation level. My plan is to get current week via the VARV/VARC statement from a Bex variable.
I am not sure how to get the 4 week total and the 5-9 week total though. I start off with FOREACH MATERIAL VENDOR. But what would the code look after that?
Any help appreciated! Cheers.Thanks Cornelia. I used the code below. It is not working though. I tried to debug it, there are a couple of problems
- the IF statement on CALWEEK is not working, the program does not seem to be able to calculate lower/higher compared to eg
CURWEEK1
- I think the program is calculating the formula per week. What I need is calulate the total sales figures for the last 4 weeks, then total sales of week 5-9. When this is done execute the formula to calculate ZPOSUGQTY. So the formula should only be calculated once for a material. For this I should not have 0CALWEEK in my fields to be changed? How would a DO statement fit below? FYI I have omaterial and 0calweek in my fields to be changed.
DATA MATERIAL TYPE 0MATERIAL.
DATA CALWEEK TYPE 0CALWEEK.
DATA TOT_SALES_1TO4 TYPE F.
DATA TOT_SALES_5TO9 TYPE F.
DATA CURWEEK TYPE 0CALWEEK.
DATA CURWEEK1 TYPE 0CALWEEK.
DATA CURWEEK4 TYPE 0CALWEEK.
DATA CURWEEK5 TYPE 0CALWEEK.
DATA CURWEEK9 TYPE 0CALWEEK.
BRING IN CURRENT WEEK PLUS DERIVED WEEKS
CURWEEK = VARV ('0CWEEK').
CURWEEK1 = TMVL(CURWEEK, -1).
CURWEEK4 = TMVL(CURWEEK, -4).
CURWEEK5 = TMVL(CURWEEK, -5).
CURWEEK9 = TMVL(CURWEEK, -9).
*INITIALIZE THE LOCAL KEY FIGURES
TOT_SALES_1TO4 = 0.
TOT_SALES_5TO9 = 0.
FOREACH MATERIAL, CALWEEK.
IF CALWEEK <= CURWEEK1 AND CALWEEK >= CURWEEK4.
TOT_SALES_1TO4 = TOT_SALES_1TO4 + {0ACT_DL_QTY, CALWEEK, MATERIAL}.
ELSEIF CALWEEK <= CURWEEK5 AND CALWEEK >= CURWEEK9.
TOT_SALES_5TO9 = TOT_SALES_5TO9 + {0ACT_DL_QTY, CALWEEK, MATERIAL}.
ENDIF.
ENDFOR.
{ZPOSUGQTY, CALWEEK, MATERIAL} = (2 * TOT_SALES_1TO4 + TOT_SALES_5TO9 )/ 13. -
Add and subtract summary group totals
Looking for a way to add and subtract summary group totals in a report.
I have my data grouped by account type then summarized. Example
have my data grouped by account type then summarized. Example
acct. type amount
51 $100
51 50
Summary $150
61 $100
61 100
Summary $200
70 $50
70 50
Summary $100
Formula I want to make this formula 51+61-70 = GP
I am trying to understand how to put the acct. type(51,61) in the formula and insert in the report.
Thanks for the help.
Raald232 -
hi
i have a matrix report with 2 level groups above it. now i need to sum group 2 cloumn values for every row on the basis of level 1 group.
For example, I have Top level group like TUBEWELL TYPE ( values are DEISEL and ELECTRIC) and below it at lower level is OWNER (with values like PRIVATE, GOVT) repeating both for DEISEL and ELECTRIC.
Now I need to sum every row i.e Private and Govt for Diesel and Private and Govt for Electric (two sums in one row).
Wizard provides complete row total but not group total.
So ur help required guys!!
nadeem ameer
[email protected]Hi..
am not providing you the exact answer.
But you can refer to the PRODUCT ORDER PROPERTY in the reports help or on the website.
Basically, all you need to do is manipulate the product order property, reset at or may be even compute at properties in the summary/ formula column of your matrix report.
Swati -
Filling gaps when calculate running total
Hello Friends,
i have a script that calculate running total,but i have gaps between dates.i had some solutions to resolve this issue but it did not perform well.because my source table has over milllion rows.please see my query,output and desired output.
Thanks in advance.
IF OBJECT_ID('tempdb..#SalesSummary') IS NOT NULL
DROP TABLE #SalesSummary
IF OBJECT_ID('tempdb..#StockDetail') IS NOT NULL
DROP TABLE #StockDetail
IF OBJECT_ID('dbo.SalesTransaction') IS NOT NULL
DROP TABLE SalesTransaction
IF OBJECT_ID('dbo.DesiredOutput') IS NOT NULL
DROP TABLE DesiredOutput
CREATE TABLE [dbo].[SalesTransaction] (
[StoreKey] [int] NULL
,[StockKey] [int] NULL
,[OptionKey] [int] NULL
,[DateKey] [int] NULL
,[Quantity] [int] NULL
CREATE TABLE [dbo].[DesiredOutput] (
[Datekey] [int] NULL
,[StoreKey] [int] NULL
,[StockKey] [int] NULL
,[OptionKey] [int] NULL
,[SalesFlag] [int] NOT NULL
,[Quantity] [int] NULL
,[StockQty] [int] NULL
INSERT [dbo].[SalesTransaction] (
[StoreKey]
,[StockKey]
,[OptionKey]
,[DateKey]
,[Quantity]
VALUES (
1
,1
,1
,20140601
,20
INSERT [dbo].[SalesTransaction] (
[StoreKey]
,[StockKey]
,[OptionKey]
,[DateKey]
,[Quantity]
VALUES (
1
,1
,1
,20140603
,- 10
INSERT [dbo].[SalesTransaction] (
[StoreKey]
,[StockKey]
,[OptionKey]
,[DateKey]
,[Quantity]
VALUES (
1
,1
,1
,20140607
,30
INSERT [dbo].[SalesTransaction] (
[StoreKey]
,[StockKey]
,[OptionKey]
,[DateKey]
,[Quantity]
VALUES (
2
,2
,2
,20140602
,15
INSERT [dbo].[SalesTransaction] (
[StoreKey]
,[StockKey]
,[OptionKey]
,[DateKey]
,[Quantity]
VALUES (
2
,2
,2
,20140603
,- 5
INSERT [dbo].[SalesTransaction] (
[StoreKey]
,[StockKey]
,[OptionKey]
,[DateKey]
,[Quantity]
VALUES (
2
,2
,2
,20140605
,20
INSERT [dbo].[DesiredOutput] (
[Datekey]
,[StoreKey]
,[StockKey]
,[OptionKey]
,[SalesFlag]
,[Quantity]
,[StockQty]
VALUES (
20140601
,1
,1
,1
,1
,20
,20
INSERT [dbo].[DesiredOutput] (
[Datekey]
,[StoreKey]
,[StockKey]
,[OptionKey]
,[SalesFlag]
,[Quantity]
,[StockQty]
VALUES (
20140602
,1
,1
,1
,0
,0
,20
INSERT [dbo].[DesiredOutput] (
[Datekey]
,[StoreKey]
,[StockKey]
,[OptionKey]
,[SalesFlag]
,[Quantity]
,[StockQty]
VALUES (
20140603
,1
,1
,1
,1
,- 10
,10
INSERT [dbo].[DesiredOutput] (
[Datekey]
,[StoreKey]
,[StockKey]
,[OptionKey]
,[SalesFlag]
,[Quantity]
,[StockQty]
VALUES (
20140604
,1
,1
,1
,0
,0
,10
INSERT [dbo].[DesiredOutput] (
[Datekey]
,[StoreKey]
,[StockKey]
,[OptionKey]
,[SalesFlag]
,[Quantity]
,[StockQty]
VALUES (
20140605
,1
,1
,1
,0
,0
,10
INSERT [dbo].[DesiredOutput] (
[Datekey]
,[StoreKey]
,[StockKey]
,[OptionKey]
,[SalesFlag]
,[Quantity]
,[StockQty]
VALUES (
20140606
,1
,1
,1
,0
,0
,10
INSERT [dbo].[DesiredOutput] (
[Datekey]
,[StoreKey]
,[StockKey]
,[OptionKey]
,[SalesFlag]
,[Quantity]
,[StockQty]
VALUES (
20140607
,1
,1
,1
,1
,30
,40
INSERT [dbo].[DesiredOutput] (
[Datekey]
,[StoreKey]
,[StockKey]
,[OptionKey]
,[SalesFlag]
,[Quantity]
,[StockQty]
VALUES (
20140602
,2
,2
,2
,1
,15
,15
INSERT [dbo].[DesiredOutput] (
[Datekey]
,[StoreKey]
,[StockKey]
,[OptionKey]
,[SalesFlag]
,[Quantity]
,[StockQty]
VALUES (
20140603
,2
,2
,2
,1
,- 5
,10
INSERT [dbo].[DesiredOutput] (
[Datekey]
,[StoreKey]
,[StockKey]
,[OptionKey]
,[SalesFlag]
,[Quantity]
,[StockQty]
VALUES (
20140604
,2
,2
,2
,0
,0
,10
INSERT [dbo].[DesiredOutput] (
[Datekey]
,[StoreKey]
,[StockKey]
,[OptionKey]
,[SalesFlag]
,[Quantity]
,[StockQty]
VALUES (
20140605
,2
,2
,2
,1
,20
,30
INSERT [dbo].[DesiredOutput] (
[Datekey]
,[StoreKey]
,[StockKey]
,[OptionKey]
,[SalesFlag]
,[Quantity]
,[StockQty]
VALUES (
20140606
,2
,2
,2
,0
,0
,30
INSERT [dbo].[DesiredOutput] (
[Datekey]
,[StoreKey]
,[StockKey]
,[OptionKey]
,[SalesFlag]
,[Quantity]
,[StockQty]
VALUES (
20140607
,2
,2
,2
,0
,0
,30
SELECT Datekey
,StoreKey
,StockKey
,OptionKey
,SUM(Quantity) Quantity
INTO #SalesSummary
FROM dbo.SalesTransaction
GROUP BY Datekey
,StoreKey
,StockKey
,OptionKey
SELECT Datekey
,StoreKey
,StockKey
,OptionKey
,1 AS SalesFlag
,Quantity
,SUM(Quantity) OVER (
PARTITION BY StoreKey
,StockKey
,OptionKey ORDER BY Datekey ROWS UNBOUNDED PRECEDING
) AS StockQty
INTO #StockDetail
FROM #SalesSummary
ORDER BY Datekey
SELECT *
FROM #StockDetail
SELECT *
FROM DesiredOutputI am glad that you attempted to post DDL, but you have no idea what you are doing and this is garbage. You have no idea what the ISO-11179 rules are. The meta-data attribute “_key” is never part of a data element name. Never! This is
how the element is used, and not what it is by its nature. A silly world of only INTEGERs? No keys, no DRI, nothing that can be part of a data model.
Why not use an industry standard like GTIN for the items? But I am sure you did not research anything.
Why did you have one and only sales transaction? That your table name told us. Most transaction models have an identifier; look at the receipt you got from MacDonald's for the last hamburger you are.
Why not use an industry standard like GTIN for the items? But I am sure you did not research anything.
Why did you have one and only sales transaction? That your table name told us. Most transaction models have an identifier; look at the receipt you got from MacDonald's for the last hamburger you are.
This is a deck of punch cards written in bad SQL.
CREATE TABLE Sales_Transactions
(sale_ticket INTEGER NOT NULL PRIMARY KEY,
store_nbr CHAR(10) NOT NULL,
gtin INTEGER NOT NULL, --- really CHAR(15)!
sale_date DATE NOT NULL,
sale_qty INTEGER NOT NULL
CHECK (sale_qty <> 0));
I have no idea how you get the unique ticket number for the key, but you can consider CREATE SEQUENCE Sales_Tickets; If you do not know this, Google it. You can build it into the DDL.
Did you know that RDBMS does not use Assembly language flags? We also do not use the Sybase “INTO #temp_table” to fake a scratch tape. In fact, you even mount another scratch tape so you can do step-by-step processing! This is not RDBMS.
You got the syntax for insertions wrong; you are using the old Sybase stuff.
INSERT INTO Sales_Transactions
(1, '00001', 1, '2014-06-01', 20),
(2, '00001', 1, '2014-06-03', -10),
(3, '00001', 1, '2014-06-07', 30),
(4, '00002', 2, '2014-06-02', 15),
(5, '00002', 2, '2014-06-03', -5),
(6, '00002', 2, '2014-06-05', 20);
It looks like you want inventory levels as running total
This is a deck of punch cards written in bad SQL.
CREATE TABLE Sales_Transactions
(sale_ticket INTEGER NOT NULL PRIMARY KEY,
store_nbr CHAR(10) NOT NULL,
gtin INTEGER NOT NULL, --- really CHAR(15)!
sale_date DATE NOT NULL,
sale_qty INTEGER NOT NULL
CHECK (sale_qty <> 0));
I have no idea how you get the unique ticket number for the key, but you can consider CREATE SEQUENCE Sales_Tickets; If you do not know this, Google it. You can build it into the DDL.
Did you know that RDBMS does not use Assembly language flags? We also do not use the Sybase “INTO #temp_table” to fake a scratch tape. In fact, you even mount another scratch tape so you can do step-by-step processing! This is not RDBMS.
You got the syntax for insertions wrong; you are using the old Sybase stuff.
INSERT INTO Sales_Transactions
(1, '00001', 1, '2014-06-01', 20),
(2, '00001', 1, '2014-06-03', -10),
(3, '00001', 1, '2014-06-07', 30),
(4, '00002', 2, '2014-06-02', 15),
(5, '00002', 2, '2014-06-03', -5),
(6, '00002', 2, '2014-06-05', 20);
My guess is that yoyu can use:
CREATE VIEW Inventory_Levels
AS
SELECT sale_date, gtin, sale_qty,
SUM(sale_qty)
OVER (PARTITION BY gtin
ORDER BY sale_date
ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW)
AS current_stock_qty
FROM Sales_Transactions
GROUP BY sale_date, gtin, sale_qty;
--CELKO-- Books in Celko Series for Morgan-Kaufmann Publishing: Analytics and OLAP in SQL / Data and Databases: Concepts in Practice Data / Measurements and Standards in SQL SQL for Smarties / SQL Programming Style / SQL Puzzles and Answers / Thinking
in Sets / Trees and Hierarchies in SQL -
How to calculate the total of bytes transferred when I submit a PDF Form in A. Reader
Hello,
I need to know some way for calculate the total of bytes transferred when I submit a PDF form using JavaScript, hereby:
b ******************************************************************
i var service_url = http://some_webservice/;
i var send_type = "PDF";
i var doc = event.target;
i doc.submitForm( { cURL: service_url, cSubmitAs: send_type } );
b ******************************************************************
b The reason:
I need to indicate the percentage of bytes sent to the server, in real time. Adobe Acrobat shows a progress bar and the transferred quantity in bytes, but Adobe Reader doesn't. Is in this case, when I need to find a way in order to make something similar.
b Than you for your time.You can use SharePoint Designer and calculate the total in xslt view. Refer to the following post for more information
http://community.bamboosolutions.com/blogs/bambooteamblog/archive/2009/04/24/how-to-total-calculated-columns-in-a-sharepoint-list.aspx
http://blog.metrostarsystems.com/2012/12/03/jennys-sharepoint-tip-sum-calculated-columns/
Cheers, -
How to calculate the total of a calculated column in a list view at the end of the view?
I have a view with the following columns ProductName, Quantity, Price, Total The total column is a calculated column which is the product of quantity and price. I want to place the sum of the total column by the end of the list view. I can do this with
the price and quantity but not with the total column. how do I do this?You can use SharePoint Designer and calculate the total in xslt view. Refer to the following post for more information
http://community.bamboosolutions.com/blogs/bambooteamblog/archive/2009/04/24/how-to-total-calculated-columns-in-a-sharepoint-list.aspx
http://blog.metrostarsystems.com/2012/12/03/jennys-sharepoint-tip-sum-calculated-columns/
Cheers, -
How do I calculate the total size of selected folders?
Hello
My question is:
How do I calculate the total size of selected folders?
Thank youIt does show the aggregate size.
Command-Option-I opens the Inspector window. (Or open the File menu and hold the Option key. Get Info turns into Show Inspector.) The Inspector is similar to the Get Info window but it shows aggregate info for multiple selections. It is also dynamic — if you change the selection while the Inspector is open, the info changes to reflect the current selection. -
How to get the group totals in report
HI,
Iam generating a report to display Storage Location, and Unit of Measures and Material group and also group totals.
how to display the group totals on the report.
thank q
rushi.Hi,
This following report clearly explains how to display the subtotal and grand total of
the particular field in alv.
REPORT YMS_ALVSUBTOTAL.
*REPORT z_alv_sub_totals .
TYPE-POOLS: slis.
DATA: BEGIN OF it_output OCCURS 0,
var1(8) TYPE n,
var2(10),
var3 TYPE I,
END OF it_output.
DATA: it_fieldcat TYPE slis_t_fieldcat_alv,
t_fieldcat TYPE slis_fieldcat_alv,
it_sort TYPE slis_t_sortinfo_alv,
t_sort TYPE slis_sortinfo_alv,
v_repid LIKE sy-repid.
INITIALIZATION.
v_repid = sy-repid.
START-OF-SELECTION.
PERFORM get_data.
PERFORM sort_fields.
PERFORM fill_fieldcat.
PERFORM list_display.
*& Form GET_DATA
text
--> p1 text
<-- p2 text
FORM get_data.
it_output-var1 = 1000.
it_output-var2 = 'anupama'.
it_output-var3 = '10000'.
it_output-key = 'X'.
APPEND it_output.
CLEAR it_output.
it_output-var1 = 1000.
it_output-var2 = 'siddhu'.
it_output-var3 = '20000'.
APPEND it_output.
CLEAR it_output.
it_output-var1 = 1000.
it_output-var2 = 'chinni'.
it_output-var3 = '100000'.
APPEND it_output.
CLEAR it_output.
it_output-var1 = 2000.
it_output-var2 = 'chicchu'.
it_output-var3 = '10000'.
APPEND it_output.
CLEAR it_output.
it_output-var1 = 2000.
it_output-var2 = 'candy'.
it_output-var3 = '10000'.
APPEND it_output.
CLEAR it_output.
it_output-var1 = 1000.
it_output-var2 = 'anupama'.
it_output-var3 = '10000'.
APPEND it_output.
CLEAR it_output.
it_output-var1 = 4000.
it_output-var2 = 'anupama'.
it_output-var3 = '10000'.
APPEND it_output.
CLEAR it_output.
ENDFORM. " GET_DATA
*& Form fill_fieldcat
text
--> p1 text
<-- p2 text
FORM fill_fieldcat.
PERFORM fill_fields USING: 'IT_OUTPUT' 'VAR1' 'Variable 1' ' ',
'IT_OUTPUT' 'VAR2' 'Variable 2' ' ',
'IT_OUTPUT' 'VAR3' 'Variable 3' 'X'.
ENDFORM. " fill_fieldcat
*& Form fill_fields
text
-->P_0146 text
-->P_0147 text
-->P_0148 text
-->P_0149 text
FORM fill_fields USING value(tabname) TYPE slis_tabname
value(fieldname) TYPE slis_fieldname
value(seltext_m) LIKE dd03p-scrtext_m
value(do_sum) TYPE c.
t_fieldcat-tabname = tabname.
t_fieldcat-fieldname = fieldname.
t_fieldcat-seltext_m = seltext_m.
IF do_sum = 'X'.
t_fieldcat-datatype = 'CURR'.
ENDIF.
t_fieldcat-do_sum = do_sum.
APPEND t_fieldcat TO it_fieldcat.
CLEAR t_fieldcat.
ENDFORM. " fill_fields
*& Form list_display
text
--> p1 text
<-- p2 text
FORM list_display.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
i_callback_program = v_repid
it_fieldcat = it_fieldcat
it_sort = it_sort[]
TABLES
t_outtab = it_output
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. " list_display
*& Form sort_fields
text
--> p1 text
<-- p2 text
FORM sort_fields.
t_sort-fieldname = 'VAR1'.
t_sort-tabname = 'IT_OUTPUT'.
t_sort-spos = 1.
t_sort-up = 'X'.
t_sort-subtot = 'X'.
APPEND t_sort TO it_sort.
CLEAR t_sort.
t_sort-fieldname = 'VAR3'.
t_sort-tabname = 'IT_OUTPUT'.
t_sort-spos = 2.
t_sort-up = 'X'.
APPEND t_sort TO it_sort.
CLEAR t_sort.
ENDFORM. " sort_fields
Thanks,
Sankar M -
Hi frinds ,how to calculate the totals in smartforms
1)how to calculate the totals in smartforms .
Hi,
To calculate totals and sub totals in sap scripts you can use subroutines.
Say if you have to add the unit price (KOMVD-KBERT) then in the main window whereever tat value is picked write this routine
/: DEFINE &TOT_PRICE&
/: PERFORM F_GET_PRICE IN PROGRAM /:USING &KOMVD-KBERT& /:CHANGING &TOT_PRICE& /:ENDPERFORM
Then write the variable where ever you want it to be printed (mostly it will be in footer window)
Then create subroutine pool program and you have to write the code.
FORM F_GET_PRICE tables int_cond structure itcsy
outt_cond structure itcsy. data : value type kbert.
statics value1 type kbert.
Read int_cond table index 1.
value = int_cond-value.
value1 = value1 + value.
Read outt_cond table index 1.
outt_cond-value = value1.
Modify outt_cond index 1.
ENDFORM.
regards..
Maybe you are looking for
-
InvalidateAutomationAncestors freezing UI
Hello, I have a .Net 4 WPF app that was running fine until the moment a slew of Microsoft Windows Updates patched my Windows 7 64-bit OS. The app is now practically unusable due to the amount of freezing I'm experiencing navigating the UI. I took sev
-
Setting Adobe Acrobat as a scan destination in Image Capture?
Is there a way of setting Adobe Acrobat as the default scan destination in Image Capture?
-
Need help : Reading from DAQ through TCP/IP ?!!
Hello I have two machines running labview connected to a network. Basically, I want to read data from a temperature sensor through a DAQ card from one machine, and be able to plot the data in a chart in the other machine. I'm trying to use TCP/IP fea
-
Creating a JTable of JLabels presented in a JScrollPane()
Hi, I want to create an object showing all/some colored labels. I get it presented with 5 columns, but nothing is colored. Her is a part of the logic: public MyColorTableModel() // String [][] array; array = new JLabel [280][10]; //Just for test purp
-
Open photo directly in Bridge ... ?
Hi, is there a chance to open photos directly in bridge? If I double click a JPEg, its always opened in Photoshop (or I can choose another application, but not brisge). Has Brdige the opporunity to view a photo directly in fullscreen? I do not wnat t