cancel
Showing results for 
Search instead for 
Did you mean: 

Decimal Places

Former Member
0 Kudos

Hi All,

I have one issue in displaying decimal places for field ATP of type Quantity Web dynpro.

ATP is one of the attribute in a node having properties similar to KWMENG

Three cases are there.

Case 1:

If quantity is INITIAL  then ATP field should be Empty value.

Case 2:

If Quantity is a number like 1500, it should display 1500 only but not 1500.000.

Case 3:

If Quantity is having decimal value then it should show decimal value for Eg 1500.450, it should display 1500.450.

My program is failing in case 2.

How to resolve this

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

HI VR V,

  I wish i could find some FM for that. tried to write an test program

with basic coding logic. this is working as you said. try..

PARAMETERS: lv_var TYPE p DECIMALS 3 DEFAULT '10.500'.

DATA: lv_rem TYPE p.

DATA: lv_int TYPE i.

lv_int = lv_var.

lv_rem = lv_var MOD lv_int.

IF lv_rem IS INITIAL.

   WRITE: 'Converted number', lv_var DECIMALS 0.

ELSE.

   WRITE: 'Converted number'lv_var DECIMALS 2.

ENDIF.

WRITE: / 'Original number',lv_var DECIMALS 3 NO-ZERO.

Thank you,

Kiran

ramakrishnappa
Active Contributor
0 Kudos

Hi VR,

Go to the context attribute ATP and set "Zero as blank" for property "Display leading zeros".

Hope this helps you.

Regards,

Rama

Former Member
0 Kudos

Hi Ramakrishna,

I already did this but i want zeros should not be seen after decimal point and if there is a number then it should be seen.

for eg: if the quantity is 163.54, it should display in the same way.

          if the quantity is 163.00, it should display 163 only not 163.00.