cancel
Showing results for 
Search instead for 
Did you mean: 

EDI Mapping

Former Member
0 Kudos

Hi Experts,

In the scenario IDOC (INVOIC02) -->EDI(EANCOM)  I am facing an issue in the mapping part.

below are the Idoc source fields:-

KSCHL --  ZDR3 and ZDR5 (Constants)

Can anyone please help me to create the mapping based on the below cases:

case 1)  Suppose if a Idoc contains only ZDR3 (field KSCHL)  then the mapping has to be created that accepts the value of 621.16

case 2) If a Idoc contains both ZDR3 and ZDR5(as per above screenshot) then it should accepts the value 13.20(target node D_5004)

The above mapping  displays the value  13.20.

Thanks,

Gopi

Accepted Solutions (1)

Accepted Solutions (1)

former_member182412
Active Contributor
0 Kudos

Hi Gopi,

Use below mapping.

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(map.get("ZDR5"));

  else if (map.containsKey("ZDR3") && !map.containsKey("ZDR5"))

  result.addValue(map.get("ZDR3"));

  }

Regards,

Praveen.

Answers (2)

Answers (2)

Former Member
0 Kudos

Thanks for your quick response.

@Ramesh, I have tried mapping part but the result is, target value assigned only for the first Idoc.

Suppose in the source structure contains 2 IDOCS then mapping resulted the value for the first IDOC and for rest all of the Idocs the target value is missing/empty.

1)IDOC>EIEDK05


                KSCHL  BETRG

                   ZDR3      10          


2) IDOC>EIEDK05(2)

                    ZDR3      12

                     ZDR5       2


Resultant:


1)IDOC ---  D_5004     10

2)IDOC ---  D_5004   (empty) the actual value is 2

Please suggest on how to resolve this.

Then I tried  UDF and worked finally.


Regards,

Gopi

former_member213558
Active Participant
0 Kudos

good to here that your issue resolved, and add 'SplitbyValue - each value' after "if' condition then it should work.

former_member213558
Active Participant
0 Kudos

use below mapping and it's been tested, working fine.

first AND condition's field change the context as IDOC, rest of all the the default context, and use sort by descending option.

do let me know it works.