2008 Nov 17 1:54 PM
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.
2008 Nov 17 1:56 PM
2008 Nov 17 2:02 PM
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
2008 Nov 17 2:49 PM
>
> I dont want QUAN field to get Converted into Char Field.
>
> Thanks
Then MOVE it to a type P variable with decimals 0.
~Suresh
2008 Nov 17 2:00 PM
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
2008 Nov 17 2:58 PM
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