Testing sum of amounts in body by mapping
hi.
here in my scenario i have to sum all individual amounts in sender file and i have to compare with trailer sum.
for this i have created my sender mtype amount and i have checked with sum(statistical function) and i compared with trailer info.
its working with integers but when there are amounts with decimals then the sum is not showing correct value.
im my scenario the sum is supposed to be 40843.55 but the sum(statistic function) is showing like 40843.555.
can any body tell what changes i have to do for this.
waiting for u r well anser.
regards.
seeta ram.
try;
public void chkAmountSum(String[] a,String[] b,ResultList result,Container container){
//write your code here
double tempAmt = 0;
double tempSum = 0;
double tempRes = 0;
double temp = 0;
double count = 0;
try{
for (int j = 0; j<a.length; j++)
temp =Double.parseDouble(a[j]);
tempAmt = tempAmt + temp ;
for (int j = 0; j<b.length; j++)
tempSum = Double.parseDouble(b[j]);
tempRes = tempAmt - tempSum;
if (tempRes != 0)
a[0] = "Not equal";
result.addValue(a[0]);
else
a[0] = "Is Equal";
result.addValue(a[0]);
}catch(NumberFormatException e)
a[0] = "Exception";
result.addValue(a[0]);
Similar Messages
-
Query to update T1.TotalAmount from sum(T2.Amount)
I have 2 tables T1 and T2 such that
T2.TotalAmount=sum(T1.Amount) where T1.BillType=T2.BillType and T1.BillNo=T2.BillNo
as shown below
Table T1
BillType
BillNo
ItemName
Amount
Sale
156
Rice
100
Sale
156
Vegetables
20
Purchase
13
Rice
50
Purchase
13
Vegetables
10
Table T2
BillType
BillNo
TotalAmount
Sale
156
120
Purchase
13
60
i have updated T1 with query
update T1 set Amount=Amount+100
BillType
BillNo
ItemName
Amount
Sale
156
Rice
200
Sale
156
Vegetables
120
Purchase
13
Rice
150
Purchase
13
Vegetables
110
now i want to update T2.TotalAmount with new values of T1.Amount such that
T2.TotalAmount=sum(T1.Amount) where T1.BillType=T2.BillType and T1.BillNo=T2.BillNo
as shown below
BillType
BillNo
TotalAmount
Sale
156
320
Purchase
13
260
i tried this query
update T2 set TotalAmount=(select sum(Amount) from T1 inner join T2 on T1.BillType=T2.BillType and T1.BillNo=T2.BillNo where T1.BillType=T2.BillType and T1.BillNo=T2.BillNo)
this returned table T2 as below
BillType
BillNo
TotalAmount
Sale
156
580
Purchase
13
580
What should i do to get T2.TotalAmount correctlyTry this: (not tested)
update T2 set T2.TotalAmount= O.TotalAmount From T2 Inner join
(select BillType,BillNo,sum(Amount) As TotalAmount from T1 Group by BillType,BillNo ) O on O.BillType = T2.BillType and O.BillNo = T2.BillNo
Thanks
Bharath -
How do i test split by value functionality in mesage mapping with multiple
how do i test split by value functionality in mesage mapping with multiple values ?
regards,
venkatrepeat your source node. in mapping editor you can view queues by right clicking to mapped element.. selecting Display Queues option.. this will show u your values .
You can also select this Display Queue option for splitByValue option
for example
source--->splitByValue>target
Try viewing your queues to each this step... for splitByValue in display Queue you will see context inserted(grey colour) accodingly -
Sum of amounts from the previous years
How do i calculate Sum of the value of invoice amounts paid for the FY 3 years prior to the current year.I tried LAG but its not giving me the desired results.
ThanksHi
You have to understand how LAG works then you'll be able to do it.
LAG works back looking at a set of sorted data, using the PARTION BY and ORDER BY clauses, then pulls a value from x rows preceding. All the data that you want must be in the worksheet too so you must not be filtering on current year.
Here's what I do:
I take a copy of the worksheet I am working with and look at the data in tabular form. Then I use one or more Group Sorts to pull like items together. These will become my PARTITION BY clauses. Any specific sorting, such as the year come next - these become the ORDER BY clause.
Finally, from where you are in one row you look to see how many rows away is the data that you want and you add that as the final piece of the LAG function.
You then test out the LAG function in the table before moving it into the real worksheet.
Does this help?
Best wishes
Michael -
SUM THE AMOUNT WITHOUT USING THE OVER COMMAND
hi 2 everybody......
the table contains:
uid billno amount
1 101 100
2 102 200
3 103 300
the o/p shuld be:
uid billno amount total
1 101 100
2 102 200 300
3 103 300 600
i need the query for this pblm without using the over command... please advice... can anyone send immed... thanks in advance...So you still don't bother to write in proper understandable English or probably your keyboard is broken.
Any way you can do this
SQL> WITH t AS (
2 SELECT 1 col_uid, 101 billno, 100 amount FROM DUAL UNION ALL
3 SELECT 2, 102, 200 FROM DUAL UNION ALL
4 SELECT 3, 103, 300 FROM DUAL)
5 -- end test data
6 select col_uid, billno, amount, decode(amount, amount_cum, null, amount_cum) amount_cum
7 from (
8 select t.*, (select sum(amount) from t t1 where t1.col_uid <= t.col_uid) amount_cum
9 from t)
10 /
COL_UID BILLNO AMOUNT AMOUNT_CUM
1 101 100
2 102 200 300
3 103 300 600 -
Sum an amount between a certain date range
Hello,
I am working out a home budget and want to know how to calculate what is due this month.
I have two columns - "Amount" and "Due Date". Some content for an example is:
Amount,Due Date
20,15/05/2009
300,16/05/2009
40,1/06/2009
What I want is a formula which will sum the total amount of items due within this months' date range. If the date range could be as automatic as "This Month" that would be great otherwise I would say IF "Due Date" between 1/05/2009 and 31/5/2009.
Is this possible?In column D, the formula is:
=YEAR(C)*100+MONTH(C)
In B8 and in B9 the formula is:
=SUMIF(D,YEAR(A)*100+MONTH(A),B)
Yvan KOENIG (from FRANCE jeudi 14 mai 2009 15:30:56) -
Strange error in mapping test: Structure with min!=max without mapping
Hi,
a very simple mapping: flatfile 2 Idoc.
in mapping test I'm trying to test it. but I get always a strange error warning:
11:25:12 Teststart Mapping-Objekt MM_XXXXX2WGSREQ is not completely designed. The execution is impossible.
Structure with min!=max without mapping
11:25:12 Testende
What for a problem?
Thanks for any hints!
Regards
ReneHi Rene,
Check the mapping of 1:n occurence and 0:n occurence nodes.
you can find the node in yellow color in the map level.
Regards,
Harish -
Extract fields from the SOAP body during mapping
Hi all,
I have an Abap Proxy to SOAP scenario with a main payload and an attachment. During mapping I need the reference of the attachment to store the reference in the main payload. I don't need the attachment itself.
SOAP-Body:
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
- <!-- Eingangs-Message
-->
- <SAP:Manifest xmlns:SAP="http://sap.com/xi/XI/Message/30" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:wsu="http://www.docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" wsu:Id="wsuid-manifest-5CABE13F5C59AB7FE10000000A1551F7">
- <SAP:Payload xlink:href="cid:payload-E742FF47D930DE5CE1000000C107826A @sap.com">
<SAP:Name>MainDocument</SAP:Name>
<SAP:Description />
<SAP:Type>Application</SAP:Type>
</SAP:Payload>
- <SAP:Payload xlink:href="cid:payload-EE42FF47D930DE5CE1000000C107826A @sap.com">
<SAP:Name>hugo.txt</SAP:Name>
<SAP:Description />
<SAP:Type>ApplicationAttachment</SAP:Type>
</SAP:Payload>
</SAP:Manifest>
I need the attachment reference as string inside my main payload: cid:payload-EE42FF47D930DE5CE1000000C107826A @sap.com
I wrote an user defined function to select the MessageId, but the MessageId is only part of the reference to the main payload.
String constant;
java.util.Map map;
map = container.getTransformationParameters();
constant = (String) map.get(StreamTransformationConstants.MESSAGE_ID);
return constant;
Has anybody an idea to get the reference of the attachment from the SOAP body with an user defined function or an adapter module?
Thanks and kind regards
FrankHello,
thank you all for the information. I found a solution for my problem on the sender side. I wrote an own helper class with the method create_attach_from_txt_withref. This method build an attachment with an own reference and write the reference back to the payload.
This reference will not be changed within the execute_asynchronous method of the proxy.
Method parameters:
P_DATA Importing Type STRING
P_TYPE Importing Type STRING
P_NAME Importing Type STRING
P_ATTACHMENT Exporting Type Ref IF_AI_ATTACHMENT
P_AREF Exporting Type STRING
Method coding:
METHOD create_attach_from_txt_withref.
DATA: lo_attachment TYPE REF TO cl_ai_attachment,
l_payload TYPE REF TO if_xms_payload,
l_pref TYPE sxms_mf_s,
l_guid TYPE guid_32,
l_aref TYPE string.
CLASS cl_ai_factory DEFINITION LOAD.
" create the attachment
p_attachment = cl_ai_factory=>create_attachment_from_text(
p_data = p_data " attachment data
p_type = p_type " attachment type
p_name = p_name ). " attachment name
" we need an implementing class of the interface if_ai_attachment
lo_attachment ?= p_attachment.
" get the new payload
l_payload = lo_attachment->get_payload( ).
" get the reference of the payload
l_pref = l_payload->getreference( ).
" build an own reference
CALL FUNCTION 'GUID_CREATE'
IMPORTING
ev_guid_32 = l_guid.
CONCATENATE 'payload-' l_guid '@sap.com' INTO l_aref.
CONCATENATE 'cid:' l_aref INTO l_pref-href.
" set our own reference
l_payload->setreference( reference = l_pref ).
" write back the modified payload
lo_attachment->set_payload( p_payload = l_payload ).
" return of the reference
p_aref = l_aref.
ENDMETHOD.
If anybody has an idea how to read the soap body within an adapter module please let me know.
Regards
Frank -
How to Sum the amounts for calculating rates.
Hi,
I have a requirement in Apps 11i (OAB) that I need to code in PL/SQL. I would be calling a procedure in order to complete this task. When an Extract is run, this code gets executed and should return the amount for that person.
I need to calculate sum of all the amounts for each of the months between START date to the END date.
Ex: Amount = Amount + (for each of the months between START and END date) x Rate.
This START and END date would be calculated in the procedure itself.(dynamic).
Once we get the START date and END date, we need to loop thru some records and find person's rate between those START date and END date.
For rate calculation:
15th day of any month is used as the cut off date for rate calculation.
Suppose from 01-JAN-2006 to 15-MAR-2006 Rate is Rs 10 AND
16-MAR-2006 to 01-JUL-2006 rate is Rs 20 AND person died on 01-JUL-2006
Then rate = Rs(3x10) + Rs(3x20) + full month of July Rs.20 (P.S Here person's death needs to evaluated for the whole month) =30 + 60 + 20 = Rs.110
Typically the start date and end date would be in one particular YEAR. And person may have different rates for different amounts as mentioned above.
Let me if you need any more details..Thank You!
Additional Info:
This data comes from 2 tables in OAB Application where it can be joined with a common ID.
One table lets say Coverage table contains the usual columns Eff_start_date, Eff_end_date along with this it has Coverage_start_date and Coverage_end_date (Dates specifying duration of the person enrolled in particular coverage.)
P.S Rate Changes ONLY when the person enrolls in different coverage.
2nd Table lets say Rate table contains the usual columns Eff_start_date, Eff_end_date along with this it has rate_start_date and rate_end_date and RATE(column) for that duration.(may vary depending upon the coverage).
All the records should be between the START and END date, which will be calculated at runtime.
Unable to submit any sample records.:-(
Well, IF I had given the exact requirement, I would have got the solution by this Time!!! Your comments (and solutions) would definitely help me. Thank You
Message was edited by:
user559682If i understand you correctly it can be possible with :
Connected to Oracle Database 10g Express Edition Release 10.2.0.1.0
Connected as hr
SQL>
SQL> drop table dates;
Table dropped
SQL> create table dates( "start" date, "end" date, "rate" number);
Table created
SQL> insert into dates values( to_date('01.01.2006', 'DD.MM.YYYY'), to_date('30.05.2006', 'DD.MM.YYYY'), 10);
1 row inserted
SQL> insert into dates values( to_date('01.06.2006', 'DD.MM.YYYY'), to_date('15.09.2006', 'DD.MM.YYYY'), 15);
1 row inserted
SQL> insert into dates values( to_date('16.09.2006', 'DD.MM.YYYY'), to_date('31.12.2006', 'DD.MM.YYYY'), 20);
1 row inserted
SQL> SELECT * FROM dates;
start end rate
01.01.2006 30.05.2006 10
01.06.2006 15.09.2006 15
16.09.2006 31.12.2006 20
SQL> SELECT t.i, d."rate"
2 FROM (SELECT add_months(to_date('01.01.2006', 'DD.MM.YYYY') /* start*/, LEVEL - 1) i
3 FROM dual
4 CONNECT BY LEVEL <= 12) t
5 ,dates d
6 WHERE t.i BETWEEN d."start" AND d."end";
I rate
01.01.2006 10
01.02.2006 10
01.03.2006 10
01.04.2006 10
01.05.2006 10
01.06.2006 15
01.07.2006 15
01.08.2006 15
01.09.2006 15
01.10.2006 20
01.11.2006 20
01.12.2006 20
12 rows selected
SQL> SELECT SUM(d."rate") rs
2 FROM (SELECT add_months(to_date('01.01.2006', 'DD.MM.YYYY') /* start*/, LEVEL - 1) i
3 FROM dual
4 CONNECT BY LEVEL <= 1 +
5 extract(MONTH FROM to_date('10.10.2006', 'DD.MM.YYYY') /*death*/) -
6 extract(MONTH FROM to_date('01.01.2006', 'DD.MM.YYYY') /* start*/)
7 ) t
8 ,dates d
9 WHERE t.i BETWEEN d."start" AND d."end";
RS
130
SQL> -
Validations on table control (Sum of amount field shuold not cross actual amaount))
Hi Experts,
I want to Provide Validations on Table control with Wizard (it should be like when i enter percentange in one column it will caluculate the amount and show it in another column and the sum of that Amount Should not cross the Actual amount).hi Jim,
In the PAI of the Screen A ...
when sy-ucomm = 'BACK'.
Transfer the values in the table control to an internal table itab.
in the PBO of Screen B.
Move the values in itab to table control.
Thanks,
Kasiraman R -
how can I add the amount shown below for year 1999. I would like to add all the amount between 01/22/1999 - 12/17/1999. thank you
here is my simple sql looks like
select sum(l.contamt),b.datelet
from bidlet b, letprop l
where b.LETTING = l.LETTING
and l.LETSTAT='A'
group by b.datelet
Here is my desired out put
Amount year
xxxxxx 1999
xxxxx 2000
xxxxxx 2001
24,692,441 01/22/1999 00:00:00
30,625,058 02/26/1999 00:00:00
810,879 03/16/1999 00:00:00
45,415,715 03/19/1999 00:00:00
34,359,502 04/09/1999 00:00:00
34,967,761 04/23/1999 00:00:00
1,396,831 05/04/1999 00:00:00
40,408,333 05/14/1999 00:00:00
37,556,062 05/28/1999 00:00:00
19,583,374 06/11/1999 00:00:00
45,105,742 06/25/1999 00:00:00
6,096,878 07/23/1999 00:00:00
369,439 08/17/1999 00:00:00
15,293,129 08/27/1999 00:00:00
9,249,995 09/10/1999 00:00:00
9,078,176 09/24/1999 00:00:00
2,153,323 10/22/1999 00:00:00
6,239,335 11/19/1999 00:00:00
26,908,007 12/17/1999 00:00:00user452051 wrote:
how can I add the amount shown below for year 1999.You're very nearly there - all you need to do is convert your dates so they all represent just the year part - you can do this by using the TRUNC function to set the dates to the start of whatever year they belong to:
eg.
TRUNC(sysdate, 'yyyy') -
Group total amount in body margin
I have a group total amount and remark fields placed in the body margin. All the fields are inside a frame, which is set to "All Pages". And all the fields is set to "First Page".
My expected result is that the content will only show at the end of each group. But the fact is that, though they are all using "First Page", but the group total amount appears on every pages while the remark fields work!
Any idea? Thanks!the group total (and remark fields?) should be in a frame outside the grouping frame, not the margin.
-
Testing Config in ID but no Interface mapping found!
Hi,
I am testing configurations I have done in ID and it went all successfully but with one error stating <b>"Interface mapping not found , Runtime error
Unable to read payload from the message object"</b>
after going through some links in SDN ....
I did check the Interface mapping is active and the exact one used in the config.
and did all the chache refreshes in SXI_CACHE and Administration in te main menu of XI start page ,bbut no use.
in SM59 I checked INTEGRATION_DIRECTORY_HMI connection and I got
"Http : 500
Status Tex: Internal Server Error",
i understood from sdn links and readyness check check guide this is not a problem.
so what might be the cause?
thank you.
BabuSatish,
i got doubt ,do you think this is not a problem/
<b>in SM59 I checked INTEGRATION_DIRECTORY_HMI connection and I got
"Http : 500
Status Tex: Internal Server Error",</b>
cos,thats how communication happens between IR and Id right?if there is any error in INTEGRATION_DIRECTORY_HMI connection,I think it might be an issue,but readiness check guide says ok ,in the guide it has not been mentioned that "internal server error is OK""
any comments?
thx -
Sum of amount field in the Query
Hello folks,
I have a amount field in the query, along with the amount field I also need to show sum of all the rows for this amount fields, can some one guide which is best way of doing it?
Thanks,
KKThanks for the response's...Rama, Prasad and Sandesh!
I have changed the Property of the Amount field (SAP Standard Infoobject) to Calculated Result as 'Summation' but when I tried to save the changes in Query designer I am getting following error
runtime error '91'
Object variable or with block variable not set
runtime error '4XX'
ActiveX component can't create object
And its disconnecting from BEX Server...how can I resolve this error?
Thanks,
KK
Edited by: kumar K on Aug 21, 2008 10:46 AM -
Question about mock testing and large amounts of expectations
I have been using mock testing for a while now and it seems really useful. I have one nagging problem with it though. Whenever I write tests that require mock objects that have a lot of calls made on them, my expectations become huge and tedious to write. It seems like there is no way around this either. The expectations must be set to get the object being tested into a certain state.
Can anybody comment on this? I am new to mocking and possibly just not aware of how to handle this problem, or if it can be handled at all. Is my OO design bad if there are tons of expectations to test something?Your design may be too complicated.
You may be unit testing on too high a level.
You may be testing the implementation and not the behavior.
Maybe you are looking for
-
First Date of the Given date and month
Hi Evryone, I want to extract first day of the given date. For Ex: i aam giving date "30-jan-2013" but i want to show "01-jan-2013". In Oracle, Trunc function behaving mentioned above. So i need appropriote function in HANA to get the FIRSTDATE.... I
-
Two topics - One a general question and the other related to Mac OS/X 10.4
I need to update my email address and I can't seem to be able to find a way to do in this forum. Can you help me with that ? The other issue is that since I got my MacBook Pro I am having problems with my USB Flash Drive. Either I can't read from it
-
Can a position be linked to more than one org unit by A012 relation in SRM?
Hi All, In the HR Org structure in ECC, a position (S) can have more than one A012 relation with different organization units (O). For example: S 123 has a A012 relation with Org unit A; validity date: 04/04/2006 to 12/31/9999 S 123 has a A012 relati
-
Rented movie not showing up in iTunes or on AppleTV
I rented two movies before I left and I believe the both dowloanded to my external HD. I unhooked the MacBook Air from the external HD and wasn't able to watch the movies on the plane because iTunes couldn't find them (they were at home on the HD).
-
Creating a photo collage on a Mac
Hi. I'm relatively new to Mac and iPhoto. Is there a way to create a collage of say 15 or 16 pictures so I can print it out as a poster? I know Roxio has a photo program for Windows. Is there an equivalent for Mac? Thank you.