cancel
Showing results for 
Search instead for 
Did you mean: 

user - defined functions for calculating the taxes of state and country

Former Member
0 Kudos

hi expects,

how can write user-defined function in message mapping in which i want to calculate the states taxes (2500) and country taxes (5000) and give the result as grand total in output.please help me?

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi Santosh,

1)I think you don't required any UDF . You can directly use Standard SAP ADD function from arithmatic category.

2)After that you can use Standard SAP FormatNumber function from Arithmatic category.

3)for e.g take Number format as 00000.00

Regards,

Rohit.

Former Member
0 Kudos

Hi,

Activities

1. To create a new user-defined function, in the data-flow editor, choose Create New Function (This

graphic is explained in the accompanying text), 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 environment.

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 pushbutton bar. 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.

Regards

Seshagiri

Former Member
0 Kudos

Hi,

Explain with one example to get the clear picture.

chirag

Former Member
0 Kudos

as per my client want the grand total of this taxation in output and in input client is having states taxes and country taxes.i have to add both states taxes and country taxes .

example : state taxes (2700) + country (3500) = grand total (6200)

Former Member
0 Kudos

Hi,

Then Use ADD Standard Function available in Mapping Editor

Regards

Seshagiri

Former Member
0 Kudos

Hi,

No need to write UDF for this U can sue the standard ADD function provided in graphical mapping tool.

Give both the input to Add function and it will give the addition of both of them as an output.

chirag

Former Member
0 Kudos

in that one he is using some condition that the grand total should extend upto 7 digit and decimal should not come in last(23456.00).