cancel
Showing results for 
Search instead for 
Did you mean: 

Message Mapping Problem

Former Member
0 Kudos

Hi Everybody,

i have the following problem ans hope thet anybody can help me.

i have an input xml file. A part of it seems like this:

L_ANF_TEXT

-item

--EBELP

--TDID

.....

my ouput message seems like this:

Langtexte

- ebelp

- tdid

my problem is that the output message have at every part have 1..1 as occurences.

The Part in the input message have an occurences from 0..1.

How can i do that in the message mapping.

I hope anybody can help me

Best Regards

Markus

Accepted Solutions (1)

Accepted Solutions (1)

Shabarish_Nair
Active Contributor
0 Kudos

Your source has an occurrence of 0-1 and target 1-1.

There are two ways you can handle it.

1. Make sure your source system always sends data

2. Do a check and in case there is no data i.e the node does not exist in the source then pass an empty constant. This empty constant should be interpreted at the target as that the source didnt send any data.

                          Then - (Pass source field)
source field - EXIST -> IF                                                -> Target
                                   Else - (Pass Empty Constant)

Former Member
0 Kudos

i have do it with the if-then-else like this

L_ANF_TEXT

-item

--EBELP

Langtexte

-EBELP

if item exist then item to langtexte else constant 0 to langtexte - that works fine.

if ebelp exist then ebelp to ebelp else constant 0 to ebelp - that works only fine when item exist. when item not exits i get an error by testing:

Cannot produce target element /Anfrage/Langtexte/ebelp. Check xml instance is valid for source xsd and target-field mapping fulfills requirements of target xsd

Best regards

Markus

Shabarish_Nair
Active Contributor
0 Kudos

>

> if ebelp exist then ebelp to ebelp else constant 0 to ebelp - that works only fine when item exist. when item not exits i get an error by testing:

try

EBELP -> mapwithdefault -> EBELP

Former Member
0 Kudos

Hi,

The best solution for this kind of mapping is to use standard function MapWithDefault. Just double click on MapWithDefault and enter some constant value, so that whenever your source field is empty then default value will be mapped to your target source.

Regards,

Sarvesh

Former Member
0 Kudos

i get the same error

Former Member
0 Kudos

Do the same as I mentioned in my reply...

Former Member
0 Kudos

i do that but i get the same error

i had:

item-> then

item -> exits -> if -> Langtexte

item -> mapWithDefault -> else

and

ebelp-> then

ebelp -> exits -> if -> ebelp

ebelp -> mapWithDefault -> else

but it doesn´t work.

i get any time the same error

Former Member
0 Kudos

Markus,

do it with the MapWithDefault option as I stated above. This is the right way. In the function you may specify a constant or just "". This will work.

Regards,

Kai

Former Member
0 Kudos

sorry i missunderstand it and do it now right

now it works thank you

Former Member
0 Kudos

No need to use exists function when you are using mapWithDefault.

The mapping will be simple like this....

> i had:

>

> item-> then

> item -> exits -> if -> Langtexte

> item -> mapWithDefault -> else

>

item ->mapWithDefault--> Langtexte.

> and

>

> ebelp-> then

> ebelp -> exits -> if -> ebelp

> ebelp -> mapWithDefault -> else

>

ebelp ---> mapWithDefault --->ebelp.

Former Member
0 Kudos

Glad it worked finally ;o)

Answers (4)

Answers (4)

former_member200962
Active Contributor
0 Kudos

Hi,

use Source --> exists --> createIf --> target

Regards,

Abhishek.

Former Member
0 Kudos

You could do this way:

IF souce field EXISTS => map to target field

ELSE => MAP WITH DEFAULT

This way you will definetely create a target field! If the content (in case the source field is not existing) of the target field is not required to be filled with a specific value - that's you solution.

Kai

jyothi_anagani
Active Contributor
0 Kudos

Hi,

Please use node functions.........

More help refer this blog........

/people/sravya.talanki2/blog/2005/12/08/message-mapping-simplified-150-part-ii

/people/sravya.talanki2/blog/2005/08/16/message-mapping-simplified--part-i

Thanks.

markangelo_dihiansan
Active Contributor
0 Kudos

Hi Markus,

Please provide the complete source and target structure, along with their cardinality, to help us visualize more into the problem.

Regards,