cancel
Showing results for 
Search instead for 
Did you mean: 

EDI Mapping-at invoice Level

Former Member
0 Kudos

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

Accepted Solutions (1)

Accepted Solutions (1)

former_member182412
Active Contributor
0 Kudos

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.

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Praveen,

Thanks for your reply. Issue is resolved by including sum function next to mapD5004.

Regards,

Gopi