cancel
Showing results for 
Search instead for 
Did you mean: 

Mappingproblem

Former Member
0 Kudos

Hi.

I have a mapping using the INVOIC02 IDoc.

I'm using data in the E1EDK03 segment to populate a field in the E1EDP02 segment.

In the explenation I will just present the effected segment and fields.

Source:

<INVOIC02>
	<IDOC BEGIN="">
		<E1EDK03 SEGMENT="1">
			<IDDAT>012</IDDAT>
			<DATUM>20100520</DATUM>
		</E1EDK03>
		<E1EDK03 SEGMENT="2">
			<IDDAT>044</IDDAT>
			<DATUM>20100525</DATUM>
		</E1EDK03>
		<E1EDP01 SEGMENT="">
			<E1EDP02 SEGMENT="">
				<QUALF>001</QUALF>
			</E1EDP02>
			<E1EDP02 SEGMENT="">
				<QUALF>012</QUALF>
			</E1EDP02>
			<E1EDP02 SEGMENT="">
				<QUALF>021</QUALF>
			</E1EDP02>
		</E1EDP01>
	</IDOC>
</INVOIC02>

When the IDDAT in E!EDK03 has the value 012 the DATUM field should be populating the DATUm field in E!EDP02 if the QUALF field in the same segment has the value 012.

I tried a UDF to acomplish this. It looks as bellow.

public void P02DATUMQALF012(String[] var1, String[] var2, String[] var3, ResultList result, Container container) throws StreamTransformationException{
String text = "";

  for (int i=0; i<var1.length; i++) {

    if ( var1<i>.equals("012") ){
      text = var2<i>; 
	}
   }

  for (int i=0; i<var3.length; i++) {
    if ( var3<i>.equals("012") ){
       result.addValue(String.valueOf(text));
 	}
    else {
       result.addValue("");
	}
   }
}

With this UDF I and SplitByValue after it I get the following result.

<INVOIC02>
	<IDOC BEGIN="1">
		<E1EDK03 SEGMENT="1">
			<IDDAT>012</IDDAT>
			<DATUM>20100520</DATUM>
		</E1EDK03>
		<E1EDK03 SEGMENT="2">
			<IDDAT>044</IDDAT>
			<DATUM>20100525</DATUM>
		</E1EDK03>
		<E1EDP01 SEGMENT="1">
			<E1EDP02 SEGMENT="1">
				<QUALF>001</QUALF>
				<DATUM/>
			</E1EDP02>
			<E1EDP02 SEGMENT="2">
				<QUALF>012</QUALF>
				<DATUM/>
			</E1EDP02>
			<E1EDP02 SEGMENT="1">
				<QUALF>021</QUALF>
				<DATUM>20100520</DATUM>
			</E1EDP02>
		</E1EDP01>
		<E1EDP01 SEGMENT="2">
			<E1EDP02 SEGMENT="1">
				<QUALF>001</QUALF>
				<DATUM/>
			</E1EDP02>
			<E1EDP02 SEGMENT="2">
				<QUALF>012</QUALF>
				<DATUM/>
			</E1EDP02>
			<E1EDP02 SEGMENT="1">
				<QUALF>021</QUALF>
				<DATUM/>
			</E1EDP02>
		</E1EDP01>
	</IDOC>
</INVOIC02>

What am I doing wrong?

BR

Kalle

Accepted Solutions (1)

Accepted Solutions (1)

stefan_grube
Active Contributor
0 Kudos

I do not see anything wrong, but this is not possible to say just from an extract from the payload.

When you do test, then check the input and output queues of your UDF.

I suppose that the context of the queues are not correct.

Former Member
0 Kudos

Sorry mised that

var1 = IDDAT (E1EDK03)

var2 = DATUM (E1EDK03)

var3 = QUALF (E1EDP02)

will present queues as follow.

value = white line in queue

value = grey line in queue

var1 queue:

012

012

044

044

var2 queue:

20100520

20100520

20100525

20100525

var3 queue:

001

001

012

012

021

021

Result queue:

[]

[]

20100520

[]

[]

[]

Looks as the resultqueue has no context and making to many [] entrys.

I would like the resultqueue to look as follow:

Result queue:

[]

[]

20100520

20100520

[]

[]

BR

Kalle

stefan_grube
Active Contributor
0 Kudos

In UDF you have set attribut "all values of queue". This is wrong. Use parameter "all values of context".

Former Member
0 Kudos

Then the resultqueue looks as follow.

Result queue:

[]

[]

[]

[]

[]

[]

The date does not get transfered to the queue.

//Kalle

stefan_grube
Active Contributor
0 Kudos

Then keep the attributes to queue and add this code:

for (int i=0; i<var3.length; i++) {
   if (  !var3<i>.equals(ResultList.CC)){
    if ( var3<i>.equals("012") ){
       result.addValue(String.valueOf(text));
 	}
    else {
       result.addValue("");
	}
   }
}

Edited by: Stefan Grube on Oct 21, 2010 10:19 AM

stefan_grube
Active Contributor
0 Kudos

> In UDF you have set attribut "all values of queue". This is wrong. Use parameter "all values of context".

When you use this attribute, then you have to change the context of all input values to root node.

Edited by: Stefan Grube on Oct 21, 2010 10:24 AM

Former Member
0 Kudos

Greate.

Thanks for the help that solved it.

BR

Kalle

Answers (0)