on 11-28-2007 4:41 AM
Hi,
We have a requirement:
<b>There could be 1 to N of ZSEG01 and for the ZSEG01 segment there could
be 0 to N of ZSEG20.
In Z_QTY should come the
ZSEG01-FLD1 minus the sum of all the corresponding ZSEG20-FLD1_1
Z_QTY(1) should only be created when at least
one ZSEG20 exists and then
in Z_QTY(1) should come the
sum of all the corresponding ZSEG20-FLD1_1</b>
I understand that this could be done using queued UDF .
can anyone please provide me the code for this so as to enable us to to satisfy this requirement.
Kindly reply at swalaska@in.ibm.com
This is quite urgent for us.
Thanks a lot in advance.
Best Regards,
Shweta
Hi Shweta,
As far as I getting it is that first u need to have a check for the ZSEG01 segment.If it exist then you need a counter to add how many times ZSEG20 is coming .Keep that in the global variable.After that you call the that global variable in the Z_QTY segment to populate the value.
If you find this helpful reward with points.
Thanks
Arijit
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
could you provide your source n target structure with an example of your requirment
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Arvind,
I have changed the segment names just to give an example of the requirement and cant give the exact structure names since it is specific to our project.
But I can generalise the requirement as:
Its an IDoc-to-File scenario where a segment acts as a header(occurence 1..N) and can have child elements associated to it (occurence 0..N)
we have to sum up a field in child elements corresponding to the header and then subtract the sum from a field in the header and then map this result to a field in File.
Kindly let me know if this is clear to you now.
Thanks!
Best Regards,
Shweta
Shweta,
Try this UDF
(add all fields from child node and subtract with header node based on context)
2 variables as input
First is the header field
Second the field from child node -- For this change the Context to the header
While creating UDF select "context"
String[] ret = new String[1];
int sum1=0;
for (int i=0;i<b.length;i++)
{
sum1 = sum1 + Integer.parseInt(b<i>);
}
sum1 = sum1- Integer.parseInt(a[0]);
ret[0] = String.valueOf(sum1);
result.addValue(ret[0]);
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.