on 09-02-2009 12:59 PM
Hi
I am using standard idoc INVOIC02. I need summarized amount of menge where partn = north and south at the target. The structure is something like this.
E1EDP01
--MENGE
--E1EDP05
--PARTN
Please advice.
Regards
Monika
MENGE..>removeContext...>\
....UDF....Target field
PARTN.....>removeContext..>/
UDF.Choose context while creating the UDF
int sum=0;
for(int i=0;i<PARTN.length;i++)
{
if(PARTN<i>.equals("north")||PARTN<i>.equals("south")
{
int a = Integer.parseInt(MENGE<i>);
sum = sum +a;
}
}
String res = String.valueOf(sum);
result.addValue(res)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
In the above structure there is no PATNR field under E1EDP01 segment
also Do you want sum of PATNR =north and PATNR =south separately?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
>> I want the sum separately. Can you please provide more clarity on your solution.
Hint: If you want to sum separately then you have to duplicate the target node which contains the sum. I think it is possible without using any udf try the solution which I have give to you in my earlier reply.
First of all filter the menge based on partn by if conditon then use the remove context in the output of if conditon and then use SUM function from statistic.
e.g.
if (partn = north or south) then (MENGE) --- removeContext - SUM- Target.
--Sarvesh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
> It is working without the udf also. However i am not getting the result based on the filter say suppose "NORTH". It is giving me the grand total of all the menge irrespective of PARTN.
Since you want two results in one field (one for north and another for south) therefore first you duplicate the target node in which menge is present then use the below logic in each mapping.
if (PARTN = NORTH ) then (MENGE) --- RemoveContext --- SUM--- Target1.
if (PARTN = SOUTH) then (MENGE) --- RemoveContext --- SUM--- Target2.(Duplicate MENGE)
Othewise let me know your exact requirement.
Regards,
Sarvesh
Hi Sarvesh
Please refer to standard idoc INVOIC02. It has a segment e1edp01 which contains a field MENGE. It also contains another segment E1EDPA1 which contains a field PARTN. Now i want the sum of menge for PARTN = NORTH and SOUTH sepately. However even after hndling context i get sum of all values as PARTN lies in the context of MENGE.
Regards
Monika
<INVOIC02>
<MANDT>050</MANDT>
<DOCNUM>0000000057208371</DOCNUM>
<E1EDK01>
<CURCY>USD</CURCY>
<WKURS>1.00000</WKURS>
</E1EDK01>
<E1EDP01>
<POSEX>00001</POSEX>
<ACTION>001</ACTION>
<PSTYP>0</PSTYP>
<MENGE>50.000</MENGE>
<MENEE>PC</MENEE>
<EDPA1>
<PARVW>ZS</PARVW>
<LIFNR>0004000073</LIFNR>
<NAME1>ZEICHMAN MANUFACTURING INC.</NAME1>
<STRAS>5985 CLAY AVENUE SW</STRAS>
<ORT01>Grand Rapids</ORT01>
<PSTLZ>49548</PSTLZ>
<LAND1>US</LAND1>
<REGIO>MI</REGIO>
<EDPA1>
</E1EDP01>
<E1EDP01>
<POSEX>00002</POSEX>
<ACTION>001</ACTION>
<PSTYP>0</PSTYP>
<MENGE>40.000</MENGE>
<MENEE>PC</MENEE>
<Z1EDPA1></Z1EDPA1>
</E1EDP01>
<E1EDP01>
<POSEX>00003</POSEX>
<ACTION>001</ACTION>
<PSTYP>0</PSTYP>
<MENGE>90.000</MENGE>
<MENEE>PC</MENEE>
<EDPA1>
<PARVW>ZS</PARVW>
<LIFNR>0004000073</LIFNR>
<NAME1>ZEICHMAN MANUFACTURING INC.</NAME1>
<STRAS>5985 CLAY AVENUE SW</STRAS>
<ORT01>Grand Rapids</ORT01>
<PSTLZ>49548</PSTLZ>
<LAND1>US</LAND1>
<REGIO>MI</REGIO>
<EDPA1>
</E1EDP01>
<INVOIC02>
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.