cancel
Showing results for 
Search instead for 
Did you mean: 

common UDF for all scenarios

former_member185881
Active Participant
0 Kudos

Hi All

PI Version = 7.0

Scenario is:

Total number of Scenarios = 20

I have created UDF in one mapping for one scenario. Same UDF i have to use for all 20 scenarios. Do i need to go to each maaping and have to write UDF or can i create one UDF and can use same for all scenario. Is there any posibility like this in 7.0, if yes then how can i achieve this???

Regards

Dheeraj Kumar

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

write it as a separate method in a class, import the class and use the function in each of ur scenarios.

Hope it helps

BR

former_member185881
Active Participant
0 Kudos

Hi Mustafa

Where i will write that call?

I need all the steps for the procedure.

Regards

Dheeraj Kumar

former_member185881
Active Participant
0 Kudos

Hi Mustafa Mohammed

Can you please explain where to write that class?

Regards

Dheeraj Kumar

Former Member
0 Kudos

Hello Dheeraj,

Create a new Java class with some package and define the function in the class file, then import this class file as imported archive and it should be available to the mapping if you import the package, create an instance of this class and use the method in a wrapper UDF

Regards

Answers (1)

Answers (1)

KennethEriksen
Participant
0 Kudos

Hi,

You can also create a mapping template and include your UDF in your template. When you create new mappings (for the 20 scenarios) you can base them on the mapping template and your UDF will be available for all. It doesn't matter if your template doesn't match your current source/target formats, you can still use the template and make use of the common UDF.

Hope it helps!

Br,

Kenneth

former_member185881
Active Participant
0 Kudos

Hi Kenneth Eriksen

All the mapping are already created now i have to include UDF in all the existing mappings. Is it possible?

Regards

Dheeraj Kumar

KennethEriksen
Participant
0 Kudos

I think it should be possible. Select a source node and target node in your mapping where your UDF is defined and click "Create mapping based template". Then in your other message mappings you can select "show suitable templates" and select the one you just created.

Let me know if it works!

-Kenneth

former_member185881
Active Participant
0 Kudos

Hi Kenneth Eriksen

I am trying to do this but this "Create template based on mapping" is showing inactive.

I have tried in the edit mode.

Regards

Dheeraj Kumar

KennethEriksen
Participant
0 Kudos

If other functions in the message mapping are inactive as well it could mean your java version (JRE) is too old.

-Kenneth

former_member185881
Active Participant
0 Kudos

Hi

Is there any other alternative which i can explore?

Regards

Dheeraj kumar

KennethEriksen
Participant
0 Kudos

I guess you could always copy the UDF to all the other scenarios, but I understand you're trying to avoid this. But you can easily update your JRE from java.sun.com to see if it helps.

-Kenneth

former_member200962
Active Contributor
0 Kudos

I dont think we are provided with the feature of UDF re-usability in SAP PI7.0 like we have it in SAP PI7.1 (with the name Function Library ).

Update:

Check if the workaround suggested by Monika helps you:

Regards,

Abhishek.

Edited by: abhishek salvi on Dec 22, 2009 2:50 PM

former_member185881
Active Participant
0 Kudos

Hi

In this approach also there is one problem:

You told me to select the source node and target node and then create a template right, but all 20 scenarios are having different target node then how can i use this?

Regards

Dheeraj Kumar

former_member200962
Active Contributor
0 Kudos

The jar file needs to created in a tool like NWDS......it is as good as you are creating a JAVA mapping in NWDS.

The jar file that you want ot create will have the import statements that you have actually used in the UDF.

Regards,

Abhishek.

former_member194786
Active Contributor
0 Kudos

Hi Dheeraj,

If my understanding is correct mapping templates use data type and not message types.

So if the associated data type for your source and target nodes have the same data types associated to them, I think it should work.

However you can always go for other option of creating a class and importing it under Imported Archives.

Regards,

Sanjeev.

former_member185881
Active Participant
0 Kudos

Hi Sanjeev Shekhar

My target is IDOC so if my target node is different in each case that means its a different idoc right and so my data type will be different.

Can you explain me where to write a class and how to make a jar file for this?

Regards

Dheeraj Kumar

former_member194786
Active Contributor
0 Kudos

Hi Dheeraj,

As suggested by Abhishek earlier you would have to create a java class using NWDS and then import it in the IR under Imported Archive. This can then be referenced in your UDF.

For more on this have a look into these links:

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

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

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

The way to reference the imported archives is explained here.

Regards,

Sanjeev.

KennethEriksen
Participant
0 Kudos

You should still be able to use a template even if your structures are different to the template. The only consequence is that no fields will be mapped as a result of the template mapping, but the positive is that you will get all UDF's defined in the template available. There is however a restriction I think that you need to use data types or message types as part of your template, external definitions will not work.

-Kenneth