cancel
Showing results for 
Search instead for 
Did you mean: 

mapwithdefault

Former Member
0 Kudos

Hi

Could any one explain when to use mapwithdefault function. Could anyone explain with a simple example?

Also need explanation on:

Copy value

Fix value

thnx

Accepted Solutions (1)

Accepted Solutions (1)

sunil_singh13
Active Contributor
0 Kudos

Hi Mahesh ,

MapwithDefault :

IT is required when you wish to send some default value if input is null (Nothing) .If input is not null it will just simply pass the value coming from source .

e.g

[null] -> [ABC] -> [ABC]

Source MapWithDefault Target

[XYZ] -> [ABC] -> [XYZ]

Source MapWithDefault Target

FixValue :

There may be requirement when you wish to send some difeerent value for a particular input

eg.

[Boy] -> [Boy -> Male] -> [Male]

Source FixVlaue Target

[Girl] -> [Boy -> Male] -> [Girl]

Source FixVlaue Target

in above example i wish to replace the field which has value Boy with Male so the FixValue will do the trick. .

while if value is other than male it will pass that value as it is to target.

Copy value :

suppose you have input as 1. name

2.salary

3.Add

and you want to display it like name salary Add

so use CopyValue .In this you have give position of value you wold like to retriev.

If HelpFul Reward Points

Thanks

Sunil Singh

Answers (6)

Answers (6)

former_member556603
Active Contributor
0 Kudos

Hi,

Go through this link...All standard functions are availabale....

http://help.sap.com/saphelp_nw04/helpdata/en/43/c4cdfc334824478090739c04c4a249/content.htm

/people/stefan.grube/blog/2005/12/29/new-functions-in-the-graphical-mapping-tool-xi-30-sp13

mapWithDefault Replaces empty contexts in the inbound queue with a default value, which you specify in the function properties.

Example:

If Default is the default value and

A|B1,B2| |C| |D

is the inbound queue

then mapWithDefault gets the following outbound queue:

A | B1,B2 | Default | C | Default |D.

The function corresponds to the following combination of standard functions:

If(

[]field,

exists([]field),

Constant([value=default]))

Thanks,

Satya

stefan_grube
Active Contributor
0 Kudos

You find an example here:

/people/stefan.grube/blog/2005/12/29/new-functions-in-the-graphical-mapping-tool-xi-30-sp13

Former Member
0 Kudos

Hey,

heres copy value.

You use CopyValue() for a frequently occurring element to copy the value of a position in the source structure and assign it to a target field. The value is copied each time the target field occurs in the target structure. However, it is copied a maximum of maxOccurs times

Former Member
0 Kudos

Hi Mahesh,

mapwithdefault function is explained with example at below link:

[/people/stefan.grube/blog/2005/12/29/new-functions-in-the-graphical-mapping-tool-xi-30-sp13|/people/stefan.grube/blog/2005/12/29/new-functions-in-the-graphical-mapping-tool-xi-30-sp13]

Regards

Bhanu

Intelligroup.

Former Member
0 Kudos

Hi Mahesh,

mapwithdefault: we use this node function when we want to transfer some by default value to target.

example:

Source>mapwithdefault>Target

in this example if Source element does not exists in the source XML structure then the default value you specified will be transferred to Target.

copyValue: we use it to copy a value at a specified index from an input queue. it will transfer that value as a constant to the target.

Fix Value: It is a constant we use to transfer a spefied constant value to the target.

*Reward points if helpful

--Sankar Choudhury

Former Member
0 Kudos

Hi Mahesh,

In some cases, you might not have a value for a specific field in the source. But that field is mandatory for mapping. In such case what will happen. Mapping will fail and message processing will be stopped.

To avoid such situations, if value does not exist for a specific mandatory field, you do a kind of validation with the help of this mapwithdefault function and you are going to assign a default value when no value exists.

Regards

Bhanu

Intelligroup.

Former Member
0 Kudos

Hi Mahesh

mapWithDefault:

Replaces empty contexts in the inbound queue with a default value, which you specify in the function properties.

Example:

If “Default” is the default value and

A|B1,B2| |C| |D

is the inbound queue,

mapWithDefault returns the following outbound queue:

A | B1,B2 | Default | C | Default |D.

Regards

Abhishek

**please reward points if helpful*