ALV Grid( How to calculate percentage) using alv gridfunctional module.
Dear Gurus,
In my report first coulmn and second column are sales and margin but third coulmn is margin%. now at last of report i want to display total sales and total margin and overall margin percentage. I am able to do total of sales and margin by using standard functionality of grid. I need to know to calculate overall percentage. I am not using alv oops method . I am using fucntional modules .
Thanks in advance.
Regards
Dave
Hi Devendra shrama,
Percentage calculation in ALV
The following method is a bit of a mission but it
seems to be the only way around this at the moment.
Also it only works with an ALV Grid not an ALV List.
You have to take over the total lines manually.
1. In the ALV output tab add extra fields that are the
same as those on which you are sorting and contain the
same values.
2. In the Field Catalog you must add these fields but
they must be hidden i.e. no_out = 'X'.
3. These fields must be included in the Sort Catalog
with subtot = 'X'.
4. In order to handle the final total line in your
layout for the ALV you must set field no_totalline'X' because you are going to be taking this over as
well.
5. Create a form called SUBTOTAL_TEXT or similar
structured as follows:
form subtotal_text using ep_subtot_line like
output_tab
es_subtottxt type
slis_subtot_text.
In this form you will do the percentage calculation
again at total level. The structure ep_subtot_line
will contain a field for each of the fields in your
output_tab i.e. ep_subtot_line-sales,
ep_subtot_line-cost and ep_subtot_line-margin. Put the
margin calculation into ep_subtot_line-margin.
6. In the eventtab that you pass to the ALV_GRID
function module you must create a record with the
field name = 'SUBTOTAL_TEXT' and the field form = the
name of the form you created in step 5 above.
This works OK.
i hope it helps you.Happy solving.
thanks
karthik
Similar Messages
-
How to calculate percentage in alv
hi guru,
i have 2 vaues one is onspec total = 543 . 00
grand total = 1098.00
how i caculate percentage means i want (543 / 1098)*100
help me in alv ....
thanksI too have searched for a complete answer. I have managed to calculate the percentage and update the subtotal line, but cannot force this data to the grid on first display. I set the DO_SUM = 'X' in the field category and the SUBTOT = 'X' in the sort table. The following code will change the subtotal line. Any help with forcing the new subtotal to appear in grid at first display will be greatly appreciated.
Get the sort criteria before subtotaling changes
CALL METHOD G_GRID->GET_SORT_CRITERIA
IMPORTING
ET_SORT = GT_SORT.
Get the subtotal structure
CALL METHOD G_GRID->GET_SUBTOTALS
IMPORTING
EP_COLLECT00 = TOTAL
EP_COLLECT01 = SUBTOTAL.
ASSIGN TOTAL->* TO <TOTAL>.
ASSIGN SUBTOTAL->* TO <SUBTOTAL>.
CLEAR W_PLNHR.
Recalculate the % done in subtotal line
LOOP AT <SUBTOTAL> INTO WA_TOT.
IF WA_TOT-PLNHR > 0.
WA_TOT-PLNPR = WA_TOT-ESTHR / WA_TOT-PLNHR * 100.
ELSE.
WA_TOT-PLNPR = 0.
ENDIF.
WA_TOT-GJAHR = SGJAHR.
MODIFY <SUBTOTAL> FROM WA_TOT INDEX SY-TABIX.
ENDLOOP. -
How to calculate percentage of errors in DP
Hi Gurus,
Can anyone tell me How to calculate the percentage of errors?
I had generated forecast and wanted to know how much is the error we have .
Please let me know your answers
Thanks a Lot
regards,
RajHi Gurus,
I just wanted to know how to get lowest percentage errors for my forecast and make business happy ?
I am using "Auto Model selection-2" and i wanted to have lowest percentage errors and what should i do for it?
What alpha , Beta and Gamma values need to keep in forecast profile?
Please let me know it will be really great
Thanks for the answers
Regards,
raj -
How to calculate percentage and difference of two values in matrix report in ssrs 2008
Hi everyone,
DB--SQL server
SSRS-2008
I am creating matrix report with grouping on WEEK and Fiscalyearweek,
I need to calculate of difference between FY14W01,FY15W01 ande percentage of those..
how to calculate in ssrs level.
Thank You, Manasa.VHi veerapaneni,
According to your description, you want to calculated the increment percentage and difference between two fiscal year week within each week. Right?
In this scenario, since we need to do calculation based on values between dynamically generated cells, we can't simply use expression to achieve this goal. In this scenario, we need to use custom code to record the value for fiscal 14 and fiscal 15, then
we can calculate the difference and percentage within the column group. We have tested your case in our local environment, please refer to the steps and screenshots below:
1. Add the custom code below into the report (you may need to modify the data type based on your scenario:
Public Shared Value1 as Integer
Public Shared Value2 as Integer
Public Shared previous as string
Public Shared previousweek as string
Public Shared Function GetValue(Value as Integer,product as String,Week as String) as Integer
If product =previous and Week =previousweek Then
Value2=Value
Else
previous=product
previousweek=Week
Value1=Value
End If
return Value
End Function
Public Shared Function GetPct()
return (Value2-Value1)/Value1
End Function
Public Shared Function GetDiff()
return Value2-Value1
End Function
2. Design the matrix like below:
3. The result look like below:
If you have any question, please feel free to ask.
Best Regards,
Simon Hou -
How to calculate percentage old school
I am looking for a calculator aps that can calculate percentage like in the 1980 Casio calculator,
Example:
100 x 25% +
That would equal 125 and not 50
MerckMeg St._Clair wrote:
By the way, 100x25% =25, not 125 or 50. What your asking is 100 + (.25x100). At least, as best I can tell.
What you missed - and I missed it as well at first is the + sign in the OP's post which then makes the calculation...
100 x 1.25 + = 150 where the + adds the 25 back onto the subtotal.
100 x 1.25 = 125 + 25 = 150.
That is how I interpret what the OP wants to do. -
How to Calculate Overtime Using Negative Time Management
Hi Experts,
We are having PA,OM & PY in our project scope. We have just configured TM uptill workschedule.
But how to calculate the overtime when we are using negative time management.
We are having International Payroll Driver.
Regards,
IrfanHi,
Thanks for your prompt response.
But if the overtime is based on Basic , HRA and other wage components.
How the configuration of the wage type takes palce.
Regards,
Irfan -
How bapi can be used in sd module.
hi gurus
can any one elobarate on Bapi what is the use of it. how it will be use ful for the sd guys.
thanks in advanceHi Nag,
BAPI : BAPI basically works like a function module. the major difference being that it can work like a RFC. That means it can work from system to system. Mostly the name of a BAPI can be seen in se37 by just giving BAPI_* F4 and you will see a lot of BAPIS
http://www.planetsap.com/SAP46B_BAPI_LIST.htm
http://www.planetsap.com/LIST_ALL_BAPIs.htm
BAPI_SALESORDER_CHANGE
we have a scenario where our client uses a third party software for the plant. The orders generated there all get converted into an XML file. The XML file is read by a BAPI, to create sales order in SAP. This BAPI runs as a batch job at a scheduled time the orders get created.
Incase of any order failing in SAP, we check the XML going to the BAPI and find the reason and make the necessary corrections.
http://help.sap.com/saphelp_47x200/helpdata/en/5c/f3f0371bc15d73e10000009b38f8cf/content.htm
Hope It Helps You..
Regards..
Praveen Kumar.D -
How to calculate percentage growth rate
Hi guys,
Please I am trying to calculate the percentage of growth rate using MDX query.
I have tried this but it keeps returns a null value.
Create Member CurrentCube.[Measures].[Monthly Growth Internet Sales Amount]
As [Measures].[Internet
Sales Amount]/
([Date].[Month of Year].CurrentMember,[Measures].[Internet Sales Amount])-
([Date].[Month of Year].PrevMember,[Measures].[Internet Sales Amount]),
FORMAT_STRING = "Currency",
VISIBLE = 1
I need your assistance please.
meAre you trying to return a percentage? If so, your format_string needs to have a percentage format.
Also, are you trying to return [Internet Sales Amount] change vs last month?
If so, the query should be something like this...
Member CurrentCube.[Measures].[Monthly Growth Internet Sales Amount]
As
(([Date].[Month of Year].CurrentMember,[Measures].[Internet Sales Amount])-
([Date].[Month of Year].PrevMember,[Measures].[Internet Sales Amount]))
/ [Measures].[Internet Sales Amount],
FORMAT_STRING = "0.0%",
VISIBLE = 1
Please mark as answered, if this is what you are looking for. -
How to calculate percentage based on key figure maximum value
Hello everybody!
I need your expertise on a query 'issue' I'm facing. Let's say I have a query getting me the Number of Open Items per Week (starting from billing document's Issue Date).
My client wants to be able to see the percentage per week and not the actual number.
So, what I have is below:
<b>Wk</b><b>"OI Nr"</b>
1 "68.801"
2 "66.288"
3 "59.344"
4 "50.506"
5 "20.950"
And what I want is below (in italics):
<b>Wk</b><b><i>"OI %"</i></b>
1 "<i>100% </i>" (i.e. 68.801 / 68.801 * 100)
2 "<i> 96,34% </i>" (i.e. 66.288 / 68.801 * 100)
3 "<i> 86,25% </i>" (i.e. 59.344 / 68.801 * 100)
4 ......
5 ......
Is it possible to achieve sth like this by altering some key figure properties or in any other way?
Thanks in advance.First u need to create a calculated Key Fig globally. You can do this at the extreme left end of the query Designer. Just right click on the Calculated key Fig and say <b>New Calculated Key Figure</b>
Give the description of the Key Fig and in the formula section just put the the key fig . <b>'OI Nr'</b> in you case
When u say ok it will open the properties of the key fig there u can see <b>Enhance>></b> at the bottom. Click on that make the <b>exception aggregation</b> to <b>maximum</b> and <b>refernce characteristic</b> for the one which u are having the values 68.801, 66.288, 59.344, ..
Save this calculated key fig
now in the Columns create a <b>new selection</b> under the key fig.
drag the newly created calculated key fig in this <b>new selection</b> and say ok.
Now right click on this <b>new selection</b>, go to the <b>Calculated Single Value</b> as drop down and make it <b>Normalize-Sub Totals</b>
Tick the checkbox <b>Also Apply to result</b>
and select <b>Calculate Along Columns</b>.
Save the query and execute. This should solve youe issue
Hope this helps. -
How to calculate predictions using an MVAR model
Hi All,
I'm using an MVAR model (Least Squares). The AR VI in the Advanced signalprocessing toolbox calculates the regressionparameters and returns the noise that is not acounted for by the MVAR model.
However I need the estimations too... So I tried to subtracting the noise from the original data. Can somebody please confirm that this approach returns the correct estimations from my MVAR model?
Best regards,
KKHi All,
I'm using an MVAR model (Least Squares). The AR VI in the Advanced signalprocessing toolbox calculates the regressionparameters and returns the noise that is not acounted for by the MVAR model.
However I need the estimations too... So I tried to subtracting the noise from the original data. Can somebody please confirm that this approach returns the correct estimations from my MVAR model?
Best regards,
KK -
hi,
i have requirement below.
i want to calculate 20 percent of wa_ameng .and if wa_menge value is more than 20 percent of wa_ameng then i will capture that value to another varibale.how to write the code please help me
data:wa_ameng type i,
wa_menge type i,
wa_percent type i.
*DATA: BEGIN OF xe1edp10.
INCLUDE STRUCTURE e1edp10.
*DATA: END OF xe1edp10.
LOOP AT dint_edidd
WHERE segnam EQ 'E1EDP10'.
CLEAR xe1edp10.
MOVE dint_edidd-sdata TO xe1edp10.
loop at DEKEH .
move dekeh-ameng to wa_ameng.
move dekeh-menge to wa_menge.
endloop.
ENDLOOP.Hi,
Add decimals to it.
data :wa_ameng type p DECIMALS 2,
wa_menge type p DECIMALS 2 ,
wa_percent type p DECIMALS 2 ,
wa_percent1 type p DECIMALS 2 .
Thanks,
Sri. -
How to calculate Average using Dimension Formulas or Default Logic
Hello
I am trying to calculate the average without success. Do you know how I can Achieve the following? :
We have multiple u201Cofficesu201D in the ENTITY dimension that fall under a Region. Let´s say 400+ offices under 20 Regions
For example:
Region1
Office A
Office B
Region2
Office C
Office D
Office E
We have an Account named 'SalesUnits', and I am looking to get an Average Sales by Region and then be able to compare one Office against the Average of the REGION it belongs to.
So If I have:
Sales Units
Office C 20
Office D 10
Office E 15
Average of Region 2 would be 201015/3 =15
But the number of office is variable, Sometimes I can have more offices.
So I will have to count the number of offices that belongs to that region.
I need this average so every office can compare their sales against the Region Average.
Do you know how I can do this? I have tried some MDX syntax but without sucess.
Thanks in advance!
AnnaHi Anna,
This will need to be done in Dimension logic as I assume, you;'d like to have the average up the region heirarchy.
I'd suggest having 3 accounts for this
ID .....................................FORMULA
SALES_UNITS...................
OFFICE_COUNT.................1
UNITS_AVEREAGE............SALES_UNITS/OFFICE_COUNT
The formula bit, goes in the formula column. When look at office count against the region heirarchy, it will sum up the 1's thereby giving you the denominator for the formula and you'll get the avereage up the region heirarchy.
Tim -
How the achive this using the function module SO_NEW_DOCUMENT_SEND_API1
I want to format the body of the mail like this.How to maintian proper spacing between the fields.kindly suggest.
It may contain multiple line items also.
SC Number | SC Item Number | SC Item Qty | PO Number | PO Item Price
SC Name | SC Item Text | SC Item Price | PO Item | Invoice Item Price
<SC_NUMBER> <SC_ITEM> <SC_QTY> <PO_NUMBER> <PO_PRICE>
<SC_NAME> <SC_ITEM_TEXT> <SC_PR> <PO_ITEM> <IV_PRICE>Hi,
You can do with SOFM method select over there Excel Sheet as same format you can select all fields respectively so in the output in an attachment you will get the values as you like that format in the same way multiple line items also you can retrive data in Excel sheet attachement, then using this FM you can send mail with this attachement.
Thanks and regards,
Prabhakar Dharmala -
How to calculate system date through function module date
Hi friends!!
i declare a variable "date like sy-datum".
now i want to add 15 days to the system date,
please give me the function module name which can do it.
xample.
date = sytem date. -> date= 13/08/2010
i want date= 28/08/2010.
please help.
Edited by: sandeep08 on Aug 13, 2010 1:53 PM
Moderator message: date calculation questions = FAQ, please search before posting.
locked by: Thomas Zloch on Aug 13, 2010 2:03 PMHi,
You can directly add 15 to the date. It will give you appropriate results.
Regards,
Aparna Alashe. -
Replacing one namespace with another using XML Anonymizer Module
I've following XML message
<?xml version="1.0" encoding="UTF-8"?>
<ns0:Result xmlns:ns0="urn:source_namespace">
<ns0:Function/>
<ns0:r/>
</ns0:Result>
but I need to have a little bit different namespace (which do not exist in above message)
<?xml version="1.0" encoding="UTF-8"?>
<ns0:Result xmlns:ns0="urn:target_namespace">
<ns0:Function/>
<ns0:r/>
</ns0:Result>
Any idea how to archieve this using XML Anonymizer Module?Hi,
You don't need a UDF to do this. Follow this...
1. Edit the Message Type Result XML Namespace as urn:target_namespace from urn:source_namespace.
2. Save this and activate it.
3. In the Message Mapping go to edit and reload this new Message Type, save the changes and activate it.
This blog How to remove namespaces in Mapping - XI By Sameer Shadab shows you hove to remove the namespace in you case you use the same to change the namespace
Thanks
SaNv...
Maybe you are looking for
-
Berkeley db lost data when using autocommit
I has written an app which uses berkeley db 4.5.20(libdb_cxx-4.5.so). There are serveral threads reading and writing the same db using autocommit. All the reading threads share one db handle and All writing threads have their own db handles. In readi
-
Duplicates in iphoto every time i sync with my iphone
any ideas? every time i sync iphone i manage to get duplicates in iphoto even though i select, 'do not import duplicates'
-
Hi, We are currently migrating from SAP J2EE Engine 6.20 to SAP J2EE Engine 7.0. From the support note 549268 we understand that the SAP J2EE Engine 7.00 has a SAP JCo version 6.45. But what we need to understand is that what is the equivalent stand-
-
Can't send text, send button won't work
I just bought a new iphone4 and when I try to send a text the send button won't respond. Everything else seems ok. It worked for the first couple of days.
-
How to set DB driver's encoding ??
I'm currently using Access 2000 with tomcat as server. My problem is how to set the database's encoding in java ?? for both read and write ?? I'm trying to storea strings from the JSP in UTF-8 format in to access but as I retrieve it from database it