cancel
Showing results for 
Search instead for 
Did you mean: 

Mandatory parameters in mappings

Former Member
0 Kudos

Hello

I am having a mapping where few parameters are mandatory in the target map.I made the MinOccurs and MaxOccurs as 1 for these fields. Still if sometimes the field is missing is source message the mappings executes flawlessly and delivers the file to the target system (my target system is flat file interface) without generating the mandatory field.

Can anyone tell me whether the map will fail at runtime if mandatory parameters did'nt get generated or not? If not then can there be the way to fail the map?

Thanks in advance.

Regards

Rajeev

Accepted Solutions (1)

Accepted Solutions (1)

former_member185751
Contributor
0 Kudos

Hi,

If you are using Graphical Mapping:

If you don't map a mandatory target field, it will shown in red in graphical mapping.Altough it will " save" successfully, When you use the TEST tool in IB it will complain as "Mapping object <Your Mapname> incomplete. Unable to continue execution". So you can debug at this point itself to map the mandatory field.

During activation it will complain "Mapping not sufficiently defined".

If you are NOT using Grpahical mapping:

Then your XSLT map/Java Map may create the target message without mandatory fields.

In this case, You can validate your transformed XML message against the XSD for conformation.

Regards,

Sridhar

Answers (3)

Answers (3)

Former Member
0 Kudos

Hello Rajeev,

Just to avoid too much confusion: An error will be raised automatically by the mapping tool if a mandatory field (minOccurs > 0) cannot be filled at runtime. So the answer to your question is "yes". You do not have to worry about it!

Best regards

Joachim

> Can anyone tell me whether the map will fail at

> runtime if mandatory parameters did'nt get generated

> or not?

MichalKrawczyk
Active Contributor
0 Kudos

Hi,

you can take a look at this weblog by Sridhar

to see how you can raise exceptions in the mapping:

/people/sap.user72/blog/2005/02/23/raising-exceptions-in-sap-xi-mapping

Regards,

michal

MichalKrawczyk
Active Contributor
0 Kudos

and then raise this exception

with the function exists :

Regards,

michal

Former Member
0 Kudos

Michal,

I looked at that weblog.Really helpful.Also I developed my own Java class to implement custom logic.

But I guess this class (which implements StreamTransformation interface) gets executed once mappings program gets over.For the same it is included in Interface mappings.

I tried to include this class in my interface map but seems XI does not allow to add the line in Mappings program if the interface map has got 2 source interfaces (multimap) and a single target (Add line button is disabled in case of 2 sources and one interface) and unfortunatly I am having 2 source interfaces and one target.

Can't we use that incase of multi-map?

Regards

Rajeev

Former Member
0 Kudos

Hi Rajeev,

You can use Java Functions while message mapping and not during the interface map. For this use the "simple Function" available on the left bottom corner of the graphical editor.

Here you can specify the name of the function and also write the code.Then you can use this function where you need to map using this. Hope this is wat u wanted.

Regards,

Divya

Former Member
0 Kudos

Hi Rajeev,

If you have defined fields as mandatory in the target map and if you don't populate them , the mapping will fail at runtime.

You should use an exists on the source message element and accordingly map a constant(empty string) to the required fields.

Naveen