cancel
Showing results for 
Search instead for 
Did you mean: 

User Define Function Question

Former Member
0 Kudos

Hi,

I was looking at this Blog /people/michal.krawczyk2/blog/2005/11/10/xi-the-same-filename-from-a-sender-to-a-receiver-file-adapter--sp14

Please help me configuring the UDF in graphical mapping editor.

As I donot know Java, can someone help me develop UDF with the following code?

Code from the Blog is

-


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;

-


My Question is

What is what is User Defined Function Name and arguments ?

What is the First line in the Function?

Is this correct ?

public String FileNameFunction(Container container){

Will someone explain me please?

All explanations will be rewarded with points..

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Ram,

Here in the blog Michal is trying to get the file name which is send to XI dynamically. He has clearly told that he has taken the code from:

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

http://help.sap.com/saphelp_nw04/helpdata/en/78/b4ea10263c404599ec6edabf59aa6c/content.htm

Coming to your questions:

<i>What is what is User Defined Function Name and arguments ?</i>

If the standard functions for a target-field mapping do not fulfill your requirements or if the graphical mapping is unclear due to the complexity of the mapping then we will for creating your own user-defined functions. The user defined function has its name, description and arguments. The name is the name of your function, description is the description of your function and arguments are what you are passing as inputs to your function. Also the user defined functions are of two types: Simple and Advanced.

For clear insight understanding of all this go through the url:

http://help.sap.com/saphelp_nw04/helpdata/en/14/80243b4a66ae0ce10000000a11402f/frameset.htm

http://help.sap.com/saphelp_nw04/helpdata/en/14/80243b4a66ae0ce10000000a11402f/frameset.htm

---Satish

Former Member
0 Kudos

Hi Satish, thanx for reply. Iam using the source as given in the Blog link I provided ( which is by Michal ). I am trying it as it is. But during mapping testing Its throwing exception.

here is what Iam using in its entirety.

Label: ourSourceFileName

Description: Test

cache : value

Arguments: None

And the source code is

-


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;

-


my Questions are

ourSourceFileName is the Label right ?

Which Radio Button I should Pick up? cache, context or queue ?

and what is the argument name ?

Please bear with me .. I dont know Java.

Message was edited by: Ram Krish

bhavesh_kantilal
Active Contributor
0 Kudos

Ram,

<i>Which Radio Button I should Pick up? cache, context or queue ?</i>

CACHE will do fine. CONTEXT and QUEUE are used in case of Advanced User Defined Functions when you want the entire CONTEXT or QUEUE to be the input to your User Defined Function.

<i>and what is the argument name ?</i>

If the only option you are looking at is to get the Source Filename in the UDF , then no Input parameters are required. You can deleted the Input Parameters from your UDF.

Just make sure of the following --

1. Sender File Adapter -- Adapter Specific Identifiers and FIle name are selected

2. Receiver File adapter --Adapter Specific Identifiers and FIle name are selected

Regards,

Bhavesh

Former Member
0 Kudos

Hi,

The exception during mapping is because, the filename is determined at runtime.

In order to test the mapping, specify a dummy filename value in the parameters tab of the mapping test editor.

Regards,

Smitha.

Answers (0)