Ordering row wise totals in a column.
Hi,
I have a report in Pivot view having two columns namely Count and Category. I have to apply sort on these two columns-first on Count and then on Category.
The Total Count is also calculated row wise. Now when I apply sort on count column, only the values in that column are being sorted and not according to row wise total count. But my requirement is to sort the total count row wise first and then by Category.I am unable to do so.
Kindly provide me the solution to this problem.
Thanks
Ankita
Use RunningSum() function.
Regards,
Rohit
Similar Messages
-
Row wise total in editable ALV
hello all,
I am workin on editable alv, the user need to enter the values in the editable fields and in the last column(non-editable) i need to populate the total row wise,as soon as user enters a value and goes to next editable cell or on entering a vale and press enter.how to accomplish this task...
with regards,
sandeep akella.
Edited by: sandeep akella on Aug 20, 2009 1:58 PMYou need to Implement the OnCellAction event.follow these steps;
1. Goto WDDOMODIFYVIEW and place the following code
IF first_time IS INITIAL.
DATA lo_cmp_usage TYPE REF TO if_wd_component_usage.
lo_cmp_usage = wd_this->wd_cpuse_usg_alv( ).
IF lo_cmp_usage->has_active_component( ) IS INITIAL.
lo_cmp_usage->create_component( ).
ENDIF.
DATA lo_interfacecontroller TYPE REF TO iwci_salv_wd_table .
lo_interfacecontroller = wd_this->wd_cpifc_usg_alv( ).
DATA lo_value TYPE REF TO cl_salv_wd_config_table.
lo_value = lo_interfacecontroller->get_model(
CALL METHOD lo_value->if_salv_wd_table_settings~set_cell_action_event_enabled
EXPORTING
value = abap_true.
ENDIF.
2. Implement the onCellAction event as follows;
Goto Methods tab, create a new method. Method Type- Event Handler , Event - ON_CELL_ACTION
3. Now in this method retrive the contents of the row and calculate the value as follows.
DATA: l_element TYPE REF TO if_wd_context_element.
DATA:ls_stru TYPE wd_this->element_cn_alv.
DATA: l_node TYPE REF TO if_wd_context_node.
l_node = wd_context->get_child_node( 'CN_ALV' ).
l_element = l_node->get_element( r_param->index ).
l_element->get_static_attributes( IMPORTING static_attributes = ls_stru ).
ls_stru-last_col = ls_stru-col1+ls_stru-col2....+ ls_stru-col5. " add all the cells data
l_element->set_static_attributes( exporting static_attributes = ls_stru ). -
Hi,
I would like to access a total(which is a sum of some 25 rows) in another column cell.
How do i do that.
Regards,
Tulsi.Hi Tulsi,
Create variable
=If [Product]InList("A";"B";"C") Then Sum([Amount]+[Amount2]+[Amount3])
or use this formula
= If [Product]=[Product] Then Sum([Amount]+[Amount2]+[Amount3])
Regards
Mustafa -
hi,
i hav 4 fields among which 3 fields are quantity fields(f1 f2 f3) and i want the total of these threee fields in the fourth field f4....
can anyone explain how to do this.....Hi,
while preparing your final internal table you have to do like bleolw
loop at it_final into wa_final.
wa_final-f4 = wa_final-f1 + wa_final-f2 + wa_final-f3.
modify it_final from wa_final index sy-tabix transporing f4.
endloop.
it works...
Note: F4 will be the filed at the end in your final internal table.
Thanks! -
is there any method to create row wise running total in Crystal Reports?
>
gourav.sengupta wrote:
> Hi,
>
> I needed a running total but for rows. Therefore if the data set is in the following manner:
>
> Column 1 Column 2 Column 3 Column 4
> A 12 13 14
> B 11 10 19
>
> The the running total will appear as:
> RT 23 23 33
>
>
> Thanks and Regards,
> Gourav
I am confused as to what you want.
Your sample shows sums for collumns, not rows. You do not need a running total for this, just sum them.
If you want to total each row, make a formula that adds them up and place on the row. -
Grab the first rows and put it to column wise
Below are two dump, i want to grab the first 2 rows in ascending order by from_date and put to column wise, the first row label first_charge and second row as second_charge. AND throw away rows from 3 are not needed.
1st dump 5 columns are my input,
2nd dump 3 columnS ARE my desired output.
I have tried the rank function but can someone please confirm this is correct way to do this for all the accounts in the table
Script (table and data) for 1st dump is at bottom of post.
Can anyone help resolve this issue - thanks.
--FIRST DUMP
ACCOUNT_ID CHARGE_AMT CHARGE_DATE FROM_DATE THRU_DATE
212855740 14.52 5/04/2012 14/03/2012 31/03/2012
212855740 25 5/04/2012 1/04/2012 30/04/2012
212855740 25 5/05/2012 1/05/2012 31/05/2012
212855740 25 5/06/2012 1/06/2012 30/06/2012
212855740 25 5/07/2012 1/07/2012 31/07/2012
212855740 25 5/08/2012 1/08/2012 31/08/2012
212855740 25 5/09/2012 1/09/2012 30/09/2012
212855740 25 5/10/2012 1/10/2012 31/10/2012
212855740 25 5/11/2012 1/11/2012 30/11/2012
--DESIRED DUMP
ACCOUNT_ID PRO_CHARGE MONTHLY_CHARGE
212855740 14.52 25
WITH CHARGE_TABLE_QUERY
AS (SELECT account_id,
charge_amt,
charge_date,
from_date,
thru_date,
ROW_NUMBER ()
OVER (PARTITION BY account_id ORDER BY from_Date)
row_num
FROM my_tbl)
SELECT account_id,
MAX (CASE WHEN ROW_NUM = 1 THEN CHARGE_AMT ELSE 0 END) PRO_CHARGE,
MAX (CASE WHEN ROW_NUM = 2 THEN CHARGE_AMT ELSE 0 END) MONTHLY_CHARGE
FROM CHARGE_TABLE_QUERY q
WHERE row_num IN (1, 2)
GROUP BY account_id;ricard888 wrote:
what happens if a new account where there is no second charge yet. can i have either null or 0 in the monthly_charge.You could test it easily. Anyhow, it will work without any change in the code
insert into my_table
select 1,50,CHARGE_DATE,FROM_DATE,THRU_DATE
from my_table
where rownum = 1;
1 rows inserted.
with CHARGE_TABLE_QUERY as
select account_id,charge_amt,
ROW_NUMBER ()
OVER (PARTITION BY account_id ORDER BY from_Date) rn,
lead(charge_amt)
OVER (PARTITION BY account_id ORDER BY from_Date) MONTHLY_CHARGE
from my_table
select account_id,charge_amt pro_charge,monthly_charge
from CHARGE_TABLE_QUERY
where rn = 1;
ACCOUNT_ID PRO_CHARGE MONTHLY_CHARGE
1 50
212855740 14.52 25 -
How 2 Change of column wise o/p to row wise output in ABAP?
Hi all,
I am getting the output in column wise as normally but how can I get the ouput in row wise.in ABAP.
its urgent. can any one help me how to change the output layout?
thanks in advance,
Sakthi.Cif it is normal report .then
go through the write statents . one of that is below
Loop at itab .
write : itab .
endloop.
if it is ALV then you have to define an internal table which are the fieldds you want palce in the Row .
so that
data c type i value '1'.
loop at itab .
fieldcatalog-fieldname = itab-field.
fieldcatalog-col_pos = c.
append fieldcatalog to fieldcatalog.
clear fieldcatalog
c = c + 1.
endloop.
so that the Col_pos will be increased and the Column data will be moved into Row .
reward points if it is usefull...
Girish -
In alvs how to do totals by colum wise and row wise
hi,
in alvs how to do totals by colum wise and row wise
could u plz explain clearly with codingHi Rajesh,
Go through these links...
http://www.sapfans.com/forums/viewtopic.php?t=20386
http://www.sapfans.com/forums/viewtopic.php?t=85191
http://www.sapfans.com/forums/viewtopic.php?t=88401
http://www.sapfans.com/forums/viewtopic.php?t=17335
Reward Points if this helps,
Satish -
Purchase order row basecard column number
hi
any one help me what is purchase order row basecard column number.
Thanks & Best Regards
B.Lakshmi narayananHi,
Could you clarify your reguest?
Thanks,
J. -
Output data in row wise instead of column
hi all,
i need to get the output data in row wise which is getting now as column wise.
for eg:
below is my final internal table.
HEADING DATE MATNR BUKRS DMBTR
jan/08 200801 567 10 800
feb/08 200802 567 10 900
mar/08 200803 567 10 200
apr/09 200804 567 10 400
the output should come as
MATNR BUKRS Jan/08 Feb/08 Mar/08 Apr/08
567 10 800 900 200 400.
instead of column wise the output should display as row as above.
please help how to get this.
thanks in advanceHi Vignesh,
Please use below program which I created for you reference. It will work for your requirement.
DATA:BEGIN OF it_test OCCURS 1,
date(6),
matnr(5),
bukrs(3),
END OF it_test.
it_test-date = 'jan/08'.
it_test-matnr = '01234'.
it_test-bukrs = 'AE1'.
APPEND it_test.
it_test-date = 'feb8'.
it_test-matnr = '56789'.
it_test-bukrs = 'AE1'.
APPEND it_test.
it_test-date = 'mar8'.
it_test-matnr = '23478'.
it_test-bukrs = 'AE1'.
APPEND it_test.
START-OF-SELECTION.
LOOP AT it_test.
WRITE :/ 'DATE', 'MATNR', 'BUKRS', it_test-date, it_test-matnr, it_test-bukrs .
ENDLOOP.
Output Will be as follows :-
DATE MATNR BUKRS jan/08 01234 AE1
DATE MATNR BUKRS feb8 56789 AE2
DATE MATNR BUKRS mar8 23478 AE3
Please set to resolve if this satisfies your requirement.
Regards
Abhii.. -
Animate table row-wise in arbitrary order
Dear all,
I would like to animate a table such that the content appear row-wise, but e.g. first row 1, then row 3 and then row 2.
How to do that?
I failed, when tried to define the animate for each element separately, since I was not able to move row 3 before row 2.
Any suggestions?
Thanks,
ThomasIt doesn't appear to be a way to do this automatically, so what you probably have to do is duplicate the chart for as many times as you have rows and then set them to build in in the order you wish. Would be a pain in the butt, but should work.
-
Poor Response Time- Total on a column for n number of rows
I have a table with column cost on my custom OAF page.
When I query for configuration it returns me many rows. so I have set the default rows for table = 10 and then I neatly have next button to go to other rows.
I have enabled totalling on cost column.
Row for Total appears showing sum for the costs only on that page( for only 10 rows). I click for next from drop down , and I see total for the costs for the second page.
Ex:
table has 17 rows and
page 1 :
total row at the end saying 1000.00
page 2 :
total = 1500.00
I want to display Total Cost by summing up the costs for say 300 items returned by the query on all the pages , in above case 2500.00.
I thought of a way to do it ;
I added a sumVO with query "select sum(...) from table" .
Added a new region in my page , added a messageStyleText based on the sumVO, and pulled the total cost in.
It shows me the right result, but my problem is performance.
It is getting very slow. I am using the same query as for displaying the results in table, but summing on cost column.
Can I avoid writing the sum query and do it programmatically in OAF ??
Thanks in advance.Even if you use programmatic approach, what do you think program will do?
Program has to fetch all the rows in the middle tier and sum it up using for loop. No way its going to solve your problem.
First find out the reason for the slow performance using Trace option. and fix the query.
If your not able to fix it, try materialized view for the summation query.
To take sql trace for OAF page refer this link infor http://prasanna-adf.blogspot.com/2009/01/sql-trace.html
--Prasanna -
Operation wise total required hours for planned order in given date range
Hello Experts,
My client wants the report to check the capacity utilization of the work centers for the all planned order in particular date range.
Is their any standard report which gives the work center wise operation wise total required hours? or which table should I use to make the customize report so that I will get total required capacity & available capacity.
Thanks in advance for use valuable suggestions.
SagarHi Mario,
Thanks for your reply,
In CM01 or CM05, we are getting requirement on weekly basis.How to get that report on daily basis? I want to give the input as a date range of the planned order.How to go for that?
Edited by: SAGAR GOLIWAR 226 on Jul 3, 2011 8:16 AM -
How to print column wise istead of row wise
Hi,
please help on this..
i want to print coloumn wise Employee data instead of row wise.
Keeping Employee name constant i want to print month wise salary..
Like this..
Employee name|Jan-2010-Wages paid|Feb-2010-Wages paid
soon...
Plez help me..
Edited by: user651567 on Feb 28, 2010 5:30 AMPlease post CREATE TABLE and a few INSERT statements as well as your desired output and your database version.
Always put the tag before and after your examples to keep it formatted.
See the FAQ regarding tags: http://forums.oracle.com/forums/help.jspa (scroll a bit down).
You might want to search this forum first (search box is on right side of screen), since your question has been asked and explained before.
Also, regarding string aggregation. see this link explaining various techniques (depending on database version):
http://www.oracle-base.com/articles/misc/StringAggregationTechniques.php -
Use Session Variable with row-wise initialization
Hello,
I use an initialization block in order to load some translations in my repository (version is 11.1.1.6.BP1) :
SQL :
SELECT CODE_KEY, STRING_VALUE FROM "TABLES" WHERE LANGUAGE_KEY= 'VALUEOF(NQ_SESSION.USERLOCALE)'
Values :
CN_INCOMING, Incoming, en
CN_OUTGOING, Outgoing, en
CN_INCOMING, Réception, fr
CN_OUTGOING, Emission, fr
etc ...
I checked the row-wise intialization.
The query is correct and returns the right values (I check in the log file ..).
So far, So good.
But when I want to use session variables in a column expression (in repository) like :
CASE WHEN "column"="xx" THEN VALUEOF(NQ_SESSION."CN_INCOMING") ELSE VALUEOF(NQ_SESSION."CN_OUTGOING") END
I got the error: [nQSError: 23006] The session variable, NQ_SESSION.CN_OUTGOING, has no value definition.
If I used the same formula directly in Answers it's working correctly.
Do I have to necessarily do this in answers or is there a way to do this in the repository.
Thanks in advance
Regards
BenjaminYes I already tested this point, when I don't use a row wise initialization it's working, but I don't want to create one variable for each translations that I need to use in column formula if you know what I mean.
I don't understand why we can't use this kind of variable in this context ..but if I have to create the column in my analysis, I will do that, but it's not really user friendly
Anyway thanks for your time.
Maybe you are looking for
-
Facing error while running jsp page in jdev10g ADF
Hi, I am not able to run pages of an application created in Jdev ADF.I am facing this error. can anybody help me out??? JBO-30003: The application pool (model.ChakDeTrackersLocal) failed to checkout an application module due to the following exceptio
-
How to enlarge chat input box height?
how do I expand (height wise) the column of the text box where i'm typing in messages? it is quite annoying having to work with 2 lines of text unless pressing <enter>
-
Question... I'm running a pretty supped up rig but I have yet to go to water cooling. I have a 120mm fan in the front of the computer, one on the door, one in the back, and the heatsync fan of course... My system idles in windows (according to Core
-
Where is the official Oracle documentation that describes Hot Backup?
I have used the woefully inadequate Metalink search utilities and Google but the nearest thing I have found is a description on "Ask Tom". I am looking for the official Oracle documentation that describes what happens internally during a Hot Backup.
-
Hello Sony Ericsson, Few months ago I bought "sony ericsson phone W995" and I enjoy this phone pretty much except one thing. I cannot send and receive any picture messages. Every time I try to send picture, it says "MMS setting missing," then I click