Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
cancel
Showing results for 
Search instead for 
Did you mean: 
vinaymittal
Contributor
Hello,

 

Introduction:

During SAP PO development all of us at some point in time have come across an issue where we need to re-use methods/functions defined in a Function Library inside our local UDF's. It is fairly easy to use UDF's of a function library inside Graphical Mapping but when it comes to calling methods written in "Attributes and methods" section it becomes tricky.

Here we will have a look at a solution to the problem!

 

Solution:

I had a requirement where I wrote a Function library(with no UDF's) for writing Custom Audit Log Entries and I wanted to call the method defined in Attributes and method of the Function Library inside my message mapping.

The aim here is to be able to call the function "putAuditLogEntry" inside a message mappings UDF.

(why I am not writing these as a UDF in FL itself and using them in the MM...because I needed to use these methods inside my code multiple times depending on some variables....)

Step 1) Have a closer look at your Function Library!

Function Library.



Now if you look at the highlighted part the Class Name is "AuditLogEntry" and the package name is abc.functionlibrary

 

To be able to call this method first add this function library to the definition tab of message mapping.

Message Mapping(Definition Tab)



 

Next import the class in the import area of Functions Tab.

packageName.className

Functions tab



 

Then create an object of the class inside the UDF or globally!



 

Now the final part.....calling the method



 

Conclusion: 

This is just a way to access Function Library methods inside a MessageMapping's UDF. It gives more flexibility when we are able to use global methods in local Message mapping UDF code instead of using them as UDF's in Graphical Mapping.

Note: You can also call the UDF's defined in the FunctionLibrary in Similar Fashion.

 

 

Cheers

Vinay Mittal

 
Labels in this area