cancel
Showing results for 
Search instead for 
Did you mean: 

REGARDING NODE FUNCTIONS

Former Member
0 Kudos

1)can any body pls give the real use of NODE FUNCTIONS in real time scenarios with screen shots (SPLIT BY VALUE,REMOVE CONTEXT,COLLAPSE CONTEXT).

2)how to get the file name of convention,<payload element value>.xml in the receiver side,if the element value changes dynamically? (dont say to use variable substitution)?

answers required urgently

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi,

Refer this links for information about nodes and the use of node functions:

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

Function formatByExample:

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

Split by value, remove context and collapse context:

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

Regards,

Nithiyanandam

Former Member
0 Kudos

Hi,

Please find here with you the answers for your queries

*1)can any body pls give the real use of NODE FUNCTIONS in real time scenarios with screen shots (SPLIT BY* *VALUE,REMOVE CONTEXT,COLLAPSE CONTEXT).*

The Node functions are used mainly to handle the context Changes as well as for SUPRESS the values in Context or Queue.

Values of elements or attributes of the XML message (the payload) are, technically speaking, a string. Therefore, all standard functions that operate on field values expect string arguments and return a string value. Nevertheless, the transferred value can of course have a different semantic data type, namely, the one that you specified when you defined the schema for the payload for the field. Standard functions exhibit the following standard behavior:

&#9679; Depending on the standard function, data type conversions are used to ensure that the values are transferred in a format suitable for the function (using a cast). If the value cannot be interpreted, the mapping runtime triggers a Java exception.

&#9679; If-clauses evaluate conditions that return Boolean values. Standard functions that return Boolean values return the string true or false. Standard functions that expect Boolean values interpret the values “1” and “true” (not case-sensitive) as true and all other values as false.

removeContexts - it will remove the gaps between the queue.

replaceValue - it will replaces the value.

SplitByValue - inserts the gap in the queue.

Exists - Like ABAP Table entry we can check whether the entry Exists or not

Please go through below link

http://help.sap.com/saphelp_nw04/helpdata/en/ee/bf9640dc522f28e10000000a1550b0/frameset.htm

https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/6658bd90-0201-0010-fbb6-afe25fb3...

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

Check this weblog where claus have mentioned with examples:

/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

For value mapping check this video presentation and weblog:

/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]

you can base these as your reference;

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

If you want to remove the context then either you should use this function or you should write a java function. So with the help of this standard function you can achieve this.Also you will not have any performance issue with this function. Check this help with example on this funciton:

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

*2)how to get the file name of convention,<payload element value>.xml in the receiver side,if the element value* *changes dynamically? (dont say to use variable substitution)?*

For this dynmica configuration for getting the filename. you need to imply below UDF in mapping,

Here you need to pass the ,<payload element value> and concat the extension ".xml" and pass as input parameter.

It is better to use dynamic folder choose in receiver side , see below code

1. Take one input string (element value to be passed)

2. Mapp it to the (Message tpye ) MT_MsgType in Mapping.

3. In ID, for communication channel pass below values in FCC

FileName.fieldFixedLengths -- 0

FileName.fixedLengthTooShortHandling --Cut

UDF Code

String newfilename="";

DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);

DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","FileName");

// Get Sourcefilename

String oldfilename=conf.get(key);

//extract first 3 chars of source filename

newfilename=oldfilename.substring(0,2);

//get the date

java.text.SimpleDateFormat dateformat = new java.text.SimpleDateFormat( "yyyyMMdd" );

dateformat.format( new java.util.Date() );

//append sourcedateL

newfilename=newfilenamedateformat"L";

// determine if prod/ dev / qa

map = container.getTransformationParameters();

senderService = (String) map.get("SenderService");

if(senderServcie.equald("Prod"){

newfilename=newfilename+"P";

}

// change to new file name

conf.put(key, newfilename+".tmp");

Also see the below links

/people/michal.krawczyk2/blog/2005/11/10/xi-the-same-filename-from-a-sender-to-a-receiver-file-adapter--sp14

Thanks

Swarup

Edited by: Swarup Sawant on Feb 4, 2008 4:40 AM

Former Member
0 Kudos

Hi,

All these questions are easily available on SDn. use the search option before posting these kind of questions.

Node function:

Remove context:

Use

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

SplitByValue

Use

SplitByValue() 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. A maximum of minOccurs top node target fields can be inserted here.

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.

Refer the below link for more details:

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

/people/sravya.talanki2/blog/2006/12/27/aspirant-to-learn-sap-xiyou-won-the-jackpot-if-you-read-this-part-iii

/people/sravya.talanki2/blog/2006/12/27/aspirant-to-learn-sap-xiyou-won-the-jackpot-if-you-read-this-part-iii

/people/sravya.talanki2/blog/2006/12/27/aspirant-to-learn-sap-xiyou-won-the-jackpot-if-you-read-this-part-iii

Go to the below links for dynamic configuration:

Advance parameter in file adapter dynamic file name

/people/michal.krawczyk2/blog/2005/11/10/xi-the-same-filename-from-a-sender-to-a-receiver-file-adapter--sp14

/people/william.li/blog/2006/04/18/dynamic-configuration-of-some-communication-channel-parameters-using-message-mapping

Thnx

Chirag