on 2016 May 21 3:06 AM
Hello,
I am doing Graphical mapping from Invoice IDOC to EDI file. Please help me in fixing the following issues I am facing.
1. Under line item (E1EDP01), segment E1EDP05 occurs multiple times. I need to sum all BERTG in E1EDP05 and map it to corresponding line item in the Target. In above scenario we should also consider sign (+ or - ) in ALCKZ while summing.
2. I need to Map Order number in Header to all the line items.
Regards,
Sivaganesh S.
Siva,
1) Please adjust/remove context of input field and use this UDF.
public void udf_sum(String[] var1, ResultList out, Container container) throws StreamTransformationException {
float sum = 0;
for (String string : var1) {
if (string.endsWith("-")) {
string = string.replace("-", "");
sum = sum - Integer.parseInt(string);
} else {
sum = sum + Integer.parseInt(string);
}
}
out.addValue(sum + "");
}
2) Please use copyValue.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
you can concat ALCKZ + BETRG and then SUM function for your first requirement (refer screenshot)
context of ALCKZ and BETRG is set to EIEDP01
the 'lines' in the target structure mapped from E1EDP01 (i.e number of lines)
order can be directly mapped from POSNR
In my example I used 2 lines (E1EDP01) each with 3 E1EDP05 segments
and the result I get after mapping execution is 2 lines with unit price added
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Navdeep Singh,
Thanks for your reply. Regarding 1st point its working fine. I am using same technique for KRATE field, which contains negative sign in it (26.00-). In this case, I used SUM method directly to KRATE, but I am getting exception.
So I used Endswith, Replace and Concatenate function to bring the - sign in front (-26). But - sign is concatenating for both positive and negative values. Please find the below mapping I used.
Please advice me how to map directly without replace function in else part or please tell me is there any other technique to bring - sign before number. Thank you.
Regards,
Sivaganesh S.
User | Count |
---|---|
66 | |
10 | |
10 | |
10 | |
10 | |
8 | |
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.