on 03-25-2016 12:14 PM
Hi Experts,
Scenario is IDOC INVOIC02 to EDI(EANCOM). Please help me to create the mapping for the below requirement.
In the Idoc having the field KSCHL contains constants ZDR3 and ZDR5.
There is a target field D_5004 in which it should hold the total value of ZDR3 and ZDR5 for all the Idocs but it follows the logic mentioned below:
case 1: if the IDoc contains only ZDR3 then the corresponding value should be summed up.
case 2: if the IDoc contains both ZDR3 and ZDR5 then the value of ZDR5 should be taken as the account. ZDR3 must be omitted.
Example,
Below there are 2 IDOCS
So, D_5004 value should be 194.07 (180.87 + 13.20)
1st IDOC
2nd IDOC
Thanks,
Gopi
Hi Gopi,
You can use below UDF.
Execution Type: All Values Of Context
public void mapD5004(String[] kschl, String[] betrg, ResultList result, Container container)
throws StreamTransformationException {
Map<String, String> map = new HashMap<String, String>();
for (int i = 0; i < kschl.length; i++) {
map.put(kschl[i], betrg[i]);
}
if (map.containsKey("ZDR3") && map.containsKey("ZDR5"))
result.addValue(Double.parseDouble(map.get("ZDR5")) + Double.parseDouble(map.get("ZDR3")));
else if (map.containsKey("ZDR3") && !map.containsKey("ZDR5"))
result.addValue(map.get("ZDR3"));
}
Mapping:
Regards,
Praveen.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Praveen,
Thanks for your reply. Issue is resolved by including sum function next to mapD5004.
Regards,
Gopi
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 | |
25 | |
12 | |
9 | |
6 | |
6 | |
5 | |
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.