cancel
Showing results for 
Search instead for 
Did you mean: 

Message mapping problem

Former Member
0 Kudos

Hi,

I have one mapping problem. The source xml has element, which has a numeric value. In the target XML (FIDCCP02-idoc) one node (E1FISEG) should be generated as many times as the value is. Is this possible in message mapping?

Accepted Solutions (1)

Accepted Solutions (1)

MichalKrawczyk
Active Contributor
0 Kudos

Hi Tapio,

yes it is

you have to create a user function

which will create as many contexts as the values

in this element (in a loop for example)

and then you'll have many segments

E1FISEG <-- this node must have occurance 0..unbounded

of course to do that

Regards,

michal

Shabarish_Nair
Active Contributor
0 Kudos

you can maybe try a code like this;

int node = a[0].parseInt();

for(int i=0; i<=node; i++)

{

result.addvalue(a[0]);

}

you pass the particular field which carries the numeric value to the User Def Fun. and map it to the node E1FISEG.

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi,

You could solve this using message mapping, with a user defined function.

<tag>-->userdefined func-> split by value-><Ttag>

in the user defined function, write a logic which would take the value as input and add an empty element(or "") to a resultlist container.

Now, for each element in the resultlist container, a splitbyvalue will be occuring.

i.e, for each element in the container,a <Ttag> element will be created.

Also, you would have to use split by value node function for the parent of <Ttag>, since, for each <Ttag> there must also be a parent created.

Regards,

Smitha.

Former Member
0 Kudos

Hi Tapio,

All you have to do is map your field to the field in segment E1FISEG.

Then Map node E1FISEG with the node in which your field is existing and change the context to one step up.

Also, put split by value.

So if ur sender structure looks like

<header>

<node>

<field>

</field>

</Node>

<Header>

then map the field to the field in segment E1FISEG.

map node to E1FISEG. Change the context to Header and put split by value

Regards

Vijaya