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 remove extra zeros in quantity field.

satya_devaraju
Explorer
0 Kudos
1,891

I am retrieving the field which is of type QUAN(13) and decimals 3. The values are stored as

1,000

20,000

50,000

2,340

23.50

Now i want to output as 1, 20, 50 , 2.34, 23.5

I want to remove the additional zeros. Is there any FM for the same.

satya

9 REPLIES 9

Former Member
0 Kudos
357

Use the SHIFT command to remove trailing zeroes.

<REMOVED BY MODERATOR - REQUEST OR OFFER POINTS ARE FORBIDDEN>

Regards

Meera

Edited by: Alvaro Tejada Galindo on Dec 30, 2009 11:21 AM

0 Kudos
357

Hi

but its not working for QUAN field. accepting for only char type field.

Former Member
0 Kudos
357

Hi,

I hope following code will solve your problem.

SHIFT v_char RIGHT DELETING TRAILING '0'.

<REMOVED BY MODERATOR - REQUEST OR OFFER POINTS ARE FORBIDDEN>

Regards,

Mukul

Edited by: Alvaro Tejada Galindo on Dec 30, 2009 11:21 AM

rahulkavuri
Active Contributor
0 Kudos
357

hi

Check this similar thread

https://forums.sdn.sap.com/click.jspa?searchID=700505&messageID=401791

<REMOVED BY MODERATOR - REQUEST OR OFFER POINTS ARE FORBIDDEN>

Message was edited by:

Rahul Kavuri

Edited by: Alvaro Tejada Galindo on Dec 30, 2009 11:21 AM

kesavadas_thekkillath
Active Contributor
0 Kudos
357

DATA:lv_dec TYPE f DECIMALS 3,
  lv_str  TYPE string.
 
lv_dec = '20.000'.
 
WRITE lv_dec TO lv_str.
SHIFT lv_str RIGHT DELETING TRAILING '0'.
 
SHIFT lv_str RIGHT DELETING TRAILING '.'.
CONDENSE lv_str NO-GAPS.

0 Kudos
357

Hi

thanks for the reply

my req is field is of type quan in Db table.but in tab main generator list display those tailing zeros should not b displayed. i tried to modify in the screen module but not working.

Former Member
0 Kudos
357

Hi,

You can try using FM: ROUND.

Hope it helps

Regards

Mansi

Former Member
0 Kudos
357

Hi Satya,

I think it is login id Decimal notation format problem.

Check your login id's data in Defaults section, you will find decimal notation where we can change settings like decimal places in terms of comma and comma in terms of decimal places.

Regards,

sunny

satya_devaraju
Explorer
0 Kudos
357

thanks