on 11-25-2008 7:14 AM
Hi All,
I have the following Req...File----Idoc Scenario
In the Inbound xml file i will get the Sales Order details with suppose 10 line items( 10 Orders)
Each line item represents one one SO. So totally i wil have 10 Sales Orders in this file.
<?xml version="1.0" encoding="UTF-8"?>
<ns0:MT_Sales_Order xmlns:ns0="http://sap/Sales_Order">
<Header>
<COMP_CODE></COMP_CODE>
<DOC_TYPE></DOC_TYPE>
<SUPPL_VEND></SUPPL_VEND>
</Header>
<Item>
<ITEM></ITEM>
<MATERIAL></MATERIAL>
<PLANT></PLANT>
<QUANTITY></QUANTITY>
<Amount></Amount>
</Item>
In the above structure Item Segment will repeats as many no. of Sales Orders comes in a file.
In a file if there are 10 Orders means the Item segment wil repeats 10 times.
I have the Amount field in the Item Segment, each and every time that needs to be added to next Amount value that presents in the next Line Item.
Finally i will have the Another separate field caled Grand Total, and i have to get the total summation of the 10 values of the Amount field at last.
Can we achieve this using UDF or is there any way to do this
REgards
Check with below mapping
DISCOUNT----->EqualsS--->Constant(ZE)-------->\if
---------->Sum---->Target
AMOUNT ----->/then
Change the context of DISCOUNT and AMOUNT to higher level
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Use statistics function SUM, set the proper context or use
Amount ->removeContext->SUM--->GrandTotal
Thanks!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
I have another check in the incoming data to do sum.
In the incoming file if the field Discount Type is equals to ZE means i have to add those values only.
i have placed the condition like this , but it is calculating the sum irrespctive of the condition
http://img266.imageshack.us/my.php?image=15129719ih9.jpg
Regards
write a simple UDF
sumOfDiscountType ( String[] discountType, String[] amount, result )
{
int sum = 0;
for ( int i = 0; i < discountType.length; i++ )
{
if ( "ZE".equalsIgnoreCase( discountType[ i ] )
{
sum += Integer.parseInt( amount[ i ] );
}
}
result.addValue ( sum );
}
pass two params..
discountType (removecontext) ----
| -----UDF ----Total
amount ( removecontext) ----
Edited by: Anand on Nov 25, 2008 4:02 PM
Hi,
Do like this, actually in your case sum is taking place before the condition check for discount type
do a little change in mapping
DiscntType--removeContext--
EqulsS-------IfWithoutElse----Amount---removecontext--then---SUM-
Connstatnt(Value)
--->GrandAmount
Krishna, Check the same question asked by Rajesh in thread
Thanks!
User | Count |
---|---|
84 | |
24 | |
11 | |
9 | |
7 | |
6 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.