cancel
Showing results for 
Search instead for 
Did you mean: 

Standard functions

Former Member
0 Kudos

Hi experts

Could anybody explain me with an example use of following functions:

CopyValue

FixValue

FormatByExample

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

HI

If we have a requirement one node at sender side occurs only once but many times it needs at receiver side then this case we need node functions.

For sorting the data either ascending/decending order, remove the context of particular node.

We have one node at sender side that is not mandatory at sender side but it is mandatory at receiver side then we can use map with default node function.

Node functions are used in Real time when the occurance of receiver fields is multiple and needed various complex logics to be added.

Copy Value: We can use this to copy the value of a position in the source structure and assign it to a target field for frequently occurring source structure element. The value is copied each time the target field occurs in the target structure.

Fix value: is someting like a look up..

where in conversion u will have a key and a corresponding value for it that has to be the output of the mapping

Format by example : Takes values from first queue and inserts them in structure of second queue.

Refer the below links for further assistance

Check this weblog where claus have mentioned with examples:

/people/sundararamaprasad.subbaraman/blog/2006/02/21/real-example-for-formatbyexample

/people/claus.wallacher/blog/2006/04/17/replication-of-nodes-using-the-graphical-mapping-tool

/people/claus.wallacher/blog/2006/06/29/message-splitting-using-the-graphical-mapping-tool

/people/claus.wallacher/blog/2006/08/15/duplicating-subtrees-and-numbering-them-using-the-graphical-mapping-tool

Also check this weblogs:

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

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

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

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

Sravaya Talanki- Message Mapping(Node Function) Part-2

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

Standard Functions

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

Advanced mapping function(mapwithdefault,formatbyexample,sort,sortbykey)

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

mapping- createif, removecontext,splitbyvalue

/people/yukai.shi/blog/2006/06/02/b2b-mapping-techniques-using-the-graphical-mapping-tool

mapping- createif, removecontext,splitbyvalue

/people/claus.wallacher/blog/2006/08/15/duplicating-subtrees-and-numbering-them-using-the-graphical-mapping-tool

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

/people/claus.wallacher/blog/2006/04/17/replication-of-nodes-using-the-graphical-mapping-tool

/people/claus.wallacher/blog/2006/08/15/duplicating-subtrees-and-numbering-them-using-the-graphical-mapping-tool

http://help.sap.com/saphelp_nw04/helpdata/en/21/3bb8c495125e4eb5969f0377885fe0/content.htm

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

/people/sundararamaprasad.subbaraman/blog/2006/02/21/real-example-for-formatbyexample

http://help.sap.com/saphelp_nw04/helpdata/en/1f/ea0fb12403844bbb6c4cbc8a00cda9/content.htm

http://help.sap.com/saphelp_nw04/helpdata/en/4b/d11e3e1c3b120ae10000000a114084/content.htm

cheers

Former Member
0 Kudos

Hi Anmol,

Copy Value:

you can interpret it as "How many ever times I occur I am copied just once".

It is used very frequently in real-time. Let us take an instance of material group, which can occur as many times as the item node. But since we are mapping it to the header in the target node I just want to copy the first occurrence of material group and map it to the header node. CopyValue exactly does that.

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))

Formatbyexample: actually when to use.

This function has two inbound queues, which must both have the same number of values. To generate the result queue, the function takes the values from the first queue and combines them with the context changes from the second queue.

Thanks,

Radhika.

pls reward points if it is helpful.

Former Member
0 Kudos

Hi,

copyValue

Use

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

Example

In the example below, the address data is represented in the source structure (street, city, zip code) by the field addrDat, which occurs three times. However, in the target structure, this information is separated into three individual fields (street, city, zipCode):

Source Structure (left) and Target Structure (right)

Field Name

minOccurs

maxOccurs

Field Name

minOccurs

maxOccurs

PartnerMsg

1

1

CustomersMsg

1

1

partner

0

unbounded

customer

0

unbounded

name

1

1

name

1

1

addrDat

3

3

street

1

1

city

1

1

zipCode

1

1

Using the CopyValue() function you can copy the values of field addrDat to the individual target fields. To do so, specify the position that you want to copy. Note that the 0 position refers to the first occurrence of the source field:

Message Mapping Using CopyValue()

Target Field Mapping

Position for CopyValue()

/CustomersMsg=/PartnersMsg

/CustomersMsg=/PartnersMsg

/CustomersMsg/customer/name=

/PartnersMsg/partner/name

/CustomersMsg/customer/street=

CopyValue(/PartnersMsg/partner/addrDat)

0

/CustomersMsg/customer/city=

CopyValue(/PartnersMsg/partner/addrDat)

1

/CustomersMsg/customer/zipCode=

CopyValue(/PartnersMsg/partner/addrDat)

2

formatByExample

Use

You use this function if you need to synchronize two queues of equal length with reference to their context change. The mapping runtime takes the values from the first queue, and the context change from the second queue. If the two inbound queues do not have the same number of values, the mapping runtime triggers an exception.

Example

Inbound Queues and Result Queue (Example)

1. Inbound Queue

A1

A2

A3

B1

B2

C1

2. Inbound Queue

W1

X1

X2

X3

Y1

Z1

Result Queue

A1

A2

A3

B1

B2

C1

In the example above, both the first and second inbound queues have six values (empty contexts are not counted). The second inbound queue dictates the structure of the result queue. Empty contexts are also included in this structure. The mapping runtime replaces the values from the second queue with the corresponding values from the first queue.

Function

Use

FixValues

Executes a value mapping using a fixed value table that you complete using the function properties. The table is saved together with the most current message mapping and can only be used once.

ps refer this links

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

http://help.sap.com/saphelp_nw04/helpdata/en/67/7ca04267deb111e10000000a155106/frameset.htm

ps reward me if usefull

reg,

suresh

Edited by: K Suresh Kumar on Jun 23, 2008 12:13 PM

Former Member
0 Kudos

Hi,

> CopyValue

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

> FixValue

Executes a value mapping using a fixed value table that you complete using the function properties. The table is saved together with the most current message mapping and can only be used once.

>FormatByExample

http://help.sap.com/saphelp_nw04/helpdata/en/67/7ca04267deb111e10000000a155106/frameset.htm

Regards

Patrick