cancel
Showing results for 
Search instead for 
Did you mean: 

Node Functions

Former Member
0 Kudos

Hi experts,

What is the need of node functions?

why we use Node functions?

Any real example?

Please I am very much confusing with These concepts

Thanks

Sushma.Maganti

Accepted Solutions (1)

Accepted Solutions (1)

Former Member

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.

Below are node function with explanation

Node functions:

Sort : sort the values in each context.

Collapse context : It removes the supress and empty values that are in the same context.

Remove Context : It producess plain stream of values. It removes all level contexts.

Map with default : Inserts default value specified in the function properties into empty contexts.

Split by value : It inserts the context after events specified. events are each value, value changed and empty value.

Exists : It ckecks weather the node exists or not.

Replace value : It replacess the value of the source field to the value specified in the function.

Sort by key : Sort values in second queue by keys from first queue

Create If : It producess the nodes based on the IF condition.

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

for more details

/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

Answers (8)

Answers (8)

Former Member
0 Kudos

Hey,

1. remove context:

You use removeContexts () to delete all the top contexts for an element. This removes all top hierarchy levels, so that all elements of the target queue are assigned to a root element of the source queue.

Advanced user-defined functions can import either just one context into the input arrays, or complete queues. Make your selection by selecting or deselecting the Save Entire Queue in Cache checkbox in the function editor.

2. split by value:

The SplitByValue() function is the counterpart to removeContexts(): Instead of deleting a context, you can insert a context change in the source value queue. You then receive this element for each inserted context change instead of a top node element. However, for this to be possible, the top node source field must be assigned a top node target field and minOccurs must be >0. You can insert a context change in the queue after each value, after each change to the value, or after each tag without a value.

3. collapse context:

Using collapseContexts() puts the first values of all contexts into a context. Empty contexts are replaced with an empty string:

This can be useful if an upper-level node is to be created each time a lower-level node exists, for example. The function is useful in combination with the SplitByValue function.

4. Use one as many

You require the function useOneAsMany() if a field that only occurs once needs to be replicated as often as another field occurs in the outbound message so that the fields can be written to the target structure in pairs as a record.

http://help.sap.com/saphelp_nw04/helpdata/en/2c/2d8c4024d26e1de10000000a1550b0/frameset.htm

5. Map with default

6.copyValue

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

7.createIf

You use createIf() to create a tag in the target structure depending on a condition.

8.exists

You use this function to determine whether a particular source field exists in the XML instance to be processed. If it does, exists() returns the value true, otherwise it returns the value false.

9.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.

Link for Node function.

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

Example:

removeContext:

We use remove context to remove the context of a queue

A ->removeContext-> A

B B

C C

here each line under an alphabet denotes context change.

One thing about context change is it will not show you null values coming in input.

A ->removeContext-> A

C

C

in above example -- represents only context change no value in this place(null).

Collapscontext :

It works very much same way of removecontext but it also considers null values and gives [] for null values (if Context of Field is on its Preceeding parent otherwice it will work as remove context)

A ->CollapsContext-> A

[] (Blank value)

C C

One more chane is if there are multiple values in a context then it will only select first value from that queue

A ->CollapsContext-> A

D B

B C

C

As you can see in above example A & D falls under one context hence D is Removed

Split ByValue :

Used to Chnage the Context of Input

it has three options in it

1)each value

2)value change

3)emptyValue

The link given by Rohit is Self Explanatry for this .

FormateByExample :

it changes the Context of input1 as per the Context of Second input but the number of values in both the input must be same .

eg.

Input1 Input2 ->FormateByExample-> Out

A P A

B Q B

C R C

As you can see Context of input1 is Changed as per input 2

Sorry Guest Seems To Be Some Problem With Formating

reward points if useful.

regards,

Milan

Edited by: Kenny Scott on Jun 17, 2008 11:57 AM

Former Member
0 Kudos

Hi,

One as Many : we have one value in the source side, but we can use that many times in the target sede in this

conditions we can use this node function.

Here it takes 3 inputs, first value represents the value to populate in the target side

second value represents howmany times the first value occur in the target side and the

third value represents where the context should change.

watch this blog for one as many node function. /people/riyaz.sayyad/blog/2006/04/23/introduction-to-context-handling-in-message-mapping

Former Member
0 Kudos

Hi experts thanks to all

just reading the stuff

Thanks

Former Member
0 Kudos

Hi,

Have a look at this help link - http://help.sap.com/saphelp_nw04/helpdata/en/43/c4cdfc334824478090739c04c4a249/content.htm

Also these weblogs will help you -

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

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

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

Split by value -

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

U can also refer to the follwoing link

http://help.sap.com/saphelp_nw2004s/helpdata/en/2c/2d8c4024d26e1de10000000a1550b0/frameset.htm

/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

Vikranth

Former Member
0 Kudos

HI SUSHMA

MAPPINGS STANDARD NODE FUNCTIONS:

Remove Contexts: We use it to remove Header Contexts from source side. If we donu2019t want header context to repeat in target structure, use this. It removes repeated header contexts and all the items come under the same contexts.

Split by Value: This is counter part of remove context. Use this to add the header context at the target side. Suppose if we wan to separate header contexts for every value of item at source use this.

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.

Createif (): Use it to create a tag in the target structure depending on the condition. Use it, if the nodes at the target side have to be created only after certain condition is true. If value type is u2018INTENALu2019 Internal request node is created and if value type is u2018EXTERNALu2019 external request node is created.

Collapse Context: We use it, if we have to create empty tags in target for every context change in the source.

Exists: While mapping idoc structure to file structure, Lot of times we come across a scenario where the fields (occurrence=0) are not mandatory in the idoc. They are not populated in the source xml and they are required in the target xml (occurrence=1) which gives runtime exception that target element canu2019t be created.

refer the following links for further assitance

/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

reward points if found useful

Edited by: vemuganti naga phalguna on Jun 16, 2008 1:23 PM

aashish_sinha
Active Contributor
0 Kudos

HI,

Please refer these links

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

/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

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

https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/media/uuid/b9af5e71-0701-0010-d0b8-f612f...

http://help.sap.com/saphelp_nw04/helpdata/en/ef/df564b6aa24fc9ab0d685460747de5/frameset.htm

/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

/people/sreekanth.babu2/blog/2005/02/23/value-mapping-replication

/people/community.user/blog/2007/01/08/valuemapping-using-the-graphical-mapping-tool

https://www.sdn.sap.com/irj/sdn/docs?rid=/webcontent/uuid/110ff05d-0501-0010-a19d-958247c9f798#xi [original link is broken]

Hope this will help you.

Regards

Aashish Sinha

PS ; reward points if helpful

GabrielSagaya
Active Contributor
0 Kudos

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

/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

Former Member
0 Kudos

hi sushma

go thru these stuff

Forum post in Exchange Infrastructure: Re: node functions

Check these...

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

/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

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

regards

chandra

Former Member
0 Kudos

Hi,

This should solve your Confussion

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

Regards

Seshagiri