cancel
Showing results for 
Search instead for 
Did you mean: 

deleting trailing zeros after the decimal point

Former Member
0 Kudos

Hi All,

I am working on SAP Scripts.I have a Quantity field in my Script.

when we display the Script the ouput due to this quantity field is smething like 10.000

but i need to display only 10

and if the value is 10.100

then i need to display 10.100

please send your useful inputs.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

First write the value to a character string.

Then replace .000 with null. (if not found nothing happens)

For example;

data lv_qty type vbap-zmeng.
data char_qty(10).

lv_qty = '10.000'.
Move lv_qty TO char_qty.
Replace '.000' IN char_qty  WITH ''.
CONDENSE char_qty.
write / char_qty. " output 10
lv_qty = '10.100'.
Move lv_qty TO char_qty.
Replace '.000' IN char_qty  WITH ''.
CONDENSE char_qty.
write / char_qty. " output 10.100

Likewise you have to adapt this to your requirement, revert back if u have doubts.

Regards

Karthik D

Answers (4)

Answers (4)

Former Member
0 Kudos

Hi Karthik...........the problem is solved thank you.....I have marked the question as answered..........thanks for all of you for taking time to find the answer

Former Member
0 Kudos

Hi vidya,

ex: &EKPO-MENGE&(.0)

Refer this link

[SAPscript symbols|http://firstsapabap.googlepages.com/SAPscript5_sssymbl.pdf]

Regards,

Sravanthi

Former Member
0 Kudos

This message was moderated.

Former Member
0 Kudos

Hi,

Use the FM : ROUND...

Or use a statement SPLIT at '.' (dot)...

Regards

Shiva