cancel
Showing results for 
Search instead for 
Did you mean: 

User defined function and different namespaces

Former Member
0 Kudos

Hi,

In integration builder, I have implemented some functions (for example, formatting data) that can be useful in different namespaces.

However, when you create a new user defined function, this is visible only inside the namespace where it was created.

There is any way to call any user function in several namespaces?

Thanks, in advance

Carme

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi Ajay,

As you said we can use the same function in all namespaces of that SWCV.But while transportation we may face the problems like, Suppose if i imported the .zip file under Imported archives of namesapce A,and used the same in mappings for namespaces of B and C.Now if i transported the namespaces B and C from DEV to Q then these scenarios thrown the errors in Q environment.So We should import the namespace A too along with B and C eventhough no need to transport the namespace A.

Cheers

Veera

Former Member
0 Kudos

So better to use the same practice that SAP provides:-) i.e. you have to create the same UDF in all Mapping where you want to use it..in order to avoind any future conflicts:-)

There is not harm if tool does not provide that facility...and we have to create same UDF agaian and again:-)

Thanks

Farooq.

Former Member
0 Kudos

Hi Carme

U can define global function so that u can use same method again and again for any mapping and in any namespace

follow the steps

Yes u can define global method by creating a java class

Steps

> create java class with whatever method u want to use again and again

> create JAR file of the java class

> import into impotted archive folder

> and while creating UDF u can use import statement like normal java program

> and access those method in ur code

we will need to import in archive folder as JAR

Steps>

>First Make a java class containing your method or any number of other method

like

public class TextOne {

public static void main(String[] args) {

}

public String yourMethodName(String parameter){

String result = "your value"; // as for example

return result;

}

}

>step continue

>go to command prompt

> go to directory(package name like in above code) where u r java file is there

>make jar by following command

>jar -cvf nameofjarfile.jar yourjavafilename.java

>nameofjarfile.jar will we created

>go to archive folder in IR

>import that jar file

>go to UDF

>write import packagename

>now u can access function like class's object.method name

<b>Reward points if helpful </b>

Former Member
0 Kudos

Hi Ajay,

Are your sure It will work any will no throw an Error llike <b>NameNotUniqueException</b>??

Thanks

Farooq.

Former Member
0 Kudos

Hi Farooq,

I already using it.

Former Member
0 Kudos

Hi Carme,

As far as i know..the visibility of an UDF is upto MM..!! u cant reuse same UDF in diffrrent MM

<b>There is any way to call any user function in several namespaces?</b>

No.this feature is not there in PI7.0.This feature may be available 7.1 onwards...

regards

biplab

Former Member
0 Kudos

Hi Carme,

As far as i know, there is no option to call a UDF in different namespaces.

However as Biplab has mentioned, in PI7.1, the feature of function library will be introduced. In this, the Repository saves the user defined functions you create in a message mapping or a mapping template in a local function library belonging to a mapping object. To use a user defined function in more than one message mapping or mapping template you can create the user defined functions in function libraries.

Regards,

Divija.

Former Member
0 Kudos

NO you cannot achive it till PI 7.0. The UDF is limited to the Message Mapping in which u have created. Even if you are creating other MM in the same namespace and u want to use the UDF that was created in other MM (in the same namespace) even u cannot achieve it.

PI 7.1 embeded this features:-)

Thanks

Farooq.

*Rewards Points if u find it useful*