Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

display decimals value

Former Member
0 Kudos

Hi,

I have declared a domain of datatype CURR no of character 13 & decimals 2.

My report is displaying like

120.88

80.30

56.83

0.00

but my requirement is it should display like

120.88

80.3

56.83

0

How can i achieve this.

Thanks in advance,

Abhijit

3 REPLIES 3

Pranay_Panchbha
Participant
0 Kudos

This message was moderated.

Former Member
0 Kudos

Hi,

I can't tell you the direct function module but you can write some code.

Move it to char15 field and now you can easily write logic to manupulate character field.

Former Member
0 Kudos

Hi,

You can try as my solution:

1. Create another column in output table with type c length 15.

2. Write a subroutine to move data from currency field to the character field

3. Display the character field in alv output instead of the currency field.

Sample code of the function module you can refer to my test prog as following:

REPORT  Z_TEST_PROGRAM.

DATA: lv_test(13) type p DECIMALS 2.
DATA: lv_string(15) type c.
DATA: lv_dec(2) type c.

* Sample data initialization
lv_test = '123456789012.1'.

* Move to char field
lv_string = lv_test.

* Get the decimal part
lv_dec = lv_string+13(2).

* Check the 0 number at decimal part
IF lv_dec = '00'.
    lv_string = lv_string+0(12).
ELSEIF lv_dec+1(1) = '0'.
    lv_string = lv_string+0(14).
ENDIF.

WRITE lv_string.

Hope this help U.

Regards,

Khanh