Skip to Content

About Currency UI elements

Since aBPM version 3.1 (see aBPM – a solution extension offered by SAP Consulting) there is a UI element for currencies available. This element handles not only the currency but also that the amount is represented accordingly, as shown in the example below.

The currency itself is selectable via value help and limited to the allowed currencies, e.g. USD and YEN that are defined by the admin within the value help.

The amount entry can contain a different number of positions after the digital point according to the respective currency. E.g. Yen has no positions after the digital point, USD has two and KWD has three positions. The character for the digital point and the “thousands” is used according to the user settings / language. E.g. a German user gets “EUR 1.000,00” while a user in the US will get “EUR 1,000.00”. The following table shows different examples how the user can enter the value “1.000,00 EUR”:

EUR 1000,00 <ISO_CODE> <AMOUNT>
€ 1000,00 <SIGN> <AMOUNT>
1000 € <AMOUNT> <SIGN>
1.000 EUR <AMOUNT> <SIGN>
Eur 1000,00 ISO_CODE will be transformed to upper case automatically
eur 1000,00 ISO_CODE will be transformed to upper case automatically

 

Related to the examples the currency ISO Code can be entered before or after the amount. Instead of the ISO Code also the currency symbol can be used. Irrespective of how the user enters the currency and the amount its always set to the default format “{ISO-CODE} {Amount}” afterwards.

 

Defining Currency UI elements

To use the currency UI element, one must set the following abpm excel definition.

/wp-content/uploads/2018/07/cur4.jpg

Data Type and UIElement must be defined as “Currency”. Next to that one must set the name of the help value definition where the currencies available are maintained.

This definition must be created like shown below within the abpm help value admin app (http://<host>:<port>/webdynpro/resources/consulting.sap.com/abpm~helpvalue~wdj/HelpValueAdminAPP)

In order that the abpm framework knows where exactly in the help value information about e.g. digits are maintained one has to set the naming chosen in the param column of the excel file.

 

Working with Currency UI elements

Within the abpm business object created from the excel definition the Currency element is represented by a CurrencyAmount object, which is handling an ISO code as well as the amount.

In the example below a default value is set to the currency UI element when initializing the abpm form.

public ICallbackResult onBeforeDisplay(AbstractWrappedCallbackContext<Test0001> ctx) {

		if (ctx.getWrappedBusinessObject().getCurrency() != null) {
			if (ctx.getWrappedBusinessObject().getCurrency().getIsoCode() == null) {
				CurrencyAmount ca = new CurrencyAmount();
				ca.setValue(new BigDecimal(1123.1000067d));
				ca.setIsoCode("YEN");
				ctx.getWrappedBusinessObject().setCurrency(ca);
			}

		}

		return super.onBeforeDisplay(ctx);
	}

As shown in this exmaple, one can work with the CurrencyAmount object and its getter and setter methods to handle the currency elements via callback.

To report this post you need to login first.

Be the first to leave a comment

You must be Logged on to comment or reply to a post.

Leave a Reply