cancel
Showing results for 
Search instead for 
Did you mean: 

decimal places in form

Former Member
0 Kudos

Dear Gurus.

I need to display dinamic decimal places in my form.

for example if I have a variable containing value:

1.500 - need to display it as 1.5 (omitting trailling zeroes)

1.520 - need to display it as 1.52,

1.000 - need to display it as 1

please help.

Thanks & Regards,

William Prawira.

Accepted Solutions (1)

Accepted Solutions (1)

former_member705122
Active Contributor
0 Kudos

Hi,

Check this:

SHIFT w_test RIGHT DELETING TRAILING '0'.

Regards

Adil

Answers (2)

Answers (2)

Former Member
0 Kudos

Dear Ram and Adil,

Thanks for your answers,

both ways are able to solve my problem, but seems like Adil's is more suitable for this case.

a little correction :

SHIFT - RIGHT DELETING TRAILING must be followed by variable , so we need to insert '0' into a variable which must be declared before.

Data: v1(1) value '0'.

SHIFT w_test RIGHT DELETING TRAILING v1.

Thanks & Regards,

William Prawira.

Former Member
0 Kudos

Hi,

you need to write program lines in order to check the first,second and thrid decimal places with the following code and then display accrodingly the values.

LV_DEC_PART = FRAC( TABLE-FIELD ).

then in insert three text nodes with the same field with offsets.

&TABLE-FIELD.0& with the condition LV_DEC_PART+0(1) = 0.

&TABLE-FIELD.1& with the condition LV_DEC_PART0(2) = 0 AND LV_DEC_PART0(1) # 0.

&TABLE-FIELD.2& with the condition LV_DEC_PART0(3) = 0 AND LV_DEC_PART0(1) # 0 AND LV_DEC_PART+0(2) # 0.

Hope this is clear.

Regards,

Ram