Application Development and Automation 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: 
Read only

Supress decimals in Quantity Fields

Former Member
0 Likes
4,333

Hi Experts,

I have to do the following for Quantity values Truncation.

1. I need to truncate values for ex. 12345.000000 into 12345 and

2 . i need to keep quantity values for examples 12345.12345 into 12345.12345

i need to truncate this decimals without converting into char value...

i am displaying quantity fields values in ALV using REUSE_ALV_GRID_DISPLAY ..

i have found similar thread but unable to find solution.

Thanks in advance.

Hi Experts,

I have to do the following for Quantity values Truncation.

1. I need to truncate values for ex. 12345.000000 into 12345 and

2 . i need to keep quantity values for examples 12345.12345 into 12345.12345

i need to truncate this decimals without converting into char value...

i am displaying quantity fields values in ALV using REUSE_ALV_GRID_DISPLAY ..

i have found similar thread but unable to find solution.

Thanks in advance.

5 REPLIES 5
Read only

Former Member
0 Likes
1,798

use FM

FTR_CORR_SWIFT_DELETE_ENDZERO

Thanks,

Jayant

Read only

0 Likes
1,798

Hi,

I have a QUAN field.

I need to supress Zeros if values are for ex 10.000 into 10

I dont want QUAN field to get Converted into Char Field.

Thanks

Read only

0 Likes
1,798

>

> I dont want QUAN field to get Converted into Char Field.

>

> Thanks

Then MOVE it to a type P variable with decimals 0.

~Suresh

Read only

Former Member
0 Likes
1,798

Hi Shrikanth,

Try the Packing of numbers for the for all cases...since if the decimal values are zero then the rounding off does not matter and we need not write two different logics ....

eg: we have 12345.12345 in variable loc_var

declare the target variable as

data : field1(16) type p decimals 0.

field1 = loc_var.

now field1 will be 12345

if loc_var1 was 12345.65432

field1 = loc_var.

then field1 will be 12346 after rounding off

if we need decimal places.... like say 2 decimal places ....just change the declaration as

data : field2(16) type p decimals 2.

Hope it helps

Pls check and revert

Regards

Byju

Read only

Former Member
0 Likes
1,798

Hi,

Give the reference of the quantity unit field name in the fieldcatalog while filling the quantity field fieldcatalog. This reference field is the quantity unit on your output list. I'm sure you might be having the quantity unit field along with the quantity field.

Example :


  CLEAR fieldcat.
  fieldcat-fieldname     = 'MENGE'.
  fieldcat-tabname       = 'GT_LIST'.
  fieldcat-ref_tabname   = 'EKBE'.
  fieldcat-ref_fieldname = 'MENGE'.
  fieldcat-qfieldname    = 'MEINS'.
  APPEND fieldcat TO p_fieldcat.

So, the formatting will be done depending on the quanity unitin the GT_LIST-MEINS.

regards,

Advait