cancel
Showing results for 
Search instead for 
Did you mean: 

currency field in script

Former Member
0 Kudos

Hi All,

For japanese currency there should not be any decimals to display. To get output without decimals what to do.

Regards,

Madhu

Accepted Solutions (0)

Answers (3)

Answers (3)

former_member673464
Active Contributor
0 Kudos

hii..

Certain fields are formatted specific to a particular country. These include fields for displaying a date and numeric fields containing either a decimal point or a ‘thousands’ separator character. The formatting applied is usually determined by the definitions contained in the user master record. You can use the SET COUNTRY control command to choose a different formatting operation. The various country-dependent formatting options are stored in table T005X.

Syntax

/: SET COUNTRY country_key

You can specify this country key either by quoting it directly enclosed in inverted commas or by using a symbol.

/: SET COUNTRY 'CAN'

/: SET COUNTRY &KNA1-LAND1&

or

Symbols of the DEC, CURR, INT, and QUAN data types are normally formatted with the a ‘thousands’ separator character. The T option allows you to omit this separator character.

Syntax:

&symbol(T)&

regards,

veeresh

Former Member
0 Kudos

Hi Madhu,

Check this info.

<b>Round values up to nears value</b>

The ROUND' command only rounds to nearest value whether it be up or down. Therefore the following code demonstrates how to always round a number UP 1 or 2 decimal places.

*Rounds a value UP to 2 decimal places

Check this sample code.

REPORT zround2.

PARAMETER: p_value type p decimals 3 default '22.123'.

DATA: d_value type p decimals 2,

d_int1 TYPE i,

d_int2 TYPE i,

d_number(20) TYPE c,

d_num_result(20) TYPE c,

d_decimal(2) TYPE c.

************************************************************************

*START-OF-SELECTION.

START-OF-SELECTION.

d_number = p_value.

SHIFT d_number LEFT UP TO '.'.

SHIFT d_number LEFT.

d_decimal = d_number+0(2).

d_decimal = d_decimal + 1.

Clear: d_number.

d_number = p_value.

SHIFT d_number RIGHT DELETING TRAILING '123456789 '.

SHIFT d_number LEFT DELETING LEADING ' '.

CONCATENATE d_number d_decimal INTO d_num_result.

d_value = d_num_result.

write:/ 'Value rounded up to 2 decimal places is ', d_value.

*Rounds a value UP to 1 decimal place

REPORT zround1.

PARAMETER: p_value TYPE p DECIMALS 3 DEFAULT '22.123'.

DATA: d_value TYPE p DECIMALS 1,

d_int1 TYPE i,

d_int2 TYPE i,

d_number(20) TYPE c,

d_num_result(20) TYPE c,

d_decimal(2) TYPE c.

************************************************************************

*START-OF-SELECTION.

START-OF-SELECTION.

d_number = p_value / 10.

SHIFT d_number LEFT UP TO '.'.

SHIFT d_number LEFT.

d_decimal = d_number+0(2).

d_decimal = d_decimal + 1.

CLEAR: d_number.

d_number = p_value / 10.

SHIFT d_number RIGHT DELETING TRAILING '123456789 '.

SHIFT d_number LEFT DELETING LEADING ' '.

CONCATENATE d_number d_decimal INTO d_num_result.

d_value = d_num_result * 10.

WRITE:/ 'Value rounded up to 2 decimal places is ', d_value.

In the same way you can use the Round up to 0 decimals.

Hope this resolves your query.

<b>Reward all the helpful answers.</b>

Regards

Former Member
0 Kudos

Hi Madhu,

Use the following statement -

WRITE w_amt CURRENCY 'JPY'.

This will take care of the number of decimals in Japanese currency.

Hope this helps!

Regards,

Saurabh