cancel
Showing results for 
Search instead for 
Did you mean: 

Removing trailing zeroes in a field in ALV display

selvakumar_mohan
Active Participant
0 Kudos

Hi,

I have done a report in WD4A, in which the final result is displayed in ALV. I have particular field in which the amount will displayed.

Currently the amount is display as below:

10,00000000000000

The actual amount is 10 $ . Can you please help me in truncating the trailing 0's in WD4A side itself, rather than changes in data element element.

Thanks,

Selvakumar M.

Accepted Solutions (1)

Accepted Solutions (1)

former_member40425
Contributor
0 Kudos

Hi,

You can use floor command.

Use following example

data: dec TYPE p DECIMALS 3 VALUE '10.000', " or if Value will be 10.999 will also return you 10
      with_out_fp TYPE string.
 
with_out_fp = floor( dec ).
WRITE: with_out_fp.

Or just take another variable of type P

data : v_dec TYPE netpr value '10.000',
v_wit_dec(15) TYPE p decimals 0.

v_wit_dec = v_dec .

v_wit_dec will contain value without decimal.

output: 10

I hope it helps.

Regards,

Rohit

selvakumar_mohan
Active Participant
0 Kudos

Hi Rohit,

It works!! thank you so much.

Thanks,

Selvakumar M.

Answers (3)

Answers (3)

Former Member
0 Kudos

Dear Selva,

You can use following code. So that you can removethe trailing zeroes.

lv_val = 10,00000000000000.

move this to another variable.

WRITE lv_val TO lv_string.
SHIFT lv_string RIGHT DELETING TRAILING '0'.
CONDENSE lv_string NO-GAPS.

Hope this will be Helpful.

Regards,

Anita Vizhi Arasi B

Former Member
0 Kudos

Try using SPLIT AT or SHIFT keywords.

Regards,

Radhika.

arjun_thakur
Active Contributor
0 Kudos

Hi Selva,

As such there is no way to remove trailing zeroes in webdynpro abap. But you can try to use the data type with required no. of decimal places. You can create an attribute of this data type and bind it with the alv column.

I hope it helps.

Regards

Arjun