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: 

how to resolve the decimal point issue??

Former Member
0 Kudos

hello friends,

I had declared a variable of variable type P(16) decimals 6 for price. The price is calculated accurately and stored in the variable. The value that got stored is 5094390.000000. I declared one more variable of type ekpo-netpr and moved that value into this field. In the fieldcatalog i used cfieldname = 'waers'.....while displaying through ALV for waers 'IDR' (no decimals should be displayed ) it is displaying as 509.439.000 instead of 5094390.

Could you tell me any one dd variable that can hold of type P(16) decimals 6 .

pls help me to resolve this issue. All helpful answers would be highly rewarded.

Thanks,

Ramineni

11 REPLIES 11

Former Member
0 Kudos

HI,

there is an option in ALV field cat...

<b>decimals_o</b>..By setting this you can increase or decrease the decimal places..

if you put 0 for that no decimals will be displayed..

regards,

Omkar.

0 Kudos

Hi yanamala,

depending upon the currency field i have to display the decimals ....if i use decimals_o then for all fields decimals will be displayed in a similar format only.

Former Member
0 Kudos

cfieldname = 'waers'

try this

cfieldname = 'curr'

0 Kudos

Hello karthikeyan,

It is not working

Former Member
0 Kudos

Hi Dear,

Its very Simple Look at this code

data: amount(15) type c value '200,000,000.000'.

while sy-subrc = 0.

replace ',' with space into amount.

endwhile.

condense amount no-gaps.

write:/ amount.

Replace what ever it is comma or (.)

You said U will reward High so i will expect the same

If any further quries pls feel free to ask.

Regards,

Bohra.

0 Kudos

depending upon the currency field i have to display the decimals ....i mean if the value is 53490700.000000

then if waers = ''IDR" it should be displayed as 53490700

if it is "USD" then it shouold display 53490700.00

like this i wanna print. if i use the method as you suggested above i have to display 53490700000000. which is not meaningful.

Thanx and regards,

Ramineni

Former Member
0 Kudos

Hi,

You have to mention currency in fieldcatlog,

i.e.

x_fieldcat-fieldname = 'NETPR'.

x_fieldcat-col_pos = '7'.

x_fieldcat-outputlen = '4'.

x_fieldcat-currency = 'USDN'.

x_fieldcat-reptext_ddic = 'Unit Price'.

APPEND x_fieldcat TO it_alv_fcat.

CLEAR x_fieldcat.

go to transaction OY04

There You can define the decimal lengths of Currency.

ALV will pick decimal length from here.

Regards,

Sarbpreet Multani

0 Kudos

Hi Multani,

This is not working ...

0 Kudos

Hi,

Please try this code here u have to give name of field which contain Currency.

This will definitely work

x_fieldcat-fieldname = 'NETPR'.

x_fieldcat-col_pos = '7'.

x_fieldcat-outputlen = '4'.

<b>x_fieldcat-cfieldname = 'WAERS'.</b> Currency Fields

x_fieldcat-reptext_ddic = 'Unit Price'.

APPEND x_fieldcat TO it_alv_fcat.

CLEAR x_fieldcat.

and same u have to set decimals of Currency in OY04.

regards

sarbpreet multani

Message was edited by:

sarbpreet multani

0 Kudos

Hi Ramineni,

Check this..

WA_FCAT-TABNAME = 'I_OUTTAB'.

WA_FCAT-FIELDNAME = 'AUFNR'.

WA_FCAT-REF_TABNAME = 'AUFK'.

WA_FCAT-HOTSPOT = 'X'.

APPEND WA_FCAT TO I_FCAT.

WA_FCAT-TABNAME = 'I_OUTTAB'.

WA_FCAT-FIELDNAME = 'ACTL'.

WA_FCAT-SELTEXT_M = 'Total Act Amount'(010).

WA_FCAT-QFIELDNAME = 'TWAER'.

WA_FCAT-QTABNAME = 'T_OUTTAB'.

wa_fcat-decimals_o = '0'.

APPEND WA_FCAT TO I_FCAT.

CLEAR WA_FCAT.

<b>Decimals in this will be restricted</b>

Regards,

Omkar.

Former Member
0 Kudos

Hi

For Currency translation in routines refer to function module

CONVERT_TO_LOCAL_CURRENCY

CONVERT_TO_FOREIGN_CURRENCY

Check this link for a sample code

Check this thread

Regards

Raj