cancel
Showing results for 
Search instead for 
Did you mean: 

Mapping issues while using MapwithDefault Node function for Idoc

Former Member
0 Kudos

Hi Experts,

We are facing issues while trying to generate nodes at reciver side even though it does not exist at sender side.

we are using the matmas05 and we want the nodes E1marcm and e1mardm to generated at target structure.

the structure is like this

Matmas05

idoc

E1maram

segment

E1marcm

segment

msgfn

.....other fields

E1mardm (can be many segments)

segment

lgort

..other fields

E1mpgdm

segment

...e1mpgdm fields

the mapping has been done like:

e1marcm -mapwithdefault-e1marcm

constant -segment

werks-mapwithdefault-werks

other fields(one to one mapping)

e1mardm-mapwith default-e1mardm

lgort-mapwithdefault(value 1000)-lgort

other fields -one to one mapping

now the problem we are facing is when e1mardm is not existing in source structure the values from the other node of e1mardm(which exists) are getting overwritten into it.

we want only the lgort to be 1000 and the segment should populate at target side.

like

e1mardm

segment

lgort value 1000

Could you please assist in solving this issue and give your valuable suggestions as how could we handle it.

Thanks and regards,

jyoti

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

thanks experts

Former Member
0 Kudos

U will achieve this using UDF function. Map the below Like.

e1mardm-mapwith default(Value Constant)-e1mardm

lgort (A) ---

e1mardm-mapwith default(Value Exit)u2014(EqualsS) (B)- (UDF1)- lgort

Constant(Value Exit)---

Constant(Value 1000)(C)---

Other one to one mapping fields also you should use one more UDF.

Other one to one fields (A) ---

e1mardm-mapwith default(Value Exit)u2014(EqualsS) (B) - (UDF2)- Target

Constant(Value Exit)---

UDF1:

Argument A,B,C and select queue.

//write your code here

int j = 0;

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

{

if (b[j].equals("true"))

{

result.addValue(c[0]);

i--;

result.addValue(ResultList.CC);

}

else

result.addValue(a<i>);

j++;

}

UDF2:

Argument A,B and select queue.

//write your code here

int j = 0;

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

{

if (b[j].equals("true"))

{

i--;

result.addValue(ResultList.CC);

}

else

result.addValue(a<i>);

j++;

}

JoelTrinidade
Active Contributor
0 Kudos

Hi Jyoti,

Sometimes there are a lot of fields in your idoc that you dont need . These unnecessary fields can be suppressed. Refer to the blog

How to check empty idoc fields in user defined function

This above is not a solution to you problem but its a different approach.

Rgds

joel.