on 04-17-2015 2:12 PM
Hi All,
Requirement is PI has to sum up the amount value in message mapping
E1EDP01 ->E1EDP04 ->MWSKZ-SD--> MWSBT(amount value).
E1EDP04 SD occurs 5 times in one line item and during summation 3rd one in sequence should be ignored and rest all 4 should be summed up.
Invoice Idoc may have multiple line items.Please let me know how to achieve this in java code.
Regards,
Karthiga
Try function sum
you need to change context of source element, to an up level
if you don't change context, then only get first value, like you say
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
If you are sure that it always occurs 5 times and you always have to ignore the third occurrence.
Try below graphical mapping
Your input should be at lineitem level (instead of using remove context, right click and choose the context)
if you expect some without any sd, then you might want to try this
Message was edited by: Hareesh Gampa
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Hareesh,
I guess this sum function loses the decimal values and thats why I have chosen java udf.
double taxvalue = 0;
NumberFormat formatter = new DecimalFormat("#0.00");
for(int i=0;i<tax.length;i++)
{
if (tax[i].equals(ResultList.CC))
{
result.addValue(formatter.format(sum));
sum=0;
taxvalue=0;
}
else
{
if( (! (tax[i].equals("") ) ) && (tax[i]!=null))
{
taxvalue=Double.valueOf(tax[i]).doubleValue();
sum=sum+taxvalue;
}
}
}
result.addValue(formatter.format(sum));
But not sure how to skip the third value from each context.
Regards,
Karthiga
User | Count |
---|---|
84 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.