cancel
Showing results for 
Search instead for 
Did you mean: 

(https://www.sdn.sap.com/irj/sdn/weblogs?blog=/pub/wlg/2748) Message Mappin

Former Member
0 Kudos

Hi Experts,

i've gone thru the scenario which is mention in the below weblog

/people/sudharshan.aravamudan/blog/2005/12/01/illustration-of-multi-mapping-and-message-split-using-bpm-in-sap-exchange-infrastructure

my question is that did anyone know how message mapping is done in this scenario. as the author mentioned in the weblog tht he is using some user-defined function for mapping. can anyone send me how to create user-defined functions to do such kind of mapping.

points will be given to the correct answers.

Cheers

Faisal

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi

As per this blog he have created the UDF, The steps to create UDf are given below.

Here name and ID to be passed to UDF and based on name it will be passed to output.

The code for UDF to map the Name & ID field of message 1 is as follows,

For Name field

if(Name=="1")

result.addValue(Name)

For ID field

if(Name=="1")

result.addValue(id)

The code for UDF to map the Name & ID field of message 2 is as follows,

For Name field

if(Name=="2")

result.addValue(Name)

For ID field

if(Name=="2")

result.addValue(id)

But this you could achive by using existing IF api also.

name>Equals(1)>true>If pass to Messasge1>Name else name>Equals(2)>true-->If pass to message 2.

similarly for ID also.

For your info

Please go through below steps to create UDF

Activities

1. To create a new user-defined function, in the data-flow editor, choose Create New Function (), which is located on the lower left-hand side of the screen. In the menu, choose Simple Function or Advanced Function.

2. In the window that appears, specify the attributes of the new function:

Name:

Technical name of the function. The name is displayed in the function chooser and on the data-flow object.

Description:

Description of how the function is used.

Cache

Function type (see above)

Argument Count:

In this table, you specify the number of input values the function can process, and name them. All functions are of type String.

3. In the window that appears, you can create Java source code:

a. You can import Java packages to your methods from the Imports input field, by specifying them separated by a comma or semi-colon:

You do not need to import the packages java.lang., java.util., java.io., and java.lang.reflect. since all message mappings require these packages and therefore import them. You should be able to access standard JDK and J2EE packages of the SAP Web Application Server by simply specifying the package under Import. In other words, you do not have to import it as an archive into the Integration Repository. You can also access classes of the SAP XML Toolkit, the SAP Java Connector, and the SAP Logging Service (see also: Runtime Environment (Java-Mappings)).

In addition to the standard packages, you can also specify Java packages that you have imported as archives and that are located in the same, or in an underlying software component version as the message mapping.

b. Create your Java source text in the editor window or copy source text from another editor.

4. Confirm with Save and Close.

5. User-defined functions are limited to the message mapping in which you created the function. To save the new function, save the message mapping.

6. To test the function, use the test environmentsapurl_link_0005_0007_0007.

The new function is now visible in the User-Defined function category. When you select this category, a corresponding button is displayed in the function chooser. To edit, delete, or add the function to the data-flow editor, choose the arrow next to the button and select from the list box displayed.

Thanks

Swarup

Former Member
0 Kudos

Hi,

Thanks alot for such a masterpiece and really u deserve the points......

cheers

Faisal

Answers (2)

Answers (2)

Jitendra_Jeswan
Contributor
0 Kudos

If you tell wat exactly you want to acheive, then experts in SDN might help you with the other optimum solutions.

As the scenario depcits use of BPM, you can avoid the usage of BPM to acheive the same:-)

Regards.

Jeet.

former_member184619
Active Contributor
0 Kudos

Hi Abdul,

If you are usinf PI 7.1 check this:

/people/william.li/blog/2008/01/02/sap-pi-71-mapping-enhancements-series-share-user-defined-functions

else check this:

Sachin