cancel
Showing results for 
Search instead for 
Did you mean: 

UDF'S

Former Member
0 Kudos

Hi,

Could any one give some realtime examples of Udf's used in the project along with the code.

Full points will be awarded

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Armut.

Write value in GlobalContainer

public String setValue(String value,Container container){

************************************************

container.getGlobalContainer ().setParameter ("givaAName",value);
return "";

Read Value aus GlobalContainer

public String getRefNr_ORIGIN(Container container){

***************************************

return (String) container.getGlobalContainer().getParameter ("givaAName");

Regards Mario

Edited by: Mario Müller on Jul 31, 2008 4:58 AM

Former Member
0 Kudos

Hi,

Could you please explain me in brief where you have used and for what requirement is used.

please do the needful

Answers (7)

Answers (7)

Former Member
0 Kudos

Hi,

Sample example code

Sender side we have one segment that is 1..unbound, our req is count howmany times it is repeated and concatenate one variable data and send to target

Set the context of that segment to that parent segment.

Select the Queue type UDF, input is that variable(tdline).

Input tdline

String returnString = "";

if(TDLINE.length>0)

{

for (int i = 0; i < TDLINE.length; i++)

{

returnString = returnString+ TDLINE<i>;

}

result.addValue(returnString);

}

else

result.addValue(TDLINE);

Former Member
0 Kudos

public String GetFileName(Container container)
{
DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);

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

String ourSourceFileName = conf.get(key);

return  ourSourceFileName;
}

The above code is used to retrieve source file name in mapping.

Former Member
0 Kudos

The id attribute is mapped using a user defined function globalCounter which records the order in which the nodes appear in the source structure. The variable used to store the count is a global variable and is incremented every time a node is found in the source structure (irrespective of the node name).

Create one-to-one message mapping between source message and the intermediate message. Map the id attribute in the target with the globalCounter function.

The Java code of the globalCounter function is given below u2013

public String globalCounter(Container container){

GlobalContainer globalContainer;

globalContainer = container.getGlobalContainer();

Object o = globalContainer.getParameter("count");

Integer i;

if ( o == null ) i = new Integer( 0 );

else i = (Integer)o;

i = new Integer(i.intValue() + 1 );

globalContainer.setParameter("count", i );

return i.toString();

}

santhosh_kumarv
Active Contributor
0 Kudos

Hi,

We use the User Defined Function UDF in the graphical mapping to achieve some functionality that is not supported by the Graphical Mapping standard functions.

Have look at the following Blog

By Bhavesh Kantilal

and also my Blog

Thanks

SaNv...

Former Member
0 Kudos

Hi,

http://flickr.com/photos/8764045@N06/

https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/be05e290-0201-0010-e997-b6e...

Example 1

http://www.flickr.com/photo_zoom.gne?id=544183191&size=o

http://www.flickr.com/photo_zoom.gne?id=544183195&size=o

http://www.flickr.com/photo_zoom.gne?id=544183225&size=o

http://www.flickr.com/photo_zoom.gne?id=544183233&size=o

Example 2

http://www.flickr.com/photo_zoom.gne?id=545133789&size=o

http://www.flickr.com/photo_zoom.gne?id=545133791&size=o

http://www.flickr.com/photo_zoom.gne?id=545133801&size=o

http://www.flickr.com/photo_zoom.gne?id=545133807&size=o

http://www.flickr.com/photo_zoom.gne?id=545133811&size=o

http://www.flickr.com/photo_zoom.gne?id=545138911&size=o

http://www.flickr.com/photo_zoom.gne?id=545138913&size=o

http://www.flickr.com/photo_zoom.gne?id=545138915&size=o

http://www.flickr.com/photo_zoom.gne?id=545138917&size=o

http://www.flickr.com/photo_zoom.gne?id=545138947&size=o

http://www.flickr.com/photo_zoom.gne?id=545138951&size=o

http://www.flickr.com/photo_zoom.gne?id=545005958&size=o

Example 3

http://www.flickr.com/photo_zoom.gne?id=549186611&size=o

http://www.flickr.com/photo_zoom.gne?id=549186651&size=o

http://java.sun.com/j2se/1.5.0/docs/api/

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

http://help.sap.com/saphelp_nw04/helpdata/en/22/e127f28b572243b4324879c6bf05a0/content.htm

http://help.sap.com/bp_bpmv130/Documentation/Operation/MappingXI30.pdf

https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/d046c490-0201-0010-84b6-9df523cb...

Regards,

phani

Former Member
0 Kudos

Hi,

Thanks for your answers.

Could you please explain example 1 in brief.

Former Member
0 Kudos

I think UDF's are nothing but user defined feilds which can be used to store or place holder for any field in the inound or outbound documents.